ReactingMultiphaseCloud.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 #include "DevolatilisationModel.H"
31 #include "SurfaceReactionModel.H"
32 
33 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
34 
35 template<class CloudType>
37 {
38  devolatilisationModel_.reset
39  (
41  (
42  this->subModelProperties(),
43  *this
44  ).ptr()
45  );
46 
47  surfaceReactionModel_.reset
48  (
50  (
51  this->subModelProperties(),
52  *this
53  ).ptr()
54  );
55 }
56 
57 
58 template<class CloudType>
60 (
62 )
63 {
64  CloudType::cloudReset(c);
65 
66  devolatilisationModel_.reset(c.devolatilisationModel_.ptr());
67  surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr());
68 
69  dMassDevolatilisation_ = c.dMassDevolatilisation_;
70  dMassSurfaceReaction_ = c.dMassSurfaceReaction_;
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 
76 template<class CloudType>
78 (
79  const word& cloudName,
80  const volScalarField& rho,
81  const volVectorField& U,
82  const dimensionedVector& g,
83  const SLGThermo& thermo,
84  bool readFields
85 )
86 :
87  CloudType(cloudName, rho, U, g, thermo, false),
89  cloudCopyPtr_(nullptr),
90  constProps_(this->particleProperties()),
91  devolatilisationModel_(nullptr),
92  surfaceReactionModel_(nullptr),
93  dMassDevolatilisation_(0.0),
94  dMassSurfaceReaction_(0.0)
95 {
96  if (this->solution().active())
97  {
98  setModels();
99 
100  if (readFields)
101  {
102  parcelType::readFields(*this, this->composition());
103  this->deleteLostParticles();
104  }
105  }
106 
107  if (this->solution().resetSourcesOnStartup())
108  {
109  resetSourceTerms();
110  }
111 }
112 
113 
114 template<class CloudType>
116 (
118  const word& name
119 )
120 :
121  CloudType(c, name),
123  cloudCopyPtr_(nullptr),
124  constProps_(c.constProps_),
125  devolatilisationModel_(c.devolatilisationModel_->clone()),
126  surfaceReactionModel_(c.surfaceReactionModel_->clone()),
127  dMassDevolatilisation_(c.dMassDevolatilisation_),
128  dMassSurfaceReaction_(c.dMassSurfaceReaction_)
129 {}
130 
131 
132 template<class CloudType>
134 (
135  const fvMesh& mesh,
136  const word& name,
138 )
139 :
140  CloudType(mesh, name, c),
142  cloudCopyPtr_(nullptr),
143  constProps_(),
144  devolatilisationModel_(nullptr),
145  surfaceReactionModel_(nullptr),
146  dMassDevolatilisation_(0.0),
147  dMassSurfaceReaction_(0.0)
148 {}
149 
150 
151 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
152 
153 template<class CloudType>
155 {}
156 
157 
158 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
159 
160 template<class CloudType>
162 (
163  parcelType& parcel,
164  const scalar lagrangianDt
165 )
166 {
167  CloudType::setParcelThermoProperties(parcel, lagrangianDt);
168 
169  label idGas = this->composition().idGas();
170  label idLiquid = this->composition().idLiquid();
171  label idSolid = this->composition().idSolid();
172 
173  parcel.YGas() = this->composition().Y0(idGas);
174  parcel.YLiquid() = this->composition().Y0(idLiquid);
175  parcel.YSolid() = this->composition().Y0(idSolid);
176 }
177 
178 
179 template<class CloudType>
181 (
182  parcelType& parcel,
183  const scalar lagrangianDt,
184  const bool fullyDescribed
185 )
186 {
187  CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
188 
189  if (fullyDescribed)
190  {
191  label idGas = this->composition().idGas();
192  label idLiquid = this->composition().idLiquid();
193  label idSolid = this->composition().idSolid();
194 
195  this->checkSuppliedComposition
196  (
197  parcel.YGas(),
198  this->composition().Y0(idGas),
199  "YGas"
200  );
201  this->checkSuppliedComposition
202  (
203  parcel.YLiquid(),
204  this->composition().Y0(idLiquid),
205  "YLiquid"
206  );
207  this->checkSuppliedComposition
208  (
209  parcel.YSolid(),
210  this->composition().Y0(idSolid),
211  "YSolid"
212  );
213  }
214 }
215 
216 
217 template<class CloudType>
219 {
220  cloudCopyPtr_.reset
221  (
223  (
224  clone(this->name() + "Copy").ptr()
225  )
226  );
227 }
228 
229 
230 template<class CloudType>
232 {
233  cloudReset(cloudCopyPtr_());
234  cloudCopyPtr_.clear();
235 }
236 
237 
238 template<class CloudType>
240 {
241  CloudType::resetSourceTerms();
242 }
243 
244 
245 template<class CloudType>
247 {
248  if (this->solution().canEvolve())
249  {
250  typename parcelType::trackingData td(*this);
251 
252  this->solve(*this, td);
253  }
254 }
255 
256 
257 template<class CloudType>
259 (
260  const mapPolyMesh& mapper
261 )
262 {
264 
265  this->updateMesh();
266 }
267 
268 
269 template<class CloudType>
271 {
272  CloudType::info();
273 
274  this->devolatilisation().info(Info);
275  this->surfaceReaction().info(Info);
276 }
277 
278 
279 template<class CloudType>
281 {
282  if (this->compositionModel_.valid())
283  {
285  }
286 }
287 
288 
289 // ************************************************************************* //
Foam::SurfaceReactionModel
Templated surface reaction model class.
Definition: ReactingMultiphaseCloud.H:61
Foam::ReactingMultiphaseCloud::cloudReset
void cloudReset(ReactingMultiphaseCloud< CloudType > &c)
Reset state of cloud.
Definition: ReactingMultiphaseCloud.C:60
Foam::solution
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:50
Foam::ReactingMultiphaseCloud::restoreState
void restoreState()
Reset the current cloud to the previously stored state.
Definition: ReactingMultiphaseCloud.C:231
cloudName
const word cloudName(propsDict.get< word >("cloud"))
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::SLGThermo
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:64
Foam::ReactingMultiphaseCloud::storeState
void storeState()
Store the current cloud state.
Definition: ReactingMultiphaseCloud.C:218
DevolatilisationModel.H
ReactingMultiphaseCloud.H
Foam::reactingMultiphaseCloud
Virtual abstract base class for templated reactingMultiphaseCloud.
Definition: reactingMultiphaseCloud.H:50
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::ReactingMultiphaseCloud::info
void info()
Print cloud information.
Definition: ReactingMultiphaseCloud.C:270
Foam::ReactingMultiphaseCloud::checkParcelProperties
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
Definition: ReactingMultiphaseCloud.C:181
Foam::Cloud::parcelType
ParticleType parcelType
Parcels are just particles.
Definition: Cloud.H:116
Foam::ReactingMultiphaseCloud::writeFields
virtual void writeFields() const
Write the field data for the cloud.
Definition: ReactingMultiphaseCloud.C:280
rho
rho
Definition: readInitialConditions.H:96
composition
basicSpecieMixture & composition
Definition: createFieldRefs.H:6
solve
CEqn solve()
Foam::ReactingMultiphaseCloud::setModels
void setModels()
Set cloud sub-models.
Definition: ReactingMultiphaseCloud.C:36
Foam::label
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:62
SurfaceReactionModel.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::writeFields
void writeFields(const fvMesh &mesh, const wordHashSet &selectedFields)
Foam::DevolatilisationModel
Templated devolatilisation model class.
Definition: ReactingMultiphaseCloud.H:58
Foam::CloudType
DSMCCloud< dsmcParcel > CloudType
Definition: makeDSMCParcelBinaryCollisionModels.C:38
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned< vector >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:24
Foam::ReactingMultiphaseCloud::~ReactingMultiphaseCloud
virtual ~ReactingMultiphaseCloud()
Destructor.
Definition: ReactingMultiphaseCloud.C:154
Foam::readFields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Definition: ReadFieldsTemplates.C:312
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
U
U
Definition: pEqn.H:72
Foam::ReactingMultiphaseCloud::setParcelThermoProperties
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
Definition: ReactingMultiphaseCloud.C:162
Foam::ReactingMultiphaseCloud::evolve
void evolve()
Evolve the cloud.
Definition: ReactingMultiphaseCloud.C:246
Foam::ReactingMultiphaseCloud::resetSourceTerms
void resetSourceTerms()
Reset the cloud source terms.
Definition: ReactingMultiphaseCloud.C:239
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:54
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::ReactingMultiphaseCloud::autoMap
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
Definition: ReactingMultiphaseCloud.C:259
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::ReactingMultiphaseCloud
Templated base class for multiphase reacting cloud.
Definition: ReactingMultiphaseCloud.H:68