Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5150062
>> Use SI.* where possible #16
tobias-reischl Feb 18, 2026
2e95471
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Feb 25, 2026
31f444f
Update ThermofluidStream/Boundaries/Internal/PartialTank.mo
tobiasreischl Mar 9, 2026
9bc06d0
Update ThermofluidStream/Boundaries/Internal/PartialTank.mo
tobiasreischl Mar 9, 2026
1a91f77
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
4f06f25
Update ThermofluidStream/Boundaries/Internal/PartialTank.mo
tobiasreischl Mar 9, 2026
d052af3
Update ThermofluidStream/Boundaries/Internal/PartialTank.mo
tobiasreischl Mar 9, 2026
9ce2827
Update ThermofluidStream/Boundaries/Internal/PartialTank.mo
tobiasreischl Mar 9, 2026
dbe2acc
Update ThermofluidStream/Boundaries/Internal/PartialTank.mo
tobiasreischl Mar 9, 2026
0405456
Update ThermofluidStream/FlowControl/Internal/PartialValve.mo
tobiasreischl Mar 9, 2026
b46c138
Update ThermofluidStream/Processes/Internal/FlowResistance/laminarTur…
tobiasreischl Mar 9, 2026
d2f8ce5
Update ThermofluidStream/Processes/Internal/FlowResistance/laminarTur…
tobiasreischl Mar 9, 2026
ab03bd5
Update ThermofluidStream/Processes/Internal/FlowResistance/partialPre…
tobiasreischl Mar 9, 2026
6acfad3
Update ThermofluidStream/Processes/Internal/PartialConductionElement.mo
tobiasreischl Mar 9, 2026
22b3a31
Update ThermofluidStream/Processes/Internal/PartialConductionElement.mo
tobiasreischl Mar 9, 2026
c7099bf
Update ThermofluidStream/Processes/Pipes/BaseClasses/WallFriction/Uti…
tobiasreischl Mar 9, 2026
6281a22
Update ThermofluidStream/Processes/Pipes/Internal/Interfaces/partialJ…
tobiasreischl Mar 9, 2026
81f5b04
Update ThermofluidStream/Processes/ThermalConvectionPipe.mo
tobiasreischl Mar 9, 2026
43644c5
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
44e0df2
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
ed59eb2
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
421dfeb
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
60d5e41
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
97a0f2e
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
6ec5174
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
81f9548
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
a921430
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
952acc2
Update ThermofluidStream/Undirected/Boundaries/Internal/PartialTankUn…
tobiasreischl Mar 9, 2026
16c6e02
> Changed SI.* to Medium.* wherever possible
tobias-reischl Mar 10, 2026
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
8 changes: 4 additions & 4 deletions ThermofluidStream/Boundaries/AccelerationBoundary.mo
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
within ThermofluidStream.Boundaries;
model AccelerationBoundary "Sets and broadcasts acceleration vector, default is
fixed in negative z-direction with length of DropOfCommons.g"
Modelica.Units.SI.Acceleration a[3];
SI.Acceleration a[3];
parameter Boolean setFromInputs = false annotation (choices(checkBox=true), Evaluate=true);
Modelica.Units.SI.Acceleration ax = 0
SI.Acceleration ax = 0
annotation(Dialog(group="Time varying output signal",enable=not setFromInputs));
Modelica.Units.SI.Acceleration ay = 0
SI.Acceleration ay = 0
annotation(Dialog(group="Time varying output signal",enable=not setFromInputs));
Modelica.Units.SI.Acceleration az = -dropOfCommons.g
SI.Acceleration az = -dropOfCommons.g
annotation(Dialog(group="Time varying output signal",enable=not setFromInputs));
Modelica.Blocks.Interfaces.RealInput ux if setFromInputs
annotation (Placement(transformation(extent={{-120,40},{-80,80}})));
Expand Down
6 changes: 3 additions & 3 deletions ThermofluidStream/Boundaries/CreateState.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ model CreateState "Create state signal as output"

