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 
16 
17 template <>
19 
20 #define propfunc(want, prop1, prop2, prop3) \
21  virtual Real want##_from_##prop1##_##prop2##_##prop3(Real, Real, Real) const \
22  { \
23  mooseError(name(), ": ", __PRETTY_FUNCTION__, " not implemented."); \
24  } \
25  \
26  virtual void want##_from_##prop1##_##prop2##_##prop3(Real prop1, \
27  Real prop2, \
28  Real prop3, \
29  Real & val, \
30  Real & d##want##d1, \
31  Real & d##want##d2, \
32  Real & d##want##d3) const \
33  { \
34  if (_allow_imperfect_jacobians) \
35  mooseWarning(name(), ": ", __PRETTY_FUNCTION__, " derivatives not implemented."); \
36  else \
37  mooseError(name(), ": ", __PRETTY_FUNCTION__, " derivatives not implemented."); \
38  \
39  d##want##d1 = 0.0; \
40  d##want##d2 = 0.0; \
41  d##want##d3 = 0.0; \
42  val = want##_from_##prop1##_##prop2##_##prop3(prop1, prop2, prop3); \
43  } \
44  \
45  DualReal want##_from_##prop1##_##prop2##_##prop3( \
46  const DualReal & p1, const DualReal & p2, const DualReal & p3) const \
47  { \
48  const Real raw1 = p1.value(); \
49  const Real raw2 = p2.value(); \
50  const Real raw3 = p3.value(); \
51  Real x = 0.0; \
52  Real dxd1 = 0.0; \
53  Real dxd2 = 0.0; \
54  Real dxd3 = 0.0; \
55  want##_from_##prop1##_##prop2##_##prop3(raw1, raw2, raw3, x, dxd1, dxd2, dxd3); \
56  \
57  DualReal result = x; \
58  result.derivatives() = \
59  p1.derivatives() * dxd1 + p2.derivatives() * dxd2 + p3.derivatives() * dxd3; \
60  \
61  return result; \
62  }
63 
70 {
71 public:
72  MultiComponentFluidProperties(const InputParameters & parameters);
74 
75 #pragma GCC diagnostic push
76 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
77  // clang-format off
78 
121  propfunc(rho, p, T, X)
123  propfunc(mu, p, T, X)
124  propfunc(h, p, T, X)
125  propfunc(cp, p, T, X)
126  propfunc(e, p, T, X)
127  propfunc(k, p, T, X)
129 
130  // clang-format on
131 
132 #undef propfunc
133 #pragma GCC diagnostic pop
134 
139  virtual std::string fluidName() const;
140 
148  virtual void
149  rho_mu_from_p_T_X(Real pressure, Real temperature, Real xmass, Real & rho, Real & mu) const;
150 
151  virtual void rho_mu_from_p_T_X(
152  DualReal pressure, DualReal temperature, DualReal xmass, DualReal & rho, DualReal & mu) const;
153 
169  virtual void rho_mu_from_p_T_X(Real pressure,
170  Real temperature,
171  Real xmass,
172  Real & rho,
173  Real & drho_dp,
174  Real & drho_dT,
175  Real & drho_dx,
176  Real & mu,
177  Real & dmu_dp,
178  Real & dmu_dT,
179  Real & dmu_dx) const;
180 
188  virtual const SinglePhaseFluidProperties & getComponent(unsigned int component) const;
189 };
SinglePhaseFluidProperties
Common class for single phase fluid properties.
Definition: SinglePhaseFluidProperties.h:89
SinglePhaseFluidProperties.h
validParams< MultiComponentFluidProperties >
InputParameters validParams< MultiComponentFluidProperties >()
Definition: MultiComponentFluidProperties.C:14
MultiComponentFluidProperties::fluidName
X X virtual X std::string fluidName() const
Fluid name.
Definition: MultiComponentFluidProperties.C:28
MultiComponentFluidProperties
Common class for multiple component fluid properties using a pressure and temperature formulation.
Definition: MultiComponentFluidProperties.h:69
FluidProperties.h
MultiComponentFluidProperties::MultiComponentFluidProperties
MultiComponentFluidProperties(const InputParameters &parameters)
Definition: MultiComponentFluidProperties.C:20
MultiComponentFluidProperties::T
T
Definition: MultiComponentFluidProperties.h:123
MultiComponentFluidProperties::~MultiComponentFluidProperties
virtual ~MultiComponentFluidProperties()
Definition: MultiComponentFluidProperties.C:25
MultiComponentFluidProperties::p
p
Definition: MultiComponentFluidProperties.h:123
MaterialTensorCalculatorTools::component
Real component(const SymmTensor &symm_tensor, unsigned int index)
Definition: MaterialTensorCalculatorTools.C:16
MultiComponentFluidProperties::getComponent
virtual const SinglePhaseFluidProperties & getComponent(unsigned int component) const
Get UserObject for specified component.
Definition: MultiComponentFluidProperties.C:67
NS::temperature
const std::string temperature
Definition: NS.h:26
MultiComponentFluidProperties::rho_mu_from_p_T_X
virtual void rho_mu_from_p_T_X(Real pressure, Real temperature, Real xmass, Real &rho, Real &mu) const
Density and viscosity.
Definition: MultiComponentFluidProperties.C:34
FluidProperties
Definition: FluidProperties.h:28
MultiComponentFluidProperties::propfunc
propfunc(rho, p, T, X) propfunc(mu
Compute a fluid property given for the state defined by three given properties.
NS::pressure
const std::string pressure
Definition: NS.h:25