Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with zero flow through Modelica.Fluid.Fittings.GenericResistances.VolumeFlowRate #4170

Open
julfrei-hystar opened this issue Jul 11, 2023 · 0 comments
Assignees
Labels
L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)

Comments

@julfrei-hystar
Copy link

julfrei-hystar commented Jul 11, 2023

Running the model with the code below on OpenModelica v1.20.0 (64-bit) on Windows 11 Pro, I get the following timer values:

127.642s [ 60.1%] simulation
212.397s [100.0%] total

Setting the constant openingA to 0 and openingB to 1, the following timer values are achieved:

0.339589s [ 31.5%] simulation
1.07687s [100.0%] total

The only difference between the two lines is the element Modelica.Fluid.Fittings.GenericResistances.VolumeFlowRate.
Does anyone know the reason for this significant difference?

model fluidCircuit

  inner Modelica.Fluid.System system(T_start = 308, energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial, m_flow_start = 16.5, massDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial) annotation(
    Placement(visible = true, transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  replaceable package Medium = Modelica.Media.CompressibleLiquids.LinearWater_pT_Ambient constrainedby Modelica.Media.Interfaces.PartialMedium;

  Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Medium, crossArea = 0.3, height = 0.8, nPorts = 3, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.065), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.065, height = 0.3), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.065, height = 0.3)}) annotation(
    Placement(visible = true, transformation(origin = {110, 70}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant const(k = 1500) annotation(
    Placement(visible = true, transformation(origin = {-10, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Machines.PrescribedPump pump(redeclare package Medium = Medium, redeclare function flowCharacteristic = Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.polynomialFlow(V_flow_nominal = {0, 0.01, 0.02, 0.026, 0.034}, head_nominal = {25.5, 25, 24, 22, 17.5}), redeclare function powerCharacteristic = Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticPower(V_flow_nominal = {0.01, 0.02, 0.03}, W_nominal = {4000, 6000, 7800}), N(start = 1500), N_nominal = 1500, V = 0.005, use_powerCharacteristic = true) annotation(
    Placement(visible = true, transformation(origin = {80, -20}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));

  Modelica.Blocks.Sources.Constant openingA(k = 1) annotation(
    Placement(visible = true, transformation(origin = {50, 90}, extent = {{-10, 10}, {10, -10}}, rotation = -180)));
  Modelica.Fluid.Valves.ValveLinear valveA(redeclare package Medium = Medium, dp_nominal(displayUnit = "Pa") = 100000, m_flow_nominal = 10) annotation(
    Placement(visible = true, transformation(origin = {20, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant openingB(k = 0) annotation(
    Placement(visible = true, transformation(origin = {-40, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveLinear valveB(redeclare package Medium = Medium, dp_nominal(displayUnit = "Pa") = 100000, m_flow_nominal = 10) annotation(
    Placement(visible = true, transformation(origin = {-10, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

  Modelica.Fluid.Fittings.GenericResistances.VolumeFlowRate resistance2(redeclare package Medium = Medium, a = 30000000, b = 0) annotation(
    Placement(visible = true, transformation(origin = {-70, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Fittings.GenericResistances.VolumeFlowRate resistance1(redeclare package Medium = Medium, a = 30000000, b = 0) annotation(
    Placement(visible = true, transformation(origin = {20, -20}, extent = {{-10, 10}, {10, -10}}, rotation = -180)));

  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium, diameter = 0.1, length = 5) annotation(
    Placement(visible = true, transformation(origin = {110, 10}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Fluid.Pipes.StaticPipe pipe2(redeclare package Medium = Medium, diameter = 0.1, length = 5) annotation(
    Placement(visible = true, transformation(origin = {50, -20}, extent = {{-10, 10}, {10, -10}}, rotation = -180)));
  Modelica.Fluid.Pipes.StaticPipe pipe3a(redeclare package Medium = Medium, diameter = 0.1, length = 5) annotation(
    Placement(visible = true, transformation(origin = {-40, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe3b(redeclare package Medium = Medium, diameter = 0.1, length = 5) annotation(
    Placement(visible = true, transformation(origin = {-40, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe4a(redeclare package Medium = Medium, diameter = 0.1, length = 5) annotation(
    Placement(visible = true, transformation(origin = {50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe4b(redeclare package Medium = Medium, diameter = 0.1, length = 5) annotation(
    Placement(visible = true, transformation(origin = {50, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
equation
  connect(pipe3b.port_b, valveB.port_a) annotation(
    Line(points = {{-30, 60}, {-20, 60}}, color = {0, 127, 255}));
  connect(pipe3a.port_b, valveA.port_a) annotation(
    Line(points = {{-30, 30}, {10, 30}}, color = {0, 127, 255}));
  connect(resistance1.port_a, pipe2.port_b) annotation(
    Line(points = {{30, -20}, {40, -20}}, color = {0, 127, 255}));
  connect(valveB.port_b, pipe4b.port_a) annotation(
    Line(points = {{0, 60}, {40, 60}}, color = {0, 127, 255}));
  connect(valveA.port_b, pipe4a.port_a) annotation(
    Line(points = {{30, 30}, {40, 30}}, color = {0, 127, 255}));
  connect(resistance2.port_a, resistance1.port_b) annotation(
    Line(points = {{-80, 60}, {-90, 60}, {-90, -20}, {10, -20}}, color = {0, 127, 255}));
  connect(pipe1.port_a, tank.ports[1]) annotation(
    Line(points = {{110, 20}, {110, 50}}, color = {0, 127, 255}));
  connect(pipe4a.port_b, tank.ports[2]) annotation(
    Line(points = {{60, 30}, {70, 30}, {70, 50}, {110, 50}}, color = {0, 127, 255}));
  connect(pipe4b.port_b, tank.ports[3]) annotation(
    Line(points = {{60, 60}, {70, 60}, {70, 50}, {110, 50}}, color = {0, 127, 255}));
  connect(pipe2.port_a, pump.port_b) annotation(
    Line(points = {{60, -20}, {70, -20}}, color = {0, 127, 255}));
  connect(pump.port_a, pipe1.port_b) annotation(
    Line(points = {{90, -20}, {110, -20}, {110, 0}}, color = {0, 127, 255}));
  connect(const.y, pump.N_in) annotation(
    Line(points = {{1, 0}, {80, 0}, {80, -10}}, color = {0, 0, 127}));
  connect(pipe3a.port_a, resistance1.port_b) annotation(
    Line(points = {{-50, 30}, {-70, 30}, {-70, -20}, {10, -20}}, color = {0, 127, 255}));
  connect(resistance2.port_b, pipe3b.port_a) annotation(
    Line(points = {{-60, 60}, {-50, 60}}, color = {0, 127, 255}));
  connect(openingB.y, valveB.opening) annotation(
    Line(points = {{-28, 90}, {-10, 90}, {-10, 68}}, color = {0, 0, 127}));
  connect(openingA.y, valveA.opening) annotation(
    Line(points = {{39, 90}, {20, 90}, {20, 38}}, color = {0, 0, 127}));
  annotation(
    Diagram(coordinateSystem(extent = {{-100, 100}, {140, -40}})),
    uses(Modelica(version = "4.0.0")),
    version = "");
end fluidCircuit;
@beutlich beutlich added the L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) label Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)
Projects
None yet
Development

No branches or pull requests

3 participants