parameter Boolean PFromInput = false "= true, if pressure input connector is enabled"
annotation(Dialog(group="Pressure"),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.Pressure p_par = Medium.p_default "Pressure set value"
parameter Medium.AbsolutePressure p_par = Medium.p_default "Pressure set value"
annotation(Dialog(group="Pressure", enable = not PFromInput));
parameter Boolean TFromInput = false "= true, if temperature input connector is enabled"
annotation(Dialog(group="Temperature", enable = not setEnthalpy),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.Temperature T_par = Medium.T_default "Temperature set value"
parameter Medium.Temperature T_par = Medium.T_default "Temperature set value"
annotation(Dialog(group="Temperature", enable = not setEnthalpy and not TFromInput));
parameter Boolean XiFromInput = false "= true, if mass fractions input connector is enabled"
annotation(Dialog(group="Mass fractions"),Evaluate=true, HideResult=true, choices(checkBox=true));
Expand All @@ -24,7 +24,7 @@ model CreateState "Create state signal as output"
annotation(Dialog(group="Specific enthalpy"),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter Boolean hFromInput = false "= true, if specific enthalpy input connector is enabled"
annotation(Dialog(group="Specific enthalpy", enable = setEnthalpy),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.SpecificEnthalpy h0_par = Medium.h_default "Specific enthalpy set value"
parameter Medium.SpecificEnthalpy h0_par = Medium.h_default "Specific enthalpy set value"
annotation(Dialog(group="Specific enthalpy", enable = setEnthalpy and not hFromInput));

parameter Utilities.Units.Inertance L=dropOfCommons.L "Inertance"
Expand Down
6 changes: 3 additions & 3 deletions ThermofluidStream/Boundaries/DynamicPressureInflow.mo
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ model DynamicPressureInflow "Extension of (p,T) source to (p,T,velocity)"
protected
Modelica.Blocks.Interfaces.RealInput A(unit = "m2") "Internal connector for cross-section area of outlet";

SI.Density rho_in = Medium.density(inlet.state) "Inlet density";
SI.Density rho_out "Outlet density";
SI.Density rho_mean "Mean density";
Medium.Density rho_in = Medium.density(inlet.state) "Inlet density";
Medium.Density rho_out "Outlet density";
Medium.Density rho_mean "Mean density";

Modelica.Blocks.Interfaces.RealInput v_in(unit="m/s") "Internal connector for inlet velocity";
SI.Velocity v_out "Outlet velocity";
Expand Down
6 changes: 3 additions & 3 deletions ThermofluidStream/Boundaries/DynamicPressureOutflow.mo
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ protected
SI.Velocity v_mean "Mean velocity";
SI.Velocity delta_v "Velocity difference";

SI.Density rho_in = Medium.density(inlet.state) "Inlet density";
SI.Density rho_out "Outlet density";
SI.Density rho_mean "Mean density";
Medium.Density rho_in = Medium.density(inlet.state) "Inlet density";
Medium.Density rho_out "Outlet density";
Medium.Density rho_mean "Mean density";

equation
connect(A_var, A);
Expand Down
57 changes: 28 additions & 29 deletions ThermofluidStream/Boundaries/Internal/PartialTank.mo
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,40 @@ inlets and outlets the volume is connected to.
</html>"));

parameter Boolean useHeatport = false "If true heatport is added";
parameter Modelica.Units.SI.Area A = 1 "Contact area of volume with medium"
parameter SI.Area A = 1 "Contact area of volume with medium"
annotation(Dialog(enable=useHeatport));
parameter Modelica.Units.SI.CoefficientOfHeatTransfer U = 200 "Heat transfer coefficient to medium"
parameter SI.CoefficientOfHeatTransfer U = 200 "Heat transfer coefficient to medium"
annotation(Dialog(enable=useHeatport));
parameter Boolean initialize_pressure = true "If true: initialize Pressure"
annotation(Dialog(tab= "Initialization"));
parameter Modelica.Units.SI.Pressure p_start = Medium.p_default "Initial Pressure"
parameter Medium.AbsolutePressure p_start = Medium.p_default "Initial Pressure"
annotation(Dialog(tab= "Initialization", enable=initialize_pressure));
parameter Boolean initialize_energy = false "Initialize specific inner energy with temperature or specific enthalpy condition"
annotation(Dialog(tab= "Initialization"));
parameter Modelica.Units.SI.Temperature T_start = Medium.T_default "Initial Temperature"
parameter Medium.Temperature T_start = Medium.T_default "Initial Temperature"
annotation(Dialog(tab= "Initialization", enable=initialize_energy and (not use_hstart)));
parameter Boolean use_hstart = false "True: specific enthalpy condition instead of Temperature"
annotation(Dialog(tab= "Initialization", enable=initialize_energy));
parameter Modelica.Units.SI.SpecificEnthalpy h_start = Medium.h_default "Initial specific enthalpy"
parameter Medium.SpecificEnthalpy h_start = Medium.h_default "Initial specific enthalpy"
annotation(Dialog(tab= "Initialization", enable=initialize_energy and use_hstart));
parameter Boolean initialize_Xi = false "If true: initialize mass fractions"
annotation(Dialog(tab= "Initialization"));
parameter Medium.MassFraction Xi_0[Medium.nXi] = Medium.X_default[1:Medium.nXi] "Initial mass fraction"
annotation(Dialog(tab= "Initialization", enable=initialize_Xi));
parameter Boolean initialize_LiquidMass = true "If true: initialize with mass of the liquid medium component. Initialize_Xi must be false."
annotation(Dialog(tab= "Initialization", enable=not initialize_Xi));
parameter Modelica.Units.SI.Mass M_liq_start=0 "Initial mass of the liquid"
parameter SI.Mass M_liq_start=0 "Initial mass of the liquid"
annotation(Dialog(tab= "Initialization", enable=initialize_LiquidMass));

parameter Utilities.Units.Inertance L = dropOfCommons.L "Inertance at inlet and outlet"
annotation (Dialog(tab="Advanced"));
parameter Real k_volume_damping(unit="1") = dropOfCommons.k_volume_damping "Damping factor multiplicator"
annotation(Dialog(tab="Advanced", group="Damping"));
parameter Modelica.Units.SI.MassFlowRate m_flow_assert(max=0) = -dropOfCommons.m_flow_reg "Assertion threshold for negative massflows"
parameter SI.MassFlowRate m_flow_assert(max=0) = -dropOfCommons.m_flow_reg "Assertion threshold for negative massflows"
annotation(Dialog(tab="Advanced"));
parameter Boolean usePreferredMediumStates=false "Use medium states instead of the ones differentiated in this component"
annotation(Dialog(tab="Advanced"));
parameter Modelica.Units.SI.Length outletTransition=0.01 "Width of band for smooth transition between gas and liquid at outlet"
annotation(Dialog(tab="Advanced"));
parameter SI.Length outletTransition=0.01 "Width of band for smooth transition between gas and liquid at outlet" annotation(Dialog(tab="Advanced"));


Interfaces.Inlet inlet[N_inlets](redeclare package Medium=Medium)
Expand All @@ -57,36 +56,36 @@ inlets and outlets the volume is connected to.

Medium.BaseProperties medium(preferredMediumStates=usePreferredMediumStates);

Modelica.Units.SI.Volume V;
Modelica.Units.SI.Volume V_liquid;
parameter SI.Pressure p_ref = 1e5 "Reference pressure of tank when volume is measured";
SI.Volume V;
SI.Volume V_liquid;
parameter Medium.AbsolutePressure p_ref = 1e5 "Reference pressure of tank when volume is measured";
//The tank gets a bulk modulus to handle the stiffness of incompressible media better
SI.Volume V_ref(displayUnit="l") "Volume of the tank at p_ref";
parameter SI.BulkModulus K = 5e7 "Bulk modulus of tank (used also for stiffness modulation)";

//Modelica.Units.SI.Volume V_gas "Gas volume in Tank";
//SI.Volume V_gas "Gas volume in Tank";

//setting the state is to prohibit dynamic state selection e.g. in VolumesDirectCoupling
Modelica.Units.SI.Mass M(stateSelect=if usePreferredMediumStates then StateSelect.default else StateSelect.always) = V*medium.d;
Modelica.Units.SI.Mass MXi[Medium.nXi](each stateSelect=if usePreferredMediumStates then StateSelect.default else StateSelect.always) = M*medium.Xi;
Modelica.Units.SI.Energy U_med(stateSelect=if usePreferredMediumStates then StateSelect.default else StateSelect.always) = M*medium.u;
SI.Mass M(stateSelect=if usePreferredMediumStates then StateSelect.default else StateSelect.always) = V*medium.d;
SI.Mass MXi[Medium.nXi](each stateSelect=if usePreferredMediumStates then StateSelect.default else StateSelect.always) = M*medium.Xi;
SI.Energy U_med(stateSelect=if usePreferredMediumStates then StateSelect.default else StateSelect.always) = M*medium.u;

Modelica.Units.SI.HeatFlowRate Q_flow;
Modelica.Units.SI.Power W_v;
parameter Modelica.Units.SI.Length tankCenter[3]={0,0,0} "Position of the tank center" annotation(Dialog(tab="General",group="Geometry"));
SI.HeatFlowRate Q_flow;
SI.Power W_v;
parameter SI.Length tankCenter[3]={0,0,0} "Position of the tank center" annotation(Dialog(tab="General",group="Geometry"));
parameter Integer N_inlets = 2 "Number of inlets"
annotation(Dialog(tab="General",group="Geometry"));
parameter Integer M_outlets = 2 "Number of outlets"
annotation(Dialog(tab="General",group="Geometry"));

parameter Modelica.Units.SI.Length inletPositions[N_inlets,3]={{0,0,0},{0,0,0}} "Positions of all inlets" annotation(Dialog(tab="General",group="Geometry"));
parameter Modelica.Units.SI.Length outletPositions[M_outlets,3]={{0,0,0},{0,0,0}} "Positions of all outlets" annotation(Dialog(tab="General",group="Geometry"));
Modelica.Units.SI.Length centerOfMass[3];
parameter SI.Length inletPositions[N_inlets,3]={{0,0,0},{0,0,0}} "Positions of all inlets" annotation(Dialog(tab="General",group="Geometry"));
parameter SI.Length outletPositions[M_outlets,3]={{0,0,0},{0,0,0}} "Positions of all outlets" annotation(Dialog(tab="General",group="Geometry"));
SI.Length centerOfMass[3];

Modelica.Units.SI.Length staticHeadInlets[N_inlets] "distance perpendicular to liquid surface, 0 if above surface";
Modelica.Units.SI.Length staticHeadOutlets[M_outlets] "distance perpendicular to liquid surface, 0 if above surface";
Medium.AbsolutePressure staticHeadInlets_Pa_relative[N_inlets] "relative pressure to liquid surface, 0 if above surface";
Medium.AbsolutePressure staticHeadOutlets_Pa_relative[M_outlets] "relative pressure to liquid surface, 0 if above surface";
SI.Length staticHeadInlets[N_inlets] "distance perpendicular to liquid surface, 0 if above surface";
SI.Length staticHeadOutlets[M_outlets] "distance perpendicular to liquid surface, 0 if above surface";
SI.Pressure staticHeadInlets_Pa_relative[N_inlets] "relative pressure to liquid surface, 0 if above surface";
SI.Pressure staticHeadOutlets_Pa_relative[M_outlets] "relative pressure to liquid surface, 0 if above surface";

Real normAcc[3]=Modelica.Math.Vectors.normalize(acceleration.a);

Expand All @@ -105,12 +104,12 @@ protected
Medium.MassFraction Xi_out[Medium.nXi,M_outlets];

Real d(unit="1/(m.s)") = k_volume_damping*sqrt(abs(2*L/(V*max(density_derp_h, 1e-10)))) "Friction factor for coupled boundaries";
//Modelica.Units.SI.DerDensityByPressure density_derp_h=1e-5 "Partial derivative of density by pressure";
//Medium.DerDensityByPressure density_derp_h=1e-5 "Partial derivative of density by pressure";
Medium.DerDensityByPressure density_derp_h=(V_ref*medium.d)/(V*K) "Partial derivative of density by pressure";

Medium.AbsolutePressure r_damping = d*der(M);
SI.Pressure r_damping = d*der(M);

Medium.AbsolutePressure r[N_inlets];
SI.Pressure r[N_inlets];

Medium.Temperature T_heatPort;

Expand Down
16 changes: 8 additions & 8 deletions ThermofluidStream/Boundaries/Internal/PartialVolume.mo
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ inlets and outlets the volume is connected to.

parameter Boolean initialize_pressure = true "=true, if pressure is initialized"
annotation(Dialog(tab= "Initialization",group="Pressure"),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.Pressure p_start = Medium.p_default "Initial pressure set value"
parameter Medium.AbsolutePressure p_start = Medium.p_default "Initial pressure set value"
annotation(Dialog(tab= "Initialization",group="Pressure", enable=initialize_pressure));
parameter Boolean initialize_energy = true "= true, if internal energy is initialized"
annotation(Dialog(tab= "Initialization",group="Temperature"),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.Temperature T_start = Medium.T_default "Initial Temperature set value"
parameter Medium.Temperature T_start = Medium.T_default "Initial Temperature set value"
annotation(Dialog(tab= "Initialization",group="Temperature", enable=initialize_energy and (not use_hstart)));
parameter Boolean initialize_Xi = true "=true, if mass fractions are iinitialized"
annotation(Dialog(tab= "Initialization",group="Mass fractions"),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter Medium.MassFraction Xi_0[Medium.nXi] = Medium.X_default[1:Medium.nXi] "Initial mass fractions set values"
annotation(Dialog(tab= "Initialization",group="Mass fractions", enable=initialize_Xi));
parameter Boolean use_hstart = false "=true, if internal energy is initialized with specific enthalpy"
annotation(Dialog(tab= "Initialization",group="Specific enthalpy", enable=initialize_energy),Evaluate=true, HideResult=true, choices(checkBox=true));
parameter SI.SpecificEnthalpy h_start = Medium.h_default "Initial specific enthalpy set value"
parameter Medium.SpecificEnthalpy h_start = Medium.h_default "Initial specific enthalpy set value"
annotation(Dialog(tab= "Initialization",group="Specific enthalpy", enable=initialize_energy and use_hstart));

parameter Utilities.Units.Inertance L = dropOfCommons.L "Inertance of inlet/outlet"
Expand Down Expand Up @@ -68,23 +68,23 @@ inlets and outlets the volume is connected to.
SI.Power W_v "Work due to change of volume"; // Volumenaenderungsarbeitsstrom

protected
SI.Temperature T_heatPort "Heat port temperature";
Medium.Temperature T_heatPort "Heat port temperature";
SI.Pressure r "Inertial pressure";

Real d(unit="1/(m.s)") = k_volume_damping*sqrt(abs(2*L/(V*max(density_derp_h, 1e-10)))) "Friction factor for coupled boundaries";
SI.DerDensityByPressure density_derp_h "Partial derivative of density by pressure at constant specific enthalpy";
Medium.DerDensityByPressure density_derp_h "Partial derivative of density by pressure at constant specific enthalpy";
SI.Pressure r_damping = d*der(M) "Damping of inertial pressure";

Medium.ThermodynamicState state_in "Inlet state";
SI.Pressure p_in = Medium.pressure(state_in) "Inlet pressure";
Medium.AbsolutePressure p_in = Medium.pressure(state_in) "Inlet pressure";
// fix potential instabilities by setting the outgoing enthalpy and mass fraction to the medium state
SI.SpecificEnthalpy h_in = if noEvent(m_flow_in >= 0) then Medium.specificEnthalpy(state_in) else medium.h "Inlet specific enthalpy";
Medium.SpecificEnthalpy h_in = if noEvent(m_flow_in >= 0) then Medium.specificEnthalpy(state_in) else medium.h "Inlet specific enthalpy";
Medium.MassFraction Xi_in[Medium.nXi] = if noEvent(m_flow_in >= 0) then Medium.massFraction(state_in) else medium.Xi "Inlet mass fractions";

Medium.ThermodynamicState state_out "Oulet state";
// fix potential instabilities by setting the incoming enthalpy and mass fraction inlet ones,
// effectiveley removing the mass-flow related parts of the differential equations for U and MXi
SI.SpecificEnthalpy h_out = if noEvent(-m_flow_out >= 0) then Medium.specificEnthalpy(state_out) else medium.h "Outlet specific enthalpy";
Medium.SpecificEnthalpy h_out = if noEvent(-m_flow_out >= 0) then Medium.specificEnthalpy(state_out) else medium.h "Outlet specific enthalpy";
Medium.MassFraction Xi_out[Medium.nXi] = if noEvent(-m_flow_out >= 0) then Medium.massFraction(state_out) else medium.Xi "Outlet mass fractions";

SI.Pressure r_in, r_out "Inlet/Outlet inertial pressure";
Expand Down
Loading