Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
283df28
Avoid empty columns in tabulation file
GiudGiud Nov 6, 2025
a42e6c9
Check the initial guess when loading a (v,e) tabulation
GiudGiud Nov 6, 2025
05317d5
Make 2D newton inversion able to do 1D solves in degenerate case
GiudGiud Nov 6, 2025
29ae5da
Add ability to compute rho from p T when using v,e tabulations: using…
GiudGiud Nov 6, 2025
d21121b
Better error on missing routines
GiudGiud Nov 6, 2025
6d4ae89
Add e_from_p_rho computed from a ve tabulation
GiudGiud Nov 6, 2025
1c8b4de
Add rho from p T with AD for ve tabulations:
GiudGiud Nov 6, 2025
b0cfb39
Add e_from_p_rho with AD for ve tabulations
GiudGiud Nov 6, 2025
3259107
Adjust newton2D parameters
GiudGiud Nov 6, 2025
930f4b6
Add the caller name for the 2D newton solves to help debugging from t…
GiudGiud Nov 6, 2025
300ace2
Add test for degenerate Newton solve
GiudGiud Nov 6, 2025
2ca7275
Add test for new fluid properties calls
GiudGiud Nov 6, 2025
6baf412
Add more log to all Newton utils : use parameters in SPFP too
GiudGiud Nov 11, 2025
d219f00
Simplify default params for newton inversion
GiudGiud Nov 11, 2025
4dd1fd1
Add h_from_p_T using a (v,e) tabulation for volume junctions
GiudGiud Nov 11, 2025
b8a498b
Rework again error messages:
GiudGiud Nov 11, 2025
8af3db5
Add another error for missing input
GiudGiud Nov 11, 2025
f4dbb9c
Add e_from_p_T using a (v,e) tabulation
GiudGiud Nov 11, 2025
42292fd
Add missing s_from_v_e with derivatives
GiudGiud Nov 11, 2025
17b05cf
Implement h_from_p_T with derivatives using (v,e) tabulation
GiudGiud Nov 11, 2025
033f45e
Add rho from p T with derivatives
GiudGiud Nov 11, 2025
33bf3a0
Add s from p T with derivatives with v e tabulation
GiudGiud Nov 11, 2025
32716a6
Use the tabulations in presence of a FP source uo when computing prop…
GiudGiud Nov 11, 2025
e790a17
Add unit tests for properties from ve computed from a tabulation gene…
GiudGiud Nov 11, 2025
2643621
Label the unit tests better, highlighting the mssing fromVEFromFile case
GiudGiud Nov 11, 2025
930fa6b
Add some missing tests for p,T tabulation and p,T->(v,e) tabulation
GiudGiud Nov 11, 2025
540404c
More clarifying what fluid properties object is built how in unit tests
GiudGiud Nov 11, 2025
85466cc
Simplify logic for having ve interpolations
GiudGiud Nov 11, 2025
562577a
Deprecate 'fp' parameter to be able to use 'fp' in GlobalParams
GiudGiud Nov 11, 2025
476dcd0
Fix FP output from (v,e):
GiudGiud Nov 11, 2025
6f0332d
Add a test for (v,e) output of tabulation
GiudGiud Nov 11, 2025
0059cfb
Allow fp in GlobalParams with TFP
GiudGiud Nov 11, 2025
7c41a40
std::cout -> Moose::out
GiudGiud Nov 11, 2025
c390cac
Address test failure:
GiudGiud Nov 12, 2025
56ec22e
Fix test failures:
GiudGiud Nov 12, 2025
502dc25
Add the ability to ignore a fluid property from the tabulation file b…
GiudGiud Nov 12, 2025
109ab08
Avoid seg fault on OOB access
GiudGiud Nov 13, 2025
be047cb
Add AD (p,T) passthrough testing:
GiudGiud Nov 13, 2025
ed4be65
Use the interpolation bounds from the files in (v,e) over querying th…
GiudGiud Nov 13, 2025
470fc75
Examine coverage report and catch most misses:
GiudGiud Nov 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ divided into 50 and 100 equal points, respectively, then the input file syntax n
[]
[tabulated]
type = TabulatedBicubicFluidProperties
fp = co2
input_fp = co2
fluid_property_output_file = fluid_properties.csv
interpolated_properties = 'density enthalpy viscosity'

Expand Down Expand Up @@ -216,7 +216,7 @@ reachable values.

