MulticomponentLagrangianThermo.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
29 
30 template<class BaseThermo>
31 template<class Method, class ... Args>
35 (
36  const word& psiName,
37  const dimensionSet& psiDim,
38  Method psiMethod,
39  const label speciei,
40  const Args& ... args
41 ) const
42 {
43  const typename BaseThermo::mixtureType::thermoType& thermo =
44  this->specieThermo(speciei);
45 
47  (
49  (
50  IOobject::groupName(psiName, this->group()),
51  this->mesh(),
52  psiDim
53  )
54  );
56 
57  forAll(psi, i)
58  {
59  psi[i] = (thermo.*psiMethod)(args[i] ...);
60  }
61 
62  return tPsi;
63 }
64 
65 
66 template<class BaseThermo>
67 template<class Method, class ... Args>
71 (
72  const LagrangianSubMesh& subMesh,
73  const word& psiName,
74  const dimensionSet& psiDim,
75  Method psiMethod,
76  const label speciei,
77  const Args& ... args
78 ) const
79 {
80  const typename BaseThermo::mixtureType::thermoType& thermo =
81  this->specieThermo(speciei);
82 
84  (
86  (
87  IOobject::groupName(subMesh.sub(psiName), this->group()),
88  subMesh,
89  psiDim
90  )
91  );
93 
94  forAll(psi, subi)
95  {
96  psi[subi] = (thermo.*psiMethod)(args[subi] ...);
97  }
98 
99  return tPsi;
100 }
101 
102 
103 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
104 
105 template<class BaseThermo>
108 {}
109 
110 
111 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
112 
113 template<class BaseThermo>
115 (
116  const label speciei
117 ) const
118 {
119  return
121  (
122  "W",
124  this->specieThermo(speciei).W()
125  );
126 }
127 
128 
129 template<class BaseThermo>
132 (
133  const label speciei,
136 ) const
137 {
138  return LagrangianSubScalarFieldPropertyi
139  (
140  p.mesh(),
141  "rho",
142  dimDensity,
144  speciei,
145  p,
146  T
147  );
148 }
149 
150 
151 template<class BaseThermo>
154 (
155  const label speciei,
158 ) const
159 {
160  return LagrangianSubScalarFieldPropertyi
161  (
162  p.mesh(),
163  "hs",
166  speciei,
167  p,
168  T
169  );
170 }
171 
172 
173 template<class BaseThermo>
175 (
176  const label speciei
177 ) const
178 {
179  return
181  (
182  "hf",
184  this->specieThermo(speciei).hf()
185  );
186 }
187 
188 
189 template<class BaseThermo>
192 (
193  const label speciei,
196 ) const
197 {
198  return LagrangianSubScalarFieldPropertyi
199  (
200  p.mesh(),
201  "Cv",
204  speciei,
205  p,
206  T
207  );
208 }
209 
210 
211 template<class BaseThermo>
214 (
215  const label speciei,
218 ) const
219 {
220  return LagrangianSubScalarFieldPropertyi
221  (
222  p.mesh(),
223  "Cp",
226  speciei,
227  p,
228  T
229  );
230 }
231 
232 
233 // ************************************************************************* //
scalar hs(const scalar p, const scalar T) const
Definition: EtoHthermo.H:11
scalar Cp(const scalar p, const scalar T) const
Definition: EtoHthermo.H:2
scalar Cv(const scalar p, const scalar T) const
Definition: HtoEthermo.H:2
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
word sub(const word &fieldName) const
Return the name of a field corresponding to this sub-mesh.
virtual tmp< LagrangianSubScalarField > Cvi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const
Heat capacity at constant volume [J/kg/K].
virtual dimensionedScalar hfi(const label speciei) const
Enthalpy of formation [J/kg].
virtual tmp< LagrangianSubScalarField > rhoi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const
Density [kg/m^3].
virtual tmp< LagrangianSubScalarField > Cpi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const
Heat capacity at constant pressure [J/kg/K].
tmp< LagrangianSubScalarField > LagrangianSubScalarFieldPropertyi(const LagrangianSubMesh &subMesh, const word &psiName, const dimensionSet &psiDim, Method psiMethod, const label speciei, const Args &... args) const
Return a LagrangianSubScalarField of the given property.
virtual tmp< LagrangianSubScalarField > hsi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const
Sensible enthalpy [J/kg].
virtual dimensionedScalar Wi(const label speciei) const
Molecular weight [kg/kmol].
tmp< LagrangianInternalScalarField > LagrangianInternalScalarFieldPropertyi(const word &psiName, const dimensionSet &psiDim, Method psiMethod, const label speciei, const Args &... args) const
Return a LagrangianInternalScalarField of the given property.
Dimension set for the base types.
Definition: dimensionSet.H:125
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const volScalarField & psi
rho
Definition: pEqn.H:1
const char *const group
Group name for atomic constants.
const dimensionSet & dimMoles
Definition: dimensions.C:144
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dimensionSet & dimMass
Definition: dimensions.C:140
const dimensionSet & dimSpecificHeatCapacity
Definition: dimensions.C:169
const dimensionSet & dimDensity
Definition: dimensions.C:158
const dimensionSet & dimEnergy
Definition: dimensions.C:160
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Foam::argList args(argc, argv)
volScalarField & p
const scalarList W(::W(thermo))
fluidMulticomponentThermo & thermo
Definition: createFields.H:15