www.mooseframework.org
MultiComponentFluidProperties.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "FluidProperties.h"
14 
15 #define propfunc(want, prop1, prop2, prop3) \
16  virtual Real want##_from_##prop1##_##prop2##_##prop3(Real, Real, Real) const \
17  { \
18  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented."); \
19  } \
20  \
21  virtual void want##_from_##prop1##_##prop2##_##prop3(Real prop1, \
22  Real prop2, \
23  Real prop3, \
24  Real & val, \
25  Real & d##want##d1, \
26  Real & d##want##d2, \
27  Real & d##want##d3) const \
28  { \
29  if (_allow_imperfect_jacobians) \
30  mooseWarning(name(), ": ", __PRETTY_FUNCTION__, " derivatives not implemented."); \
31  else \
32  mooseError(name(), ": ", __PRETTY_FUNCTION__, " derivatives not implemented."); \
33  \
34  d##want##d1 = 0.0; \
35  d##want##d2 = 0.0; \
36  d##want##d3 = 0.0; \
37  val = want##_from_##prop1##_##prop2##_##prop3(prop1, prop2, prop3); \
38  } \
39  \
40  DualReal want##_from_##prop1##_##prop2##_##prop3( \
41  const DualReal & p1, const DualReal & p2, const DualReal & p3) const \
42  { \
43  const Real raw1 = p1.value(); \
44  const Real raw2 = p2.value(); \
45  const Real raw3 = p3.value(); \
46  Real x = 0.0; \
47  Real dxd1 = 0.0; \
48  Real dxd2 = 0.0; \
49  Real dxd3 = 0.0; \
50  want##_from_##prop1##_##prop2##_##prop3(raw1, raw2, raw3, x, dxd1, dxd2, dxd3); \
51  \
52  DualReal result = x; \
53  result.derivatives() = \
54  p1.derivatives() * dxd1 + p2.derivatives() * dxd2 + p3.derivatives() * dxd3; \
55  \
56  return result; \
57  }
58 
65 {
66 public:
68 
71 
72 #pragma GCC diagnostic push
73 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
74  // clang-format off
75 
118  propfunc(rho, p, T, X)
120  propfunc(mu, p, T, X)
121  propfunc(h, p, T, X)
122  propfunc(cp, p, T, X)
123  propfunc(e, p, T, X)
124  propfunc(k, p, T, X)
126 
127  // clang-format on
128 
129 #undef propfunc
130 #pragma GCC diagnostic pop
131 
136  virtual std::string fluidName() const;
137 
145  virtual void
146  rho_mu_from_p_T_X(Real pressure, Real temperature, Real xmass, Real & rho, Real & mu) const;
147 
148  virtual void rho_mu_from_p_T_X(
150 
166  virtual void rho_mu_from_p_T_X(Real pressure,
167  Real temperature,
168  Real xmass,
169  Real & rho,
170  Real & drho_dp,
171  Real & drho_dT,
172  Real & drho_dx,
173  Real & mu,
174  Real & dmu_dp,
175  Real & dmu_dT,
176  Real & dmu_dx) const;
177 
185  virtual const SinglePhaseFluidProperties & getComponent(unsigned int component) const;
186 };
propfunc(rho, p, T, X) propfunc(mu
Compute a fluid property given for the state defined by three given properties.
static const std::string component
Definition: NS.h:138
DualNumber< Real, DNDerivativeType, true > DualReal
static const std::string temperature
Definition: NS.h:57
X X virtual X std::string fluidName() const
Fluid name.
static const std::string cp
Definition: NS.h:120
MultiComponentFluidProperties(const InputParameters &parameters)
static const std::string mu
Definition: NS.h:122
Common class for single phase fluid properties.
Common class for multiple component fluid properties using a pressure and temperature formulation...
virtual const SinglePhaseFluidProperties & getComponent(unsigned int component) const
Get UserObject for specified component.
static const std::string pressure
Definition: NS.h:56
virtual void rho_mu_from_p_T_X(Real pressure, Real temperature, Real xmass, Real &rho, Real &mu) const
Density and viscosity.
const InputParameters & parameters() const
static const std::string k
Definition: NS.h:124