I'm currently working on modeling a system involving fluid recirculation, (see image showing fluid flow). In this system, the fluid enters through the inlet and passes through pipe 1. Before reaching the DPSs orifice, a portion of the fluid is diverted through a parallel pipe. Has anyone encountered a similar simulation challenge before? Any insights or prior experience with this type of problem would be greatly appreciated. Thanks in advance!
open modelica version :
Connected to OpenModelica v1.14.1 (64-bit) Connected to OMSimulator v2.1.0-dev-147-g36ec2c7-mingw
the code :
model separation
replaceable package Medium = Modelica.Media.Water.WaterIF97_ph constrainedby Modelica.Media.Interfaces.PartialMedium;
/* Déclaration de la convection forcée*/
replaceable model heatTransfet = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0 = conv_ext);
/* Déclaration de la conduite */
Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare package Medium = Medium, allowFlowReversal = false, diameter = 5e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, isCircular = true, length = 15, m_flows(fixed = true, start = 0.08), massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 5, roughness = 3.2e-05, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-2, 10}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
/* Paroi */
/* Conditions aux limites */
Modelica.Fluid.Sources.Boundary_pT inlet(redeclare package Medium = Medium, T = 40 + 273.15, nPorts = 1, p = 14e+5, use_p_in = false) annotation(
Placement(visible = true, transformation(origin = {-86, -26}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));
Modelica.Fluid.Fittings.SimpleGenericOrifice DPSs(redeclare package Medium = Medium, diameter = 10e-3, use_zeta = true, zeta = 200) annotation(
Placement(visible = true, transformation(origin = {37, -26}, extent = {{-7, -8}, {7, 8}}, rotation = 0)));
inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial, massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) annotation(
Placement(visible = true, transformation(origin = {-80, 22}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.SimpleGenericOrifice DPSe(redeclare package Medium = Medium, diameter = 10e-3, use_zeta = true, zeta = 1) annotation(
Placement(visible = true, transformation(origin = {-47, -26}, extent = {{-11, -8}, {11, 8}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary(redeclare package Medium = Medium,T = 40 + 273.15, m_flow = -0.32, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {72, -26}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare package Medium = Medium,diameter = 10e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, isCircular = true, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 5, roughness = 3.2e-05, use_HeatTransfer = false) annotation(
Placement(visible = true, transformation(origin = {-2, -26}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(inlet.ports[1], DPSe.port_a) annotation(
Line(points = {{-80, -26}, {-58, -26}, {-58, -26}, {-58, -26}}, color = {0, 127, 255}));
connect(DPSe.port_b, pipe1.port_a) annotation(
Line(points = {{-36, -26}, {-12, -26}}, color = {0, 127, 255}));
connect(pipe1.port_b, DPSs.port_a) annotation(
Line(points = {{8, -26}, {30, -26}}, color = {0, 127, 255}));
connect(DPSs.port_b, boundary.ports[1]) annotation(
Line(points = {{44, -26}, {62, -26}}, color = {0, 127, 255}));
connect(pipe.port_b, DPSe.port_b) annotation(
Line(points = {{-12, 10}, {-36, 10}, {-36, -26}, {-36, -26}}, color = {0, 127, 255}));
connect(pipe.port_a, DPSs.port_a) annotation(
Line(points = {{8, 10}, {30, 10}, {30, -26}}, color = {0, 127, 255}));
algorithm
annotation(
uses(Modelica(version = "3.2.3")),
Diagram);
end separation;
I attempted to prevent fluid flow reversal in "pipe," but encountered an error stating:
"the solver will attempt to manage a division by zero at time 0: pipe.m_flows[1] + max(DPSe.m_flow, 1e-007). This division results in infinity or NaN at time 0, with (a=27123.8) / (b=0), where the divisor b is: pipe.m_flows[1] + max(DPSe.m_flow, 1e-007)."
In your model the pressure decreases monotonically from inlet
towards boundary
. Thus, there is no "physical law" (gravity, acceleration due to boiling etc.) in pipe
that would cause the flow to go against the generated pressure drop.
Additionally, setting allowFlowReversal
to false
does not make pipe
act as a check valve. It just stops the simulation with an error message stating that you have violated the requirement that m_flow>0
.