Skip to content

Commit

Permalink
Address Peter's review:
Browse files Browse the repository at this point in the history
- stop defining cpT and rho cp T functors
- add a transient test
+ add an exception test
  • Loading branch information
GiudGiud committed Jan 12, 2025
1 parent 367bbf8 commit dfcac83
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,28 +94,21 @@ INSFVEnthalpyFunctorMaterial::INSFVEnthalpyFunctorMaterial(const InputParameters
}
else if (_h)
{
const auto & rho_h = addFunctorProperty<ADReal>(NS::enthalpy_density,
addFunctorProperty<ADReal>(NS::enthalpy_density,
[this](const auto & r, const auto & t)
{ return _rho(r, t) * (*_h)(r, t); });

addFunctorProperty<ADReal>(NS::time_deriv(getParam<MooseFunctorName>(NS::specific_enthalpy)),
[this](const auto & r, const auto & t) { return _h->dot(r, t); });

addFunctorProperty<ADReal>(
"rho_cp_temp", [&rho_h](const auto & r, const auto & t) -> ADReal { return rho_h(r, t); });

addFunctorProperty<ADReal>(
"cp_temp", [this](const auto & r, const auto & t) -> ADReal { return (*_h)(r, t); });
}
else
{
const auto & rho_h = addFunctorProperty<ADReal>(
addFunctorProperty<ADReal>(
NS::enthalpy_density,
[this](const auto & r, const auto & t)
{ return _rho(r, t) * _fp->h_from_p_T((*_pressure)(r, t), _temperature(r, t)); });

const auto & h =
addFunctorProperty<ADReal>(NS::specific_enthalpy,
addFunctorProperty<ADReal>(NS::specific_enthalpy,
[this](const auto & r, const auto & t) {
return _fp->h_from_p_T((*_pressure)(r, t), _temperature(r, t));
});
Expand All @@ -128,11 +121,5 @@ INSFVEnthalpyFunctorMaterial::INSFVEnthalpyFunctorMaterial(const InputParameters
_fp->h_from_p_T((*_pressure)(r, t).value(), _temperature(r, t).value(), h, dh_dp, dh_dT);
return dh_dT * _temperature.dot(r, t) + dh_dp * _pressure->dot(r, t);
});

addFunctorProperty<ADReal>(
"rho_cp_temp", [&rho_h](const auto & r, const auto & t) -> ADReal { return rho_h(r, t); });

addFunctorProperty<ADReal>("cp_temp",
[&h](const auto & r, const auto & t) -> ADReal { return h(r, t); });
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
[Tests]
issues = '#16809'
design = 'navier_stokes/wcnsfv.md'
[transient]
[transient_constant_cp_approx]
type = 'Exodiff'
input = 2d-transient.i
exodiff = 2d-transient_out.e
method = "!dbg"
requirement = 'The system shall be able to use realistic fluid properties in a weakly compressible flow simulation, while approximating enthalpy as the product of specific heat and temperature'
rel_err = 7e-5
# The non-linear tolerance is actually fairly tight, but the variable values
# are small at the no-slip boundary conditions, and this leads to absolute diffs of around 1e-15,
# triggering the default relative tolerance error criterion
valgrind = HEAVY
[]
[transient_using_h]
type = 'Exodiff'
input = 2d-transient.i
cli_args = 'FunctorMaterials/ins_fv/assume_constant_cp=false FunctorMaterials/ins_fv/fp=fp FunctorMaterials/ins_fv/pressure=pressure'
exodiff = 2d-transient_out.e
method = "!dbg"
requirement = 'The system shall be able to use realistic fluid properties in a weakly compressible flow simulation'
rel_err = 7e-5
# The non-linear tolerance is actually fairly tight, but the variable values
Expand Down Expand Up @@ -81,5 +94,12 @@
expect_err = "'reference_pressure_point' and 'reference_pressure' should not be set unless solving for the dynamic pressure"
detail = "the reference pressure is set when not solving for the dynamic pressure"
[]
[missing_fp]
type = RunException
input = '2d-transient.i'
cli_args = "FunctorMaterials/ins_fv/assume_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."
[]
[]
[]

0 comments on commit dfcac83

Please sign in to comment.