uInhomogeneousbMulticomponent.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 #include "uInhomogeneousMixture.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace ubMixtureMaps
35 {
38  (
41  thermo
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
51 (
52  const uRhoMulticomponentThermo& uThermo,
53  const bRhoMulticomponentThermo& bThermo
54 )
55 :
56  ubMixtureMap(uThermo, bThermo)
57 {
58  const dictionary& bDict = bThermo.properties();
59  const speciesTable& bSpecies = bThermo.species();
60 
61  fu_ = bSpecies[bDict.lookup<word>("fuelSpecie")];
62 
63  const dictionary& oxidantSpecies(bDict.subDict("oxidantSpecies"));
64  ox_.setSize(oxidantSpecies.size());
65 
66  label i = 0;
67  forAllConstIter(dictionary, oxidantSpecies, iter)
68  {
69  const word specieName(iter().keyword());
70  const scalar massFraction(iter().stream()[0].scalarToken());
71 
72  ox_[i++] = {bSpecies[specieName], massFraction};
73  }
74 
75  const dictionary& productSpecies(bDict.subDict("productSpecies"));
76  pr_.setSize(productSpecies.size());
77 
78  i = 0;
79  forAllConstIter(dictionary, productSpecies, iter)
80  {
81  const word specieName(iter().keyword());
82  const scalar massFraction(iter().stream()[0].scalarToken());
83 
84  pr_[i++] = {bSpecies[specieName], massFraction};
85  }
86 }
87 
88 
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 
93 {}
94 
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
101 (
102  const PtrList<volScalarField>& Yu
103 ) const
104 {
105  const PtrList<volScalarField>& Yb = bThermo_.Y();
107 
108  const uInhomogeneousMixture& um = uMixtureCast<uInhomogeneousMixture>();
109 
111  const volScalarField::Internal fub
112  (
113  max
114  (
115  ftb - (scalar(1) - ftb)/um.stoicRatio(),
116  scalar(0)
117  )
118  );
119 
120  Yp.set(fu_, fub);
121 
122  const volScalarField::Internal oxb(1 - ftb - (ftb - fub)*um.stoicRatio());
123 
124  forAll(ox_, i)
125  {
126  Yp.set(ox_[i].first(), ox_[i].second()*oxb);
127  }
128 
129  const volScalarField::Internal prb(1 - fub - oxb);
130 
131  forAll(pr_, i)
132  {
133  Yp.set(pr_[i].first(), pr_[i].second()*prb);
134  }
135 
136  forAll(Yp, i)
137  {
138  if (!Yp.set(i))
139  {
140  Yp.set
141  (
142  i,
144  (
145  Yb[i].name(),
146  ftb.mesh(),
148  )
149  );
150  }
151  }
152 
153  return Yp;
154 }
155 
156 
157 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:492
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
const GeoMesh & mesh() const
Return mesh.
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
bool set(const label) const
Is element set.
Definition: PtrListI.H:62
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
Base-class for combustion fluid thermodynamic properties based on compressibility.
virtual const IOdictionary & properties() const =0
Properties dictionary.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
A wordList with hashed indices for faster lookup by name.
virtual const speciesTable & species() const =0
Return the table of species.
Unburnt gas combustion mixture for inhomogeneous lean, stoichiometric or rich conditions.
scalar stoicRatio() const
Return the stoichiometric air/fuel ratio.
Base-class for combustion fluid thermodynamic properties based on compressibility.
Base class for unburnt/burnt gas composition mapping.
Definition: ubMixtureMap.H:51
uInhomogeneousbMulticomponent(const uRhoMulticomponentThermo &uThermo, const bRhoMulticomponentThermo &bThermo)
Construct from components.
virtual PtrList< volScalarField::Internal > prompt(const PtrList< volScalarField > &Yu) const
Return the burnt gas prompt specie mass fractions.
A class for handling words, derived from string.
Definition: word.H:63
defineTypeNameAndDebug(uHomogeneousbHomogeneous, 0)
addToRunTimeSelectionTable(ubMixtureMap, uHomogeneousbHomogeneous, thermo)
Namespace for OpenFOAM.
const dimensionSet & dimless
Definition: dimensions.C:138
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
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:49
labelList first(const UList< labelPair > &p)
Definition: patchToPatch.C:39
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
fluidMulticomponentThermo & thermo
Definition: createFields.H:15