modelEdgeCases

check the iterative medium functions at the edges of the validity range

Information

Calls the iterative medium functions at the edges of the validity range, where convergence problems have occurred in the past: near the triple point, near the critical point, in the compressed liquid at very low pressure, at PMAX, and with s=0 (depending on the reference state). All test points are derived from Medium.fluidConstants and Medium.fluidLimits, so the model can be used for every fluid via redeclare package Medium.

Checked are the consistency of saturation states (equal pressure and Gibbs energy of liquid and vapour), pT→ph and pT→ps round trips, and that setState_pd and setState_Ts reproduce their inputs. Each failed check is reported in the simulation log, the number of failures is reported in one final assert; all results are written to edgecases.txt. A function that does not converge at all stops the simulation with its own error message.

For the almost incompressible liquid, a pressure deviation is also accepted if it corresponds to a density deviation within the tolerance, as in the solvers; at very low pressure, pressures are only resolvable to about 1e-7 Pa, therefore an absolute floor p_floor is accepted there.

Contents

NameDescription
Medium
reportprotectedwrite a failed check to the simulation log and to the result file
liquidOkprotectedliquid pressure equals p within tol_p, or as density error within tol_p (as in the solvers), or within p_floor
checkSat_pprotectedsetSat_p: liquid and vapour pressure equal p, equal Gibbs energy
checkSat_TprotectedsetSat_T: equal liquid and vapour pressure, equal Gibbs energy
checkRoundTripprotectedpT -> ph and pT -> ps must return the original T and d
checkState_pdprotectedsetState_pd: the EoS at the returned T must reproduce p
checkState_TsprotectedsetState_Ts: the EoS at the returned d must reproduce s