From 0ea07e1ff8524686a807867d7a3046d3bc40d75f Mon Sep 17 00:00:00 2001 From: "Joshua E. Hansel" Date: Tue, 7 Jan 2025 13:57:53 -0600 Subject: [PATCH] Improved error message for corner case in Fluid properties interrogator Closes #29656 --- .../userobjects/FluidPropertiesInterrogator.h | 2 ++ .../userobjects/FluidPropertiesInterrogator.C | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/fluid_properties/include/userobjects/FluidPropertiesInterrogator.h b/modules/fluid_properties/include/userobjects/FluidPropertiesInterrogator.h index 60c143d656d4..f887063988fb 100644 --- a/modules/fluid_properties/include/userobjects/FluidPropertiesInterrogator.h +++ b/modules/fluid_properties/include/userobjects/FluidPropertiesInterrogator.h @@ -173,6 +173,8 @@ class FluidPropertiesInterrogator : public GeneralUserObject const bool _has_2phase; /// flag that user provided 2-phase NCG fluid properties const bool _has_2phase_ncg; + /// flag that user provided 2-phase NCG partial pressure fluid properties + const bool _has_2phase_ncg_partial_pressure; /// pointer to liquid fluid properties object (if provided 2-phase object) const SinglePhaseFluidProperties * const _fp_liquid; diff --git a/modules/fluid_properties/src/userobjects/FluidPropertiesInterrogator.C b/modules/fluid_properties/src/userobjects/FluidPropertiesInterrogator.C index 2156ae3a2fd6..fbb1e43305fa 100644 --- a/modules/fluid_properties/src/userobjects/FluidPropertiesInterrogator.C +++ b/modules/fluid_properties/src/userobjects/FluidPropertiesInterrogator.C @@ -53,6 +53,7 @@ FluidPropertiesInterrogator::FluidPropertiesInterrogator(const InputParameters & _has_vapor_mixture(dynamic_cast(_fp)), _has_2phase(_fp_2phase), _has_2phase_ncg(_fp_2phase_ncg), + _has_2phase_ncg_partial_pressure(_fp_2phase_ncg_partial_pressure), _fp_liquid(_has_2phase ? &getUserObjectByName(_fp_2phase->getLiquidName()) : nullptr), @@ -387,7 +388,9 @@ FluidPropertiesInterrogator::computeVaporMixture(bool throw_error_if_no_match) // determine how state is specified std::vector> parameter_sets = { - {"p", "T", "x_ncg"}, {"rho", "e", "x_ncg"}, {"rho", "rhou", "rhoE", "x_ncg"}, {"p", "T"}}; + {"p", "T", "x_ncg"}, {"rho", "e", "x_ncg"}, {"rho", "rhou", "rhoE", "x_ncg"}}; + if (_has_2phase_ncg_partial_pressure) + parameter_sets.push_back({"p", "T"}); auto specified = getSpecifiedSetMap(parameter_sets, "vapor mixture", throw_error_if_no_match); // compute/determine rho, e, p, T, vel @@ -420,7 +423,7 @@ FluidPropertiesInterrogator::computeVaporMixture(bool throw_error_if_no_match) specified_a_set = true; } - else if (_fp_2phase_ncg_partial_pressure && specified["p,T"]) + else if (_has_2phase_ncg_partial_pressure && specified["p,T"]) { p = getParam("p"); T = getParam("T"); @@ -475,6 +478,22 @@ FluidPropertiesInterrogator::computeVaporMixture(bool throw_error_if_no_match) params.set("cv") = cv; params.set("k") = k; + const auto x_ncg = params.get>("x_ncg"); + for (unsigned int i = 0; i < x_ncg.size(); i++) + outputProperty("Mass fraction " + std::to_string(i), x_ncg[i], "-"); + outputProperty("Pressure", params.get("p"), "Pa"); + outputProperty("Temperature", params.get("T"), "K"); + outputProperty("Density", params.get("rho"), "kg/m^3"); + outputProperty("Specific volume", params.get("v"), "m^3/kg"); + outputProperty("Specific internal energy", params.get("e"), "J/kg"); + outputProperty("Specific enthalpy", params.get("h"), "J/kg"); + _console << std::endl; + outputProperty("Sound speed", params.get("c"), "m/s"); + outputProperty("Dynamic viscosity", params.get("mu"), "Pa-s"); + outputProperty("Specific heat at constant pressure", params.get("cp"), "J/(kg-K)"); + outputProperty("Specific heat at constant volume", params.get("cv"), "J/(kg-K)"); + outputProperty("Thermal conductivity", params.get("k"), "W/(m-K)"); + if (isParamValid("vel") || specified["rho,rhou,rhoE,x_ncg"]) { const Real h = e + p / rho;