ReactingCloudI.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) 2011-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 
26 #include "fvmSup.H"
27 
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
30 template<class CloudType>
33 {
34  return cloudCopyPtr_();
35 }
36 
37 
38 template<class CloudType>
39 inline const typename CloudType::particleType::constantProperties&
41 {
42  return constProps_;
43 }
44 
45 
46 template<class CloudType>
47 inline typename CloudType::particleType::constantProperties&
49 {
50  return constProps_;
51 }
52 
53 
54 template<class CloudType>
57 {
58  return phaseChangeModel_;
59 }
60 
61 
62 template<class CloudType>
65 {
66  return phaseChangeModel_();
67 }
68 
69 
70 template<class CloudType>
73 {
74  return rhoTrans_[i];
75 }
76 
77 
78 template<class CloudType>
79 inline
82 {
83  return rhoTrans_;
84 }
85 
86 
87 template<class CloudType>
90 {
91  return rhoTrans_;
92 }
93 
94 
95 template<class CloudType>
97 (
98  const label i,
99  const volScalarField& Yi
100 ) const
101 {
102  if (this->solution().coupled())
103  {
104  if (this->solution().semiImplicit("Yi"))
105  {
106  tmp<volScalarField> trhoTrans
107  (
109  (
110  this->name() + ":rhoTrans",
111  this->mesh(),
113  )
114  );
115 
116  volScalarField& sourceField = trhoTrans.ref();
117 
118  sourceField.primitiveFieldRef() =
119  rhoTrans_[i]
120  /(this->time().deltaTValue()*this->mesh().V());
121 
122  const dimensionedScalar Yismall(dimless, small);
123 
124  return
125  fvm::Sp(neg(sourceField)*sourceField/(Yi + Yismall), Yi)
126  + pos0(sourceField)*sourceField;
127  }
128  else
129  {
131  fvScalarMatrix& fvm = tfvm.ref();
132 
133  fvm.source() = -rhoTrans_[i]/this->time().deltaTValue();
134 
135  return tfvm;
136  }
137  }
138 
140 }
141 
142 
143 template<class CloudType>
146 {
148  (
150  (
151  this->name() + ":rhoTrans",
152  this->mesh(),
154  (
155  rhoTrans_[0].dimensions()/dimTime/dimVolume,
156  0
157  )
158  )
159  );
160 
161  if (this->solution().coupled())
162  {
163  scalarField& sourceField = trhoTrans.ref();
164  forAll(rhoTrans_, i)
165  {
166  sourceField += rhoTrans_[i];
167  }
168 
169  sourceField /= this->time().deltaTValue()*this->mesh().V();
170  }
171 
172  return trhoTrans;
173 }
174 
175 
176 template<class CloudType>
179 {
180  if (this->solution().coupled())
181  {
182  if (this->solution().semiImplicit("rho"))
183  {
184  tmp<volScalarField> trhoTrans =
186  (
187  this->name() + ":rhoTrans",
188  this->mesh(),
190  );
191 
192  scalarField& sourceField = trhoTrans.ref();
193  forAll(rhoTrans_, i)
194  {
195  sourceField += rhoTrans_[i];
196  }
197  sourceField /= this->time().deltaTValue()*this->mesh().V();
198 
199  return
200  fvm::Sp(neg(trhoTrans())*trhoTrans()/rho, rho)
201  + pos0(trhoTrans())*trhoTrans();
202  }
203  else
204  {
206  fvScalarMatrix& fvm = tfvm.ref();
207 
208  tmp<volScalarField> trhoTransV =
210  (
211  this->name() + ":rhoTransV",
212  this->mesh(),
214  );
215 
216  scalarField& sourceField = trhoTransV.ref();
217  forAll(rhoTrans_, i)
218  {
219  sourceField += rhoTrans_[i];
220  }
221  sourceField /= this->time().deltaTValue();
222 
223  fvm.source() = -trhoTransV();
224 
225  return tfvm;
226  }
227  }
228 
230 }
231 
232 
233 // ************************************************************************* //
#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...
Generic GeometricField class.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
Templated phase change model class.
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
Templated base class for reacting cloud.
Definition: ReactingCloud.H:76
const parcelType::constantProperties & constProps() const
Return the constant properties.
const ReactingCloud & cloudCopy() const
Return a reference to the cloud copy.
tmp< fvScalarMatrix > SYi(const label i, const volScalarField &Yi) const
Return mass source term for specie i - specie eqn.
const PhaseChangeModel< ReactingCloud< CloudType > > & phaseChange() const
Return const access to reacting phase change model.
tmp< volScalarField::Internal > Srho() const
Return tmp total mass source for carrier phase.
const PtrList< volScalarField::Internal > & rhoTrans() const
Return const access to mass source fields.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Field< Type > & source()
Definition: fvMatrix.H:307
const DimensionedField< scalar, fvMesh > & V() const
Return cell volumes.
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:51
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
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the matrix for implicit and explicit sources.
rho
Definition: pEqn.H:1
const dimensionSet dimless
const dimensionSet time
tmp< VolField< Type > > Sp(const volScalarField &sp, const VolField< Type > &vf)
Definition: fvcSup.C:67
dimensionedScalar pos0(const dimensionedScalar &ds)
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
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:42
const dimensionSet & dimVolume
Definition: dimensions.C:150
const dimensionSet & dimTime
Definition: dimensions.C:142
dimensionedScalar neg(const dimensionedScalar &ds)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.