BrineFluidProperties + SimpleFluidProperties: density always wrong in unsaturated flow #32737
-
|
Hi, I am modelling variably-saturated NaCl transport with PorousFlow. Water97FluidProperties crashes at negative liquid pressures (suction) via inRegion(), so I need to replace it with SimpleFluidProperties as the water backend inside BrineFluidProperties. Whatever I try, the reported density is always 939 kg/m³, which is exactly the density that the default SimpleFluidProperties produces at 293 K with its default parameters (density0=1000, thermal_expansion=2.14e-4). My specified values are being ignored. What I tried
What I think is happening Two issues, possibly both active at once:
rho_from_p_T_X does not call _water_fp->rho_from_p_T(p, T) directly — it first computes a virtual temperature Tv from the Driesner NaCl correlation, then calls rho_from_p_T(p, Tv). This mapping was designed for Water97's internal reference state. With SimpleFluidProperties (rho = density0 * exp(p/K - alpha*T)), feeding Tv instead of the real T produces garbage, regardless of what density0 is set to.
When constructing the sub-object internally, addUserObject appears to skip registration if the name already exists, and getUserObject returns the pre-existing default-param object. The result is always the default SimpleFluidProperties at 293 K → 939 kg/m³, regardless of what we pass. I have attached a modified BrineFluidProperties.C that bypasses both issues: the Driesner virtual-temperature mappings for rho, h, and cp are removed (all three now evaluate at the real (p, T)), negative pressures are clamped to 1 Pa before calling SimpleFluidProperties, and the fluidName() guard is removed. I still get 939 with this file.... https://github.com/josebastiase/issues/tree/main/brine_issue |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hello how are you checking the density? With an auxkernel?
There is an error in the warehouse in the problem tries to add the exact same object twice. |
Beta Was this translation helpful? Give feedback.
Hello
how are you checking the density? With an auxkernel?
There is an error in the warehouse in the problem tries to add the exact same object twice.
Are you compiled in
develmode? This error is missed in opt since it'd be a developer error if that happened