multicomponentThermoI.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) 2023 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 
26 #include "multicomponentThermo.H"
27 
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
31 (
32  const word& specieName
33 ) const
34 {
35  return species().found(specieName);
36 }
37 
38 
40 (
41  const label speciei
42 ) const
43 {
44  const_cast<List<bool>&>(speciesActive())[speciei] = true;
45  const_cast<volScalarField&>(Y()[speciei]).writeOpt() = IOobject::AUTO_WRITE;
46 }
47 
48 
50 (
51  const label speciei
52 ) const
53 {
54  const_cast<List<bool>&>(speciesActive())[speciei] = false;
55  const_cast<volScalarField&>(Y()[speciei]).writeOpt() = IOobject::NO_WRITE;
56 }
57 
58 
59 inline bool Foam::multicomponentThermo::solveSpecie(const label speciei) const
60 {
61  return speciei != defaultSpecie() && speciesActive()[speciei];
62 }
63 
64 
66 {
67  return Y()[speciei];
68 }
69 
70 
72 (
73  const label speciei
74 ) const
75 {
76  return Y()[speciei];
77 }
78 
79 
81 (
82  const word& specieName
83 )
84 {
85  return Y()[species()[specieName]];
86 }
87 
88 
90 (
91  const word& specieName
92 ) const
93 {
94  return Y()[species()[specieName]];
95 }
96 
97 
99 (
100  const volScalarField& Yi
101 ) const
102 {
103  return species()[Yi.member()];
104 }
105 
106 
107 inline Foam::volScalarFieldListSlicer
109 {
110  return volScalarFieldListSlicer(mesh(), Y_);
111 }
112 
113 
114 inline Foam::scalarFieldListSlice
116 (
117  const volScalarFieldListSlicer& Yslicer,
118  const label celli
119 ) const
120 {
121  return Yslicer.slice(celli);
122 }
123 
124 
125 inline Foam::scalarFieldListSlice
127 (
128  const volScalarFieldListSlicer& Yslicer,
129  const label patchi,
130  const label facei
131 ) const
132 {
133  return Yslicer.patchSlice(patchi, facei);
134 }
135 
136 
139 (
140  const fvSource& source
141 ) const
142 {
143  PtrList<scalarField> result(Y_.size());
144 
145  forAll(Y_, i)
146  {
147  result.set
148  (
149  i,
150  Y_[i].sources()[source.name()].sourceValue(source).ptr()
151  );
152  }
153 
154  return result;
155 }
156 
157 
158 inline Foam::scalarFieldListSlice
160 (
161  const PtrList<scalarField>& Yslicer,
162  const label i
163 ) const
164 {
165  return scalarFieldListSlice(Yslicer, i);
166 }
167 
168 
169 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Generic GeometricField class.
static word member(const word &name)
Return member (name without the extension)
Definition: IOobject.C:149
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
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Base class for finite volume sources.
Definition: fvSource.H:52
bool found(const word &) const
Does the list contain the specified name.
scalarFieldListSlice cellComposition(const volScalarFieldListSlicer &Yslicer, const label celli) const
Get the composition of an internal cell.
volScalarFieldListSlicer Yslicer() const
Get the slicer.
scalarFieldListSlice patchFaceComposition(const volScalarFieldListSlicer &Yslicer, const label patchi, const label facei) const
Get the composition of a boundary face.
scalarFieldListSlice sourceCellComposition(const PtrList< scalarField > &Yslicer, const label i) const
Get the composition of a source cell.
virtual const speciesTable & species() const =0
The table of species.
bool solveSpecie(const label speciei) const
Should the given specie be solved for? I.e., is it active and.
virtual PtrList< volScalarField > & Y()=0
Access the mass-fraction fields.
bool containsSpecie(const word &specieName) const
Does the mixture include this specie?
void setSpecieInactive(const label speciei) const
Set specie inactive.
void setSpecieActive(const label speciei) const
Set specie active.
label specieIndex(const volScalarField &Yi) const
Access the specie index of the given mass-fraction field.
A class for handling words, derived from string.
Definition: word.H:62
label patchi
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
PtrList< volScalarField > & Y