To avoid the difficulties in converting from (v,e) to (pressure, temperature) and then evaluating the properties
with (pressure, temperature), the properties can also be interpolated in (v,e). These interpolations can be created
from either another `FluidProperties` object, with the [!param](/FluidProperties/TabulatedFluidProperties/fp), or from a
from either another `FluidProperties` object, with the [!param](/FluidProperties/TabulatedFluidProperties/input_fp), or from a
(specific volume, specific internal energy) tabulation, using the [!param](/FluidProperties/TabulatedFluidProperties/fluid_property_ve_file) parameter.

Similarly as for (pressure, temperature), the list of properties to interpolate should be provided using the [!param](/FluidProperties/TabulatedFluidProperties/interpolated_properties) parameter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ class SinglePhaseFluidProperties : public FluidProperties
const Real _p_initial_guess;
/// Maximum number of iterations for the variable conversion newton solves
const unsigned int _max_newton_its;
/// Whether to output information about newton solves to console
const bool _verbose_newton;

private:
void unimplementedDerivativeMethod(const std::string & property_function_name) const
Expand Down Expand Up @@ -528,8 +530,19 @@ SinglePhaseFluidProperties::p_T_from_v_e(const CppType & v, // v value
CppType & de_dT) { e_from_p_T(pressure, temperature, new_e, de_dp, de_dT); };
try
{
FluidPropertiesUtils::NewtonSolve2D(
v, e, p0, T0, p, T, _tolerance, _tolerance, v_lambda, e_lambda);
FluidPropertiesUtils::NewtonSolve2D(v,
e,
p0,
T0,
p,
T,
_tolerance,
_tolerance,
v_lambda,
e_lambda,
"p_T_from_v_e",
_max_newton_its,
_verbose_newton);
conversion_succeeded = true;
}
catch (MooseException &)
Expand Down Expand Up @@ -557,8 +570,19 @@ SinglePhaseFluidProperties::p_T_from_v_h(const T & v, // v value
{ h_from_p_T(pressure, temperature, new_h, dh_dp, dh_dT); };
try
{
FluidPropertiesUtils::NewtonSolve2D(
v, h, p0, T0, pressure, temperature, _tolerance, _tolerance, v_lambda, h_lambda);
FluidPropertiesUtils::NewtonSolve2D(v,
h,
p0,
T0,
pressure,
temperature,
_tolerance,
_tolerance,
v_lambda,
h_lambda,
"p_T_from_v_h",
_max_newton_its,
_verbose_newton);
conversion_succeeded = true;
}
catch (MooseException &)
Expand Down Expand Up @@ -586,8 +610,19 @@ SinglePhaseFluidProperties::p_T_from_h_s(const T & h, // h value
{ s_from_p_T(pressure, temperature, new_s, ds_dp, ds_dT); };
try
{
FluidPropertiesUtils::NewtonSolve2D(
h, s, p0, T0, pressure, temperature, _tolerance, _tolerance, h_lambda, s_lambda);
FluidPropertiesUtils::NewtonSolve2D(h,
s,
p0,
T0,
pressure,
temperature,
_tolerance,
_tolerance,
h_lambda,
s_lambda,
"p_T_from_h_s",
_max_newton_its,
_verbose_newton);
conversion_succeeded = true;
}
catch (MooseException &)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties

virtual Real rho_from_p_T(Real pressure, Real temperature) const override;

virtual ADReal rho_from_p_T(const ADReal & pressure, const ADReal & temperature) const override;

virtual void rho_from_p_T(
Real pressure, Real temperature, Real & rho, Real & drho_dp, Real & drho_dT) const override;
virtual void rho_from_p_T(const ADReal & pressure,
Expand All @@ -53,21 +55,29 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties

virtual Real v_from_p_T(Real pressure, Real temperature) const override;

virtual ADReal v_from_p_T(const ADReal & pressure, const ADReal & temperature) const override;

virtual void
v_from_p_T(Real pressure, Real temperature, Real & v, Real & dv_dp, Real & dv_dT) const override;

virtual Real e_from_p_T(Real pressure, Real temperature) const override;

virtual ADReal e_from_p_T(const ADReal & pressure, const ADReal & temperature) const override;

virtual void
e_from_p_T(Real pressure, Real temperature, Real & e, Real & de_dp, Real & de_dT) const override;

virtual Real e_from_p_rho(Real pressure, Real rho) const override;

virtual ADReal e_from_p_rho(const ADReal & pressure, const ADReal & rho) const override;

virtual void
e_from_p_rho(Real pressure, Real rho, Real & e, Real & de_dp, Real & de_drho) const override;

virtual Real T_from_p_rho(Real pressure, Real rho) const;

virtual ADReal T_from_p_rho(const ADReal & pressure, const ADReal & rho) const;

virtual void T_from_p_rho(Real pressure, Real rho, Real & T, Real & dT_dp, Real & dT_drho) const;

virtual Real h_from_p_T(Real p, Real T) const override;
Expand Down Expand Up @@ -135,8 +145,18 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties
*/
virtual Real p_from_v_e(Real v, Real e) const override;
virtual void p_from_v_e(Real v, Real e, Real & p, Real & dp_dv, Real & dp_de) const override;
virtual void p_from_v_e(const ADReal & v,
const ADReal & e,
ADReal & p,
ADReal & dp_dv,
ADReal & dp_de) const override;
virtual Real T_from_v_e(Real v, Real e) const override;
virtual void T_from_v_e(Real v, Real e, Real & T, Real & dT_dv, Real & dT_de) const override;
virtual void T_from_v_e(const ADReal & v,
const ADReal & e,
ADReal & p,
ADReal & dp_dv,
ADReal & dp_de) const override;
virtual Real c_from_v_e(Real v, Real e) const override;
virtual void c_from_v_e(Real v, Real e, Real & c, Real & dc_dv, Real & dc_de) const override;
virtual Real cp_from_v_e(Real v, Real e) const override;
Expand All @@ -154,6 +174,7 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties
virtual Real T_from_p_s(Real p, Real s) const;
virtual void T_from_p_s(Real p, Real s, Real & T, Real & dT_dp, Real & dT_ds) const;
virtual Real s_from_v_e(Real v, Real e) const override;
virtual void s_from_v_e(Real v, Real e, Real & s, Real & ds_dv, Real & ds_de) const override;
virtual Real s_from_h_p(Real h, Real pressure) const override;
virtual void
s_from_h_p(Real h, Real pressure, Real & s, Real & ds_dh, Real & ds_dp) const override;
Expand Down Expand Up @@ -190,8 +211,10 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties

/**
* Checks initial guess for Newton Method
* @param post_reading_tabulation whether the check is performed at construction (false) or after
* reading a file tabulation (true)
*/
virtual void checkInitialGuess() const;
virtual void checkInitialGuess(bool post_reading_tabulation) const;

/// Read tabulation data from file
void readFileTabulationData(bool use_pT);
Expand Down Expand Up @@ -239,8 +262,15 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties
/// Standardized error message for missing interpolation
void missingVEInterpolationError(const std::string & function_name) const;

// Utility to forward errors related to fluid properties methods not implemented
[[noreturn]] void FluidPropertiesForwardError(const std::string & desired_routine) const;
/// Utility to forward errors related to fluid properties methods not implemented
[[noreturn]] void TabulationNotImplementedError(const std::string & desired_routine) const;
/// Utility to forward errors related to fluid properties needing more data for their computation
/// This should generally be used as an 'else' condition to if (_interpolate_property) / else if (_fp)
[[noreturn]] void NeedTabulationOrFPError(const std::string & desired_routine,
const std::string & needed_property) const;
/// Utility to forward errors related to properties being requested for tabulation, but no tabulation is present
/// This should generally be used as an 'else' condition to if (_interpolate_needed_property)
[[noreturn]] void NeedTabulationError(const std::string & needed_property) const;

/// File name of input tabulated data file
FileName _file_name_in;
Expand All @@ -264,9 +294,9 @@ class TabulatedFluidProperties : public SinglePhaseFluidProperties
/// Specific enthalpy vector
std::vector<Real> _enthalpy;

/// Whether to create direct (p,T) interpolations
/// Whether the object has direct (p,T) interpolations (whether created from file or from _fp)
const bool _create_direct_pT_interpolations;
/// Whether to create direct (v,e) interpolations
/// Whether the object has direct (v,e) interpolations (whether created from file or from _fp)
const bool _create_direct_ve_interpolations;

/// Tabulated fluid properties (read from file OR computed from _fp)
Expand Down
Loading