https://mooseframework.inl.gov
Loading...
Searching...
No Matches
IdealGasMixtureFluidProperties.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
13#include "NaNInterface.h"
14#include "GasTransportUtils.h"
15
17
21#define override_property(want, prop1, prop2) \
22 template <typename CppType> \
23 CppType want##_from_##prop1##_##prop2##_templ( \
24 const CppType & prop1, const CppType & prop2, const std::vector<CppType> & x) const; \
25 virtual Real want##_from_##prop1##_##prop2(Real prop1, Real prop2, const std::vector<Real> & x) \
26 const override; \
27 virtual ADReal want##_from_##prop1##_##prop2( \
28 const ADReal & prop1, const ADReal & prop2, const std::vector<ADReal> & x) const override
29
34{
35public:
37
39
41
42 virtual unsigned int numberOfComponents() const override { return _n_components; }
43
44 virtual const SinglePhaseFluidProperties & getPrimaryFluidProperties() const override;
45 virtual const SinglePhaseFluidProperties &
46 getSecondaryFluidProperties(unsigned int i = 0) const override;
47
53 template <typename CppType>
54 std::vector<CppType>
55 secondaryToAllMassFractions_templ(const std::vector<CppType> & x_secondary) const;
56 std::vector<ADReal> secondaryToAllMassFractions(const std::vector<ADReal> & x_secondary) const;
57 std::vector<Real> secondaryToAllMassFractions(const std::vector<Real> & x_secondary) const;
58
66 template <typename CppType>
67 CppType mixtureSpecificHeatRatio_templ(const CppType & p,
68 const CppType & T,
69 const std::vector<CppType> & x) const;
70 ADReal
71 mixtureSpecificHeatRatio(const ADReal & p, const ADReal & T, const std::vector<ADReal> & x) const;
72 Real mixtureSpecificHeatRatio(Real p, Real T, const std::vector<Real> & x) const;
73
80 ADReal mixtureSpecificHeatRatio(const std::vector<ADReal> & x) const;
81 Real mixtureSpecificHeatRatio(const std::vector<Real> & x) const;
82
88 template <typename CppType>
89 CppType mixtureMolarMass_templ(const std::vector<CppType> & x) const;
90 ADReal mixtureMolarMass(const std::vector<ADReal> & x) const;
91 Real mixtureMolarMass(const std::vector<Real> & x) const;
92
98 template <typename CppType>
99 std::vector<CppType> molarFractionsFromMassFractions_templ(const std::vector<CppType> & x) const;
100 std::vector<ADReal> molarFractionsFromMassFractions(const std::vector<ADReal> & x) const;
101 std::vector<Real> molarFractionsFromMassFractions(const std::vector<Real> & x) const;
102
115
116#undef override_property
117
122 virtual Real
123 binaryDiffusionCoefficient(Real p, Real T, unsigned int i, unsigned int j) const override;
125 const ADReal & T,
126 unsigned int i,
127 unsigned int j) const override;
128
129protected:
131 const std::vector<UserObjectName> _component_fp_names;
133 const unsigned int _n_components;
135 const unsigned int _n_secondary_components;
136
138 std::vector<const SinglePhaseFluidProperties *> _component_fps;
140 std::vector<const GasTransportUtils::LennardJonesParameters *> _lennard_jones;
141
148
151 {
153 WILKE
154 };
159 std::vector<std::vector<Real>> _wilke_molar_mass_factor;
160 std::vector<std::vector<Real>> _wilke_normalization;
162
163private:
174 template <typename CppType>
175 CppType mixTransportProperty(const std::vector<CppType> & psi,
176 const std::vector<CppType> & y,
177 const std::vector<CppType> & mu) const;
178
180 template <typename CppType>
181 CppType binaryDiffusionCoefficient_templ(const CppType & p,
182 const CppType & T,
183 unsigned int i,
184 unsigned int j) const;
185
187 template <typename CppType>
188 CppType constantSpecificHeatRatio(const std::vector<CppType> & x) const;
189};
DualNumber< Real, DNDerivativeType, true > ADReal
const std::vector< double > y
const std::vector< double > x
const double mu
const double rho
const double T
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.
CppType mixtureSpecificHeatRatio_templ(const CppType &p, const CppType &T, const std::vector< CppType > &x) const
Computes the mixture specific heat ratio.
virtual const SinglePhaseFluidProperties & getPrimaryFluidProperties() const override
Gets the primary component single-phase fluid properties.
ADReal mixtureMolarMass(const std::vector< ADReal > &x) const
std::vector< const GasTransportUtils::LennardJonesParameters * > _lennard_jones
Lennard-Jones parameters of the components, or nullptr for components without them.
const TransportMixingRule _transport_mixing_rule
Rule that combines the viscosities and thermal conductivities of the components.
std::vector< CppType > secondaryToAllMassFractions_templ(const std::vector< CppType > &x_secondary) const
Computes all mass fractions.
std::vector< const SinglePhaseFluidProperties * > _component_fps
Component fluid properties objects.
CppType mixTransportProperty(const std::vector< CppType > &psi, const std::vector< CppType > &y, const std::vector< CppType > &mu) const
Combines a transport property of the components with the transport mixing rule.
const unsigned int _n_secondary_components
Number of secondary components.
CppType binaryDiffusionCoefficient_templ(const CppType &p, const CppType &T, unsigned int i, unsigned int j) const
Implements binaryDiffusionCoefficient for Real and AD arguments.
virtual Real binaryDiffusionCoefficient(Real p, Real T, unsigned int i, unsigned int j) const override
Computes the Chapman-Enskog binary diffusion coefficient of a pair of components, which must both hav...
bool _constant_specific_heats
Whether all components have constant specific heats, so that the internal energy is linear in tempera...
std::vector< std::vector< Real > > _wilke_molar_mass_factor
std::vector< std::vector< Real > > _wilke_normalization
TransportMixingRule
Rules that combine the viscosities and thermal conductivities of the components.
virtual unsigned int numberOfComponents() const override
Returns the number of components in the mixture.
Real _T_newton_start
Temperature at which Newton's method starts to compute the temperature from the internal energy when ...
std::vector< ADReal > molarFractionsFromMassFractions(const std::vector< ADReal > &x) const
const std::vector< UserObjectName > _component_fp_names
Names of component fluid properties.
ADReal mixtureSpecificHeatRatio(const ADReal &p, const ADReal &T, const std::vector< ADReal > &x) const
static InputParameters validParams()
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 constantSpecificHeatRatio(const std::vector< CppType > &x) const
Implements the deprecated mixtureSpecificHeatRatio(x)
const InputParameters & parameters() const
Interface class for producing errors, warnings, or just quiet NaNs.
Common class for single phase fluid properties.
Base class for fluid properties of vapor mixtures.