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); \ 82 define_transport_prop_from_p_T(
mu)
83 define_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.");
139 template <
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 173 template <
typename CppType>
198 template <
typename CppType>
204 CppType cp_mix = 0, cv_mix = 0;
212 return cp_mix / cv_mix;
227 template <
typename CppType>
230 const std::vector<CppType> &
x)
const 255 IdealGasMixtureFluidProperties::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);
263 IdealGasMixtureFluidProperties::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);
270 template <
typename CppType>
272 IdealGasMixtureFluidProperties::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;
294 IdealGasMixtureFluidProperties::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);
302 IdealGasMixtureFluidProperties::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);
309 template <
typename CppType>
311 IdealGasMixtureFluidProperties::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);
322 IdealGasMixtureFluidProperties::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);
330 IdealGasMixtureFluidProperties::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);
337 template <
typename CppType>
339 IdealGasMixtureFluidProperties::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;
359 IdealGasMixtureFluidProperties::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);
367 IdealGasMixtureFluidProperties::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);
374 template <
typename CppType>
376 IdealGasMixtureFluidProperties::c_from_p_T_templ(
const CppType & ,
378 const std::vector<CppType> & x_secondary)
const 384 return std::sqrt(gamma *
_R * T / M);
388 IdealGasMixtureFluidProperties::c_from_p_T(
const ADReal & p,
390 const std::vector<ADReal> & x_secondary)
const 392 return c_from_p_T_templ(
p, T, x_secondary);
396 IdealGasMixtureFluidProperties::c_from_p_T(Real p,
398 const std::vector<Real> & x_secondary)
const 400 return c_from_p_T_templ(
p, T, x_secondary);
Base class for fluid properties of vapor mixtures.
std::vector< ADReal > secondaryToAllMassFractions(const std::vector< ADReal > &x_secondary) const
static const std::string cv
const unsigned int _n_secondary_components
Number of secondary components.
static const Real _R
Universal gas constant (J/mol/K)
virtual const SinglePhaseFluidProperties & getSecondaryFluidProperties(unsigned int i=0) const override
Gets a secondary component single-phase fluid properties.
DualNumber< Real, DNDerivativeType, true > ADReal
IdealGasMixtureFluidProperties(const InputParameters ¶meters)
registerMooseObject("FluidPropertiesApp", IdealGasMixtureFluidProperties)
static const std::string cp
const std::vector< double > x
std::vector< ADReal > molarFractionsFromMassFractions(const std::vector< ADReal > &x) const
virtual const SinglePhaseFluidProperties & getPrimaryFluidProperties() const override
Gets the primary component single-phase fluid properties.
static InputParameters validParams()
static const std::string mu
std::vector< CppType > secondaryToAllMassFractions_templ(const std::vector< CppType > &x_secondary) const
Computes all mass fractions.
Common class for single phase fluid properties.
std::vector< const IdealGasFluidProperties * > _component_fps
Component fluid properties objects.
static InputParameters validParams()
const std::vector< UserObjectName > _component_fp_names
Names of component fluid properties.
ADReal mixtureSpecificHeatRatio(const std::vector< ADReal > &x) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
CppType mixtureSpecificHeatRatio_templ(const std::vector< CppType > &x) const
Computes the mixture specific heat ratio.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Class for fluid properties of an ideal gas mixture.
static InputParameters validParams()
ADReal mixtureMolarMass(const std::vector< ADReal > &x) const
define_mass_specific_prop_from_p_T(v)
Ideal gas fluid properties Default parameters are for air at atmospheric pressure and temperature...
const unsigned int _n_components
Number of components.
Interface class for producing errors, warnings, or just quiet NaNs.
CppType mixtureMolarMass_templ(const std::vector< CppType > &x) const
Computes the mixture molar mass.
std::vector< CppType > molarFractionsFromMassFractions_templ(const std::vector< CppType > &x) const
Computes molar fractions.
static const std::string k