18#define define_mass_specific_prop_from_p_T(prop) \
19 Real IdealGasMixtureFluidProperties::prop##_from_p_T( \
20 Real p, Real T, const std::vector<Real> & x_secondary) const \
22 const auto x = secondaryToAllMassFractions(x_secondary); \
23 mooseAssert(x.size() == _n_components, "Size mismatch"); \
26 for (const auto i : make_range(_n_components)) \
27 z += x[i] * _component_fps[i]->prop##_from_p_T(p, T); \
31 ADReal IdealGasMixtureFluidProperties::prop##_from_p_T( \
32 const ADReal & p, const ADReal & T, const std::vector<ADReal> & x_secondary) const \
34 const auto x = secondaryToAllMassFractions(x_secondary); \
35 mooseAssert(x.size() == _n_components, "Size mismatch"); \
38 for (const auto i : make_range(_n_components)) \
39 z += x[i] * _component_fps[i]->prop##_from_p_T(p, T); \
47#define define_transport_prop_from_p_T(prop) \
48 Real IdealGasMixtureFluidProperties::prop##_from_p_T( \
49 Real p, Real T, const std::vector<Real> & x_secondary) const \
51 const auto x = secondaryToAllMassFractions(x_secondary); \
52 const auto psi = molarFractionsFromMassFractions(x); \
53 mooseAssert(psi.size() == _n_components, "Size mismatch"); \
56 for (const auto i : make_range(_n_components)) \
57 y += psi[i] * _component_fps[i]->prop##_from_p_T(p, T); \
61 ADReal IdealGasMixtureFluidProperties::prop##_from_p_T( \
62 const ADReal & p, const ADReal & T, const std::vector<ADReal> & x_secondary) const \
64 const auto x = secondaryToAllMassFractions(x_secondary); \
65 const auto psi = molarFractionsFromMassFractions(x); \
66 mooseAssert(psi.size() == _n_components, "Size mismatch"); \
69 for (const auto i : make_range(_n_components)) \
70 y += psi[i] * _component_fps[i]->prop##_from_p_T(p, T); \
82define_transport_prop_from_p_T(
mu)
83define_transport_prop_from_p_T(k)
85#undef define_mass_specific_prop_from_p_T
86#undef define_transport_prop_from_p_T
97 "component_fluid_properties",
98 "Name of component fluid properties user objects. The first entry should be the primary "
107 _component_fp_names(getParam<
std::vector<UserObjectName>>(
"component_fluid_properties")),
108 _n_components(_component_fp_names.size()),
109 _n_secondary_components(_n_components - 1)
112 mooseError(
"There must be at least one entry in 'component_fluid_properties'.");
117 const auto & single_phase_fp =
122 "Each entry in 'component_fluid_properties' must have type 'IdealGasFluidProperties'.");
135 mooseAssert(i < getNumberOfSecondaryVapors(),
"Requested secondary index too high.");
139template <
typename CppType>
142 const std::vector<CppType> & x_secondary)
const
148 sum += x_secondary[i];
150 const CppType x_primary = 1.0 - sum;
152 std::vector<CppType>
x;
153 x.push_back(x_primary);
154 x.insert(
x.end(), x_secondary.begin(), x_secondary.end());
161 const std::vector<ADReal> & x_secondary)
const
168 const std::vector<Real> & x_secondary)
const
173template <
typename CppType>
198template <
typename CppType>
204 CppType cp_mix = 0, cv_mix = 0;
212 return cp_mix / cv_mix;
227template <
typename CppType>
230 const std::vector<CppType> &
x)
const
255IdealGasMixtureFluidProperties::rho_from_p_T(
const ADReal &
p,
257 const std::vector<ADReal> & x_secondary)
const
259 return 1.0 / v_from_p_T(
p,
T, x_secondary);
263IdealGasMixtureFluidProperties::rho_from_p_T(Real
p,
265 const std::vector<Real> & x_secondary)
const
267 return 1.0 / v_from_p_T(
p,
T, x_secondary);
270template <
typename CppType>
272IdealGasMixtureFluidProperties::e_from_p_rho_templ(
const CppType &
p,
274 const std::vector<CppType> & x_secondary)
const
281 CppType e_ref_sum = 0;
285 e_ref_sum +=
x[i] *
_component_fps[i]->referenceSpecificInternalEnergy();
290 return cv_sum *
M *
p / (
_R *
rho) + e_ref_sum;
294IdealGasMixtureFluidProperties::e_from_p_rho(
const ADReal &
p,
296 const std::vector<ADReal> & x_secondary)
const
298 return e_from_p_rho_templ(
p,
rho, x_secondary);
302IdealGasMixtureFluidProperties::e_from_p_rho(Real
p,
304 const std::vector<Real> & x_secondary)
const
306 return e_from_p_rho_templ(
p,
rho, x_secondary);
309template <
typename CppType>
311IdealGasMixtureFluidProperties::p_from_v_e_templ(
const CppType &
v,
313 const std::vector<CppType> & x_secondary)
const
318 return _R * T_from_v_e(
v, e, x_secondary) / (
M *
v);
322IdealGasMixtureFluidProperties::p_from_v_e(
const ADReal &
v,
324 const std::vector<ADReal> & x_secondary)
const
326 return p_from_v_e_templ(
v, e, x_secondary);
330IdealGasMixtureFluidProperties::p_from_v_e(Real
v,
332 const std::vector<Real> & x_secondary)
const
334 return p_from_v_e_templ(
v, e, x_secondary);
337template <
typename CppType>
339IdealGasMixtureFluidProperties::T_from_v_e_templ(
const CppType & ,
341 const std::vector<CppType> & x_secondary)
const
346 CppType e_ref_sum = 0;
350 e_ref_sum +=
x[i] *
_component_fps[i]->referenceSpecificInternalEnergy();
355 return (e - e_ref_sum) / cv_sum;
359IdealGasMixtureFluidProperties::T_from_v_e(
const ADReal &
v,
361 const std::vector<ADReal> & x_secondary)
const
363 return T_from_v_e_templ(
v, e, x_secondary);
367IdealGasMixtureFluidProperties::T_from_v_e(Real
v,
369 const std::vector<Real> & x_secondary)
const
371 return T_from_v_e_templ(
v, e, x_secondary);
374template <
typename CppType>
376IdealGasMixtureFluidProperties::c_from_p_T_templ(
const CppType & ,
378 const std::vector<CppType> & x_secondary)
const
390IdealGasMixtureFluidProperties::c_from_p_T(
const ADReal &
p,
392 const std::vector<ADReal> & x_secondary)
const
394 return c_from_p_T_templ(
p,
T, x_secondary);
398IdealGasMixtureFluidProperties::c_from_p_T(Real
p,
400 const std::vector<Real> & x_secondary)
const
402 return c_from_p_T_templ(
p,
T, x_secondary);
DualNumber< Real, DNDerivativeType, true > ADReal
const std::vector< double > x
define_mass_specific_prop_from_p_T(v)
registerMooseObject("FluidPropertiesApp", IdealGasMixtureFluidProperties)
static const Real _R
Universal gas constant (J/mol/K)
Ideal gas fluid properties Default parameters are for air at atmospheric pressure and temperature.
Class for fluid properties of an ideal gas mixture.
std::vector< ADReal > secondaryToAllMassFractions(const std::vector< ADReal > &x_secondary) const
std::vector< CppType > molarFractionsFromMassFractions_templ(const std::vector< CppType > &x) const
Computes molar fractions.
CppType mixtureMolarMass_templ(const std::vector< CppType > &x) const
Computes the mixture molar mass.
virtual const SinglePhaseFluidProperties & getPrimaryFluidProperties() const override
Gets the primary component single-phase fluid properties.
ADReal mixtureMolarMass(const std::vector< ADReal > &x) const
ADReal mixtureSpecificHeatRatio(const std::vector< ADReal > &x) const
IdealGasMixtureFluidProperties(const InputParameters ¶meters)
std::vector< CppType > secondaryToAllMassFractions_templ(const std::vector< CppType > &x_secondary) const
Computes all mass fractions.
const unsigned int _n_secondary_components
Number of secondary components.
std::vector< ADReal > molarFractionsFromMassFractions(const std::vector< ADReal > &x) const
const std::vector< UserObjectName > _component_fp_names
Names of component fluid properties.
static InputParameters validParams()
std::vector< const IdealGasFluidProperties * > _component_fps
Component fluid properties objects.
virtual const SinglePhaseFluidProperties & getSecondaryFluidProperties(unsigned int i=0) const override
Gets a secondary component single-phase fluid properties.
const unsigned int _n_components
Number of components.
CppType mixtureSpecificHeatRatio_templ(const std::vector< CppType > &x) const
Computes the mixture specific heat ratio.
void mooseError(Args &&... args) const
Interface class for producing errors, warnings, or just quiet NaNs.
static InputParameters validParams()
Common class for single phase fluid properties.
Base class for fluid properties of vapor mixtures.
static InputParameters validParams()
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)