Skip to content

Commit

Permalink
Avoid the tank to ever become completely empty - fixes #4526 (#4527)
Browse files Browse the repository at this point in the history
* Avoid the tank to ever become completely empty

* Update Modelica/Fluid/Vessels.mo

As discussed at the meeting

* Update Modelica/Fluid/Vessels.mo

Removed explicit reference to value in assert string

Co-authored-by: Thomas Beutlich <[email protected]>

---------

Co-authored-by: Hans Olsson <[email protected]>
Co-authored-by: Thomas Beutlich <[email protected]>
  • Loading branch information
3 people authored Feb 25, 2025
1 parent 7df356c commit 7c4858b
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 > 0, "Fluid level 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 7c4858b

Please sign in to comment.