multicomponentLagrangianThermo.H
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 Class
25  Foam::multicomponentLagrangianThermo
26 
27 Description
28  Base-class for multicomponent Lagrangian thermodynamic models
29 
30 SourceFiles
31  multicomponentLagrangianThermoI.H
32  multicomponentLagrangianThermo.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef multicomponentLagrangianThermo_H
37 #define multicomponentLagrangianThermo_H
38 
39 #include "basicLagrangianThermo.H"
41 #include "speciesTable.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class multicomponentLagrangianThermo Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  virtual public basicLagrangianThermo
56 {
57 public:
58 
59  //- Runtime type information
60  TypeName("multicomponentLagrangianThermo");
61 
62 
63  //- Declare run-time constructor selection table
65  (
66  autoPtr,
69  (const LagrangianMesh& mesh, const word& phaseName),
70  (mesh, phaseName)
71  );
72 
73 
74  // Public Classes
75 
76  //- Forward declare the implementation class
77  class implementation;
78 
79 
80  // Selectors
81 
82  //- Select a multicomponent thermo
84  (
85  const LagrangianMesh& mesh,
87  );
88 
89 
90  //- Destructor
92 
93 
94  // Member Functions
95 
96  // Species set
97 
98  //- Return the table of species
99  virtual const speciesTable& species() const = 0;
100 
101  //- Does the mixture include this specie?
102  inline bool containsSpecie(const word& specieName) const;
103 
104  //- The index of the default specie
105  virtual label defaultSpecie() const = 0;
106 
107 
108  // Mass fractions
109 
110  //- Access the mass-fraction fields
112 
113  //- Access the mass-fraction fields
114  virtual const PtrList<LagrangianScalarDynamicField>& Y() const = 0;
115 
116  //- Access the mass-fraction field for a specie given by index
117  inline LagrangianScalarDynamicField& Y(const label);
118 
119  //- Access the mass-fraction field for a specie given by index
120  inline const LagrangianScalarDynamicField& Y(const label) const;
121 
122  //- Access the mass-fraction field for a specie given by name
123  inline LagrangianScalarDynamicField& Y(const word&);
124 
125  //- Access the mass-fraction field for a specie given by name
126  inline const LagrangianScalarDynamicField& Y(const word&) const;
127 
128  //- Access the specie index of the given mass-fraction field
129  inline label specieIndex(const LagrangianScalarDynamicField&) const;
130 
131  //- Normalise the mass fractions within the given sub-mesh by
132  // clipping positive and deriving the default specie mass fraction
133  // from the other species
134  virtual void normaliseY(const LagrangianSubMesh&) = 0;
135 
136 
137  // Specie molecular properties
138 
139  //- Molecular weight [kg/kmol]
140  virtual dimensionedScalar Wi(const label speciei) const = 0;
141 
142 
143  // Specie thermodynamic properties
144 
145  //- Density [kg/m^3]
147  (
148  const label speciei,
151  ) const = 0;
152 
153  //- Sensible enthalpy [J/kg]
155  (
156  const label speciei,
159  ) const = 0;
160 
161  //- Enthalpy of formation [J/kg]
162  virtual dimensionedScalar hfi(const label speciei) const = 0;
163 
164  //- Heat capacity at constant volume [J/kg/K]
166  (
167  const label speciei,
170  ) const = 0;
171 
172  //- Heat capacity at constant pressure [J/kg/K]
174  (
175  const label speciei,
178  ) const = 0;
179 };
180 
181 
182 /*---------------------------------------------------------------------------*\
183  Class multicomponentLagrangianThermo::implementation Declaration
184 \*---------------------------------------------------------------------------*/
185 
187 :
188  virtual public multicomponentLagrangianThermo
189 {
190 protected:
191 
192  // Protected data
193 
194  //- The name of the default specie. The mass fraction of which is
195  // derived from the other species rather than solved. Also used as the
196  // carrier specie in multicomponent diffusion.
198 
199  //- The index of the default specie
201 
202  //- Species mass fractions
204 
205 
206 public:
207 
208  // Constructors
209 
210  //- Construct from dictionary, mesh and phase name
212  (
213  const dictionary&,
214  const speciesTable&,
215  const LagrangianMesh&,
216  const word&
217  );
218 
219 
220  //- Destructor
221  virtual ~implementation();
222 
223 
224  // Member Functions
225 
226  // Species set
227 
228  //- The index of the default specie
229  virtual label defaultSpecie() const;
230 
231 
232  // Mass fractions
233 
234  //- Access the mass-fraction fields
236 
237  //- Access the mass-fraction fields
238  virtual const PtrList<LagrangianScalarDynamicField>& Y() const;
239 
240  //- Normalise the mass fractions within the given sub-mesh by
241  // clipping positive and deriving the default specie mass fraction
242  // from the other species
243  virtual void normaliseY(const LagrangianSubMesh&);
244 
245 
246  // Composition
247 
248  //- Get the slicer
250 
251  //- Get the composition of an element
252  inline scalarFieldListSlice elementComposition
253  (
255  const label i
256  ) const;
257 
258  //- Get the slicer for an injection
259  inline
261  (
262  const LagrangianInjection&,
263  const LagrangianSubMesh&
264  ) const;
265 
266  //- Get the composition of an element in an injection
267  inline scalarFieldListSlice injectionElementComposition
268  (
270  const label subi
271  ) const;
272 };
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 } // End namespace Foam
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 #endif
286 
287 // ************************************************************************* //
Class to provide list slices to different parts of a dimensioned field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Class containing Lagrangian geometry and topology.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base-class for Lagrangian fluid and solid thermodynamic models.
virtual const LagrangianScalarDynamicField & T() const =0
Temperature [K].
virtual const LagrangianMesh & mesh() const =0
Access the mesh.
virtual const word & phaseName() const =0
Access the phase name.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A wordList with hashed indices for faster lookup by name.
DimensionedFieldListSlicer< scalar > Yslicer() const
Get the slicer.
scalarFieldListSlice elementComposition(const DimensionedFieldListSlicer< scalar > &Yslicer, const label i) const
Get the composition of an element.
virtual label defaultSpecie() const
The index of the default specie.
virtual PtrList< LagrangianScalarDynamicField > & Y()
Access the mass-fraction fields.
virtual void normaliseY(const LagrangianSubMesh &)
Normalise the mass fractions within the given sub-mesh by.
PtrList< LagrangianScalarDynamicField > Y_
Species mass fractions.
word defaultSpecieName_
The name of the default specie. The mass fraction of which is.
scalarFieldListSlice injectionElementComposition(const DimensionedFieldListAndSlicer< scalar, LagrangianSubMesh > &, const label subi) const
Get the composition of an element in an injection.
implementation(const dictionary &, const speciesTable &, const LagrangianMesh &, const word &)
Construct from dictionary, mesh and phase name.
Base-class for multicomponent Lagrangian thermodynamic models.
virtual tmp< LagrangianSubScalarField > rhoi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const =0
Density [kg/m^3].
TypeName("multicomponentLagrangianThermo")
Runtime type information.
virtual const speciesTable & species() const =0
Return the table of species.
virtual dimensionedScalar hfi(const label speciei) const =0
Enthalpy of formation [J/kg].
virtual PtrList< LagrangianScalarDynamicField > & Y()=0
Access the mass-fraction fields.
declareRunTimeSelectionTable(autoPtr, multicomponentLagrangianThermo, LagrangianMesh,(const LagrangianMesh &mesh, const word &phaseName),(mesh, phaseName))
Declare run-time constructor selection table.
static autoPtr< multicomponentLagrangianThermo > New(const LagrangianMesh &mesh, const word &phaseName=word::null)
Select a multicomponent thermo.
virtual tmp< LagrangianSubScalarField > Cpi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const =0
Heat capacity at constant pressure [J/kg/K].
virtual tmp< LagrangianSubScalarField > Cvi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const =0
Heat capacity at constant volume [J/kg/K].
bool containsSpecie(const word &specieName) const
Does the mixture include this specie?
label specieIndex(const LagrangianScalarDynamicField &) const
Access the specie index of the given mass-fraction field.
virtual dimensionedScalar Wi(const label speciei) const =0
Molecular weight [kg/kmol].
virtual label defaultSpecie() const =0
The index of the default specie.
virtual tmp< LagrangianSubScalarField > hsi(const label speciei, const LagrangianSubScalarField &p, const LagrangianSubScalarField &T) const =0
Sensible enthalpy [J/kg].
virtual void normaliseY(const LagrangianSubMesh &)=0
Normalise the mass fractions within the given sub-mesh by.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:78
Namespace for OpenFOAM.
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
volScalarField & p