20#define propfuncAD(want, prop1, prop2) \
21 virtual ADReal want##_from_##prop1##_##prop2( \
22 const ADReal & p1, const ADReal & p2, const std::vector<ADReal> & x) const \
24 Real p1_raw = p1.value(); \
25 Real p2_raw = p2.value(); \
26 std::vector<Real> x_raw(x.size(), 0); \
27 for (unsigned int i = 0; i < x.size(); ++i) \
28 x_raw[i] = x[i].value(); \
33 std::vector<Real> dy_dx(x.size(), 0); \
34 want##_from_##prop1##_##prop2(p1_raw, p2_raw, x_raw, y_raw, dy_dp1, dy_dp2, dy_dx); \
36 ADReal result = y_raw; \
37 result.derivatives() = p1.derivatives() * dy_dp1 + p2.derivatives() * dy_dp2; \
38 for (unsigned int i = 0; i < x.size(); ++i) \
39 result.derivatives() += x[i].derivatives() * dy_dx[i]; \
43 virtual void want##_from_##prop1##_##prop2(const ADReal & prop1, \
44 const ADReal & prop2, \
45 std::vector<ADReal> & x, \
47 ADReal & d##want##d1, \
48 ADReal & d##want##d2, \
49 std::vector<ADReal> & d##want##dx) const \
51 imperfectJacobianMessage(__PRETTY_FUNCTION__, " derivative derivatives not implemented."); \
52 Real dummy, tmp1, tmp2; \
53 std::vector<Real> x_raw(x.size(), 0); \
54 std::vector<Real> tmp3(x.size(), 0); \
55 for (unsigned int i = 0; i < x.size(); ++i) \
56 x_raw[i] = x[i].value(); \
57 val = want##_from_##prop1##_##prop2(prop1, prop2, x); \
58 want##_from_##prop1##_##prop2(prop1.value(), prop2.value(), x_raw, dummy, tmp1, tmp2, tmp3); \
61 for (unsigned int i = 0; i < x.size(); ++i) \
62 d##want##dx[i] = tmp3[i]; \
69#define propfunc(want, prop1, prop2) \
70 virtual Real want##_from_##prop1##_##prop2(Real, Real, const std::vector<Real> &) const \
72 mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented."); \
75 virtual void want##_from_##prop1##_##prop2(Real prop1, \
77 const std::vector<Real> & x, \
81 std::vector<Real> & d##want##dx) const \
83 imperfectJacobianMessage(__PRETTY_FUNCTION__, " derivatives not implemented."); \
86 std::fill(d##want##dx.begin(), d##want##dx.end(), 0.); \
87 val = want##_from_##prop1##_##prop2(prop1, prop2, x); \
90 propfuncAD(want, prop1, prop2)
123#pragma GCC diagnostic push
124#pragma GCC diagnostic ignored "-Woverloaded-virtual"
151 virtual unsigned int getNumberOfSecondaryVapors()
const
181 const std::vector<Real> & molar_masses)
const;
190 const std::vector<Real> & molar_masses)
const;
193 template <
typename... Args>
203#pragma GCC diagnostic pop
206#define usingVaporMixtureFluidPropertiesMembers \
207 using VaporMixtureFluidProperties::p_from_v_e; \
208 using VaporMixtureFluidProperties::T_from_v_e; \
209 using VaporMixtureFluidProperties::c_from_v_e; \
210 using VaporMixtureFluidProperties::rho_from_p_T; \
211 using VaporMixtureFluidProperties::v_from_p_T; \
212 using VaporMixtureFluidProperties::s_from_p_T; \
213 using VaporMixtureFluidProperties::e_from_p_T; \
214 using VaporMixtureFluidProperties::c_from_p_T; \
215 using VaporMixtureFluidProperties::cp_from_p_T; \
216 using VaporMixtureFluidProperties::cv_from_p_T; \
217 using VaporMixtureFluidProperties::mu_from_p_T; \
218 using VaporMixtureFluidProperties::k_from_p_T; \
219 using VaporMixtureFluidProperties::e_from_p_rho
const std::vector< double > x
const bool _allow_imperfect_jacobians
Flag to set unimplemented Jacobian entries to zero.
const InputParameters & parameters() const
void mooseError(Args &&... args) const
void mooseWarning(Args &&... args) const
Common class for single phase fluid properties.
Base class for fluid properties of vapor mixtures.
Real primaryMassFraction(const std::vector< Real > &x) const
Computes the mass fraction of the primary vapor given mass fractions of the secondary vapors.
propfunc(p, v, e) propfunc(T
std::vector< Real > massFractionsFromMolarFractions(const std::vector< Real > &molar_fractions, const std::vector< Real > &molar_masses) const
Computes the mass fractions for given molar fractions and molar masses.
virtual const SinglePhaseFluidProperties & getSecondaryFluidProperties(unsigned int i=0) const =0
Gets a secondary component single-phase fluid properties.
void imperfectJacobianMessage(Args... args) const
static InputParameters validParams()
virtual ~VaporMixtureFluidProperties()
virtual unsigned int numberOfComponents() const =0
Returns the number of components in the mixture.
Real mixtureMolarMass(const std::vector< Real > &molar_fractions, const std::vector< Real > &molar_masses) const
Computes the mixture molar mass for given molar fractions and molar masses.
virtual const SinglePhaseFluidProperties & getPrimaryFluidProperties() const =0
Gets the primary component single-phase fluid properties.