Skip to content

Commit

Permalink
WIP Address Mauricio's review
Browse files Browse the repository at this point in the history
- rename a boolean
- rename a postprocessor

Co-authored-by: Mauricio Tano <mauriciotano@gmail.com>
  • Loading branch information
GiudGiud and tanoret authored Jan 12, 2025
1 parent c9faf9e commit f73eb16
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class INSFVEnthalpyFunctorMaterial : public FunctorMaterial

protected:
/// whether we can use a constant cp as a shortcut to compute enthalpy
bool _assume_constant_cp;
bool _assumed_constant_cp;

/// A fluid properties user object to compute enthalpy
const SinglePhaseFluidProperties * _fp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ INSFVEnthalpyFunctorMaterial::validParams()
NS::specific_enthalpy, NS::specific_enthalpy, "the name of the specific enthalpy");

// To handle non constant cp
params.addParam<bool>("assume_constant_cp", true, "Whether to assume cp is constant");
params.addParam<bool>("assumed_constant_cp", true, "Whether to assume cp is constant");
params.addParam<UserObjectName>(
NS::fluid, "Fluid properties, to be used when cp is not constant to compute enthalpy");
params.addParam<MooseFunctorName>(
Expand All @@ -50,7 +50,7 @@ INSFVEnthalpyFunctorMaterial::validParams()

INSFVEnthalpyFunctorMaterial::INSFVEnthalpyFunctorMaterial(const InputParameters & parameters)
: FunctorMaterial(parameters),
_assume_constant_cp(getParam<bool>("assume_constant_cp")),
_assumed_constant_cp(getParam<bool>("assumed_constant_cp")),
_fp(isParamValid(NS::fluid)
? &UserObjectInterface::getUserObject<SinglePhaseFluidProperties>(NS::fluid)
: nullptr),
Expand All @@ -63,15 +63,15 @@ INSFVEnthalpyFunctorMaterial::INSFVEnthalpyFunctorMaterial(const InputParameters
: nullptr)
{
// We have to use a warning because fp is often in the global parameters
if (_assume_constant_cp && _fp)
if (_assumed_constant_cp && _fp)
paramWarning(
"fp", "No need to specify fluid properties if assuming the specific enthalpy is constant");
if (!_assume_constant_cp && ((!_fp || !_pressure) && !_h))
paramError("fp",
"Must specify both fluid properties and pressure or an enthalpy functor if not "
"assuming the specific enthalpy is constant");

if (_assume_constant_cp)
if (_assumed_constant_cp)
{
const auto & rho_h =
addFunctorProperty<ADReal>(NS::enthalpy_density,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ advected_interp_method = 'upwind'
rho = 'rho'
cp = 'cp'

assume_constant_cp = false
assumed_constant_cp = false
h_in = 'h'
# Alternative to providing 'h': set the fluid property and the pressure parameter
# fp = 'fp'
# pressure = 'pressure'
[]
Expand Down Expand Up @@ -215,14 +216,14 @@ advected_interp_method = 'upwind'
variable = T
boundary = 'right'
[]
[T_analytical]
[T_analytical_outlet]
type = Receiver
default = ${fparse (-A_cp+sqrt(A_cp^2-2*B_cp*(-q_source/rho/bulk_u*L-A_cp*T_in-B_cp/2*T_in*T_in)))/B_cp}
[]
[error_T]
type = ParsedPostprocessor
expression = 'T_out - T_analytical'
pp_names = 'T_out T_analytical'
expression = 'T_out - T_analytical_outlet'
pp_names = 'T_out T_analytical_outlet'
[]
[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ advected_interp_method = 'upwind'
rho = 'rho'
cp = 'cp'

assume_constant_cp = false
assumed_constant_cp = false
h_in = 'h'
# fp = 'fp'
# pressure = 'pressure'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
time,H_in,H_out,Q,T_analytical,T_out,balance_in_percent,error_T
time,H_in,H_out,Q,T_analytical_outlet,T_out,balance_in_percent,error_T
0,0,0,1500000,899.2226858156,0,0,0
1,-24665522.4,26165522.540111,1500000,899.2226858156,899.22268943977,-5.6804577370916e-07,3.6241718817109e-06
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
cli_args = "Outputs/file_base=enthalpy_computation_non_constant_cp_out
FunctorMaterials/compute_cp/fp=fp
FunctorMaterials/compute_cp/pressure=pressure
FunctorMaterials/compute_cp/assume_constant_cp=false"
FunctorMaterials/compute_cp/assumed_constant_cp=false"
requirement = 'The system shall be able to compute the specific enthalpy and the enthalpy with a non constant specific heat.'
recover = false
[]
Expand Down Expand Up @@ -97,7 +97,7 @@
[missing_fp]
type = RunException
input = '2d-transient.i'
cli_args = "FunctorMaterials/ins_fv/assume_constant_cp=false"
cli_args = "FunctorMaterials/ins_fv/assumed_constant_cp=false"
expect_err = "Must specify both fluid properties and pressure or an enthalpy functor "
detail = "not enough parameters are specified when defining the enthalpy functor."
[]
Expand Down

0 comments on commit f73eb16

Please sign in to comment.