Skip to content

Commit

Permalink
Avoid the tank to ever become completely empty
Browse files Browse the repository at this point in the history
  • Loading branch information
casella committed Feb 9, 2025
1 parent ff95fea commit 64ec590
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Modelica/Fluid/Vessels.mo
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ of the modeller. Increase nPorts to add an additional port.
end for;
// Check for correct solution
assert(fluidLevel <= fluidLevel_max, "Vessel is overflowing (fluidLevel > fluidLevel_max = " + String(fluidLevel) + ")");
assert(fluidLevel > -1e-6*fluidLevel_max, "Fluid level (= " + String(fluidLevel) + ") is below zero meaning that the solution failed.");
assert(fluidLevel > 1e-6*fluidLevel_max, "Fluid level (= " + String(fluidLevel) + ") is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular.");

// Boundary conditions

Expand Down
4 changes: 2 additions & 2 deletions ModelicaTest/Fluid/TestComponents/Vessels/TestSimpleTank.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ model TestSimpleTank
height=1,
nPorts=2,
portsData={Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.1,
height=0),Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
height=0.001),Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=
0.1, height=1)},
crossArea=1,
level_start=0)
level_start=0.001)
annotation (Placement(transformation(extent={{0,0},{40,40}})));

inner Modelica.Fluid.System system(energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
Expand Down

0 comments on commit 64ec590

Please sign in to comment.