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

Avoid the tank to ever become completely empty - fixes #4526 #4527

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (= " + String(fluidLevel) + ") is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert(fluidLevel > 0, "Fluid level (= " + String(fluidLevel) + ") is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular.");
assert(fluidLevel > 0, "Fluid level is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular.");

Might be advisable to remove the value directly here (and in the assert message above) to follow #4399 (see also #4519).


// 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