From b81a6d443bbc5c8c7c394547fa24c5fc5e978307 Mon Sep 17 00:00:00 2001 From: Matthieu Descombes Date: Thu, 12 Feb 2026 11:19:34 +0100 Subject: [PATCH] feat : dev convection --- .../OTRERA_formation/Components/Convection.mo | 32 +++++++++++++++++++ .../Components/Convection_with_Element1D.mo | 21 ++++++++++++ .../OTRERA_formation/Components/package.order | 2 ++ .../OTRERA_formation/Models/Coupled_model.mo | 2 ++ 4 files changed, 57 insertions(+) create mode 100644 Formation/OTRERA_formation/Components/Convection.mo create mode 100644 Formation/OTRERA_formation/Components/Convection_with_Element1D.mo diff --git a/Formation/OTRERA_formation/Components/Convection.mo b/Formation/OTRERA_formation/Components/Convection.mo new file mode 100644 index 0000000..4d3045f --- /dev/null +++ b/Formation/OTRERA_formation/Components/Convection.mo @@ -0,0 +1,32 @@ +within OTRERA_formation.Components; + +model Convection + + //USER DEFINED PARAMETERS + parameter Modelica.Units.SI.Area S=0.0 "Exchange area between fluid and solid" ; + parameter Modelica.Units.SI.CoefficientOfHeatTransfer h = 0.0 "Convective heat transfer coefficient"; + + + //INTERNAL VARIABLES + Modelica.Units.SI.HeatFlowRate Q_flow ; + Modelica.Units.SI.Temperature T_wall ; + Modelica.Units.SI.Temperature T_fluid ; + //IMPORTED COMPONENTS + Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_wall annotation( + Placement(transformation(origin = {-96, 2}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-90, 0}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_fluid annotation( + Placement(transformation(origin = {96, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {90, 0}, extent = {{-10, -10}, {10, 10}}))); +equation + + Q_flow = h * S * (T_wall - T_fluid) ; + + //Port handover + + port_fluid.Q_flow + port_wall.Q_flow = 0.0 ; + port_fluid.Q_flow = -Q_flow ; + T_wall = port_wall.T ; + T_fluid = port_fluid.T ; + + + +end Convection; \ No newline at end of file diff --git a/Formation/OTRERA_formation/Components/Convection_with_Element1D.mo b/Formation/OTRERA_formation/Components/Convection_with_Element1D.mo new file mode 100644 index 0000000..62a9e1e --- /dev/null +++ b/Formation/OTRERA_formation/Components/Convection_with_Element1D.mo @@ -0,0 +1,21 @@ +within OTRERA_formation.Components; + +model Convection_with_Element1D + extends Modelica.Thermal.HeatTransfer.Interfaces.Element1D ; + //USER DEFINED PARAMETERS + parameter Modelica.Units.SI.Area S=0.0 "Exchange area between fluid and solid" ; + parameter Modelica.Units.SI.CoefficientOfHeatTransfer h = 0.0 "Convective heat transfer coefficient"; + + + //INTERNAL VARIABLES + + //IMPORTED COMPONENTS + +equation + + Q_flow = h * S * dT ; + + //Port handover + + +end Convection_with_Element1D; \ No newline at end of file diff --git a/Formation/OTRERA_formation/Components/package.order b/Formation/OTRERA_formation/Components/package.order index 89d5408..d1251cc 100644 --- a/Formation/OTRERA_formation/Components/package.order +++ b/Formation/OTRERA_formation/Components/package.order @@ -1,3 +1,5 @@ ThermalCapacity Heatflow Temperature +Convection +Convection_with_Element1D diff --git a/Formation/OTRERA_formation/Models/Coupled_model.mo b/Formation/OTRERA_formation/Models/Coupled_model.mo index 5fda650..5075c98 100644 --- a/Formation/OTRERA_formation/Models/Coupled_model.mo +++ b/Formation/OTRERA_formation/Models/Coupled_model.mo @@ -8,6 +8,8 @@ model Coupled_model Placement(transformation(origin = {-46, 10}, extent = {{-10, -10}, {10, 10}}))); Components.Heatflow heatflow1(Q_flow = 2000) annotation( Placement(transformation(origin = {-46, -20}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor annotation( + Placement(transformation(origin = {22, 58}, extent = {{-10, -10}, {10, 10}}))); equation connect(heatflow.port, thermalCapacity.port) annotation( Line(points = {{-46, 10}, {-10, 10}}, color = {191, 0, 0}));