solidChemistryModel.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 | Copyright (C) 2011-2015 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 "solidChemistryModel.H"
27 #include "reactingMixture.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class CompType, class SolidThermo>
35 (
36  const fvMesh& mesh,
37  const word& phaseName
38 )
39 :
40  CompType(mesh, phaseName),
41  ODESystem(),
42  Ys_(this->solidThermo().composition().Y()),
43  reactions_
44  (
45  dynamic_cast<const reactingMixture<SolidThermo>& >
46  (
47  this->solidThermo()
48  )
49  ),
50  solidThermo_
51  (
52  dynamic_cast<const reactingMixture<SolidThermo>& >
53  (
54  this->solidThermo()
55  ).speciesData()
56  ),
57  nSolids_(Ys_.size()),
58  nReaction_(reactions_.size()),
59  RRs_(nSolids_),
60  reactingCells_(mesh.nCells(), true)
61 {
62  // create the fields for the chemistry sources
63  forAll(RRs_, fieldI)
64  {
65  RRs_.set
66  (
67  fieldI,
69  (
70  IOobject
71  (
72  "RRs." + Ys_[fieldI].name(),
73  mesh.time().timeName(),
74  mesh,
75  IOobject::NO_READ,
76  IOobject::NO_WRITE
77  ),
78  mesh,
80  )
81  );
82  }
83 }
84 
85 
86 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
87 
88 template<class CompType, class SolidThermo>
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
96 template<class CompType, class SolidThermo>
98 (
99  const scalarField& deltaT
100 )
101 {
103  (
104  "solidChemistryModel::solve(const scalarField& deltaT)"
105  );
106  return 0;
107 }
108 
109 
110 template<class CompType, class SolidThermo>
113 {
115  (
116  "solidChemistryModel::tc()"
117  );
118  return volScalarField::null();
119 }
120 
121 
122 template<class CompType, class SolidThermo>
125 {
127  (
128  new volScalarField
129  (
130  IOobject
131  (
132  "Sh",
133  this->mesh_.time().timeName(),
134  this->mesh_,
135  IOobject::NO_READ,
136  IOobject::AUTO_WRITE,
137  false
138  ),
139  this->mesh_,
141  zeroGradientFvPatchScalarField::typeName
142  )
143  );
144 
145  if (this->chemistry_)
146  {
147  scalarField& Sh = tSh();
148 
149  forAll(Ys_, i)
150  {
151  forAll(Sh, cellI)
152  {
153  scalar hf = solidThermo_[i].Hc();
154  Sh[cellI] -= hf*RRs_[i][cellI];
155  }
156  }
157  }
158 
159  return tSh;
160 }
161 
162 
163 template<class CompType, class SolidThermo>
166 {
168  (
169  new volScalarField
170  (
171  IOobject
172  (
173  "dQ",
174  this->mesh_.time().timeName(),
175  this->mesh_,
176  IOobject::NO_READ,
177  IOobject::NO_WRITE,
178  false
179  ),
180  this->mesh_,
181  dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
182  zeroGradientFvPatchScalarField::typeName
183  )
184  );
185 
186  if (this->chemistry_)
187  {
188  volScalarField& dQ = tdQ();
189  dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
190  }
191 
192  return tdQ;
193 }
194 
195 
196 template<class CompType, class SolidThermo>
198 (
199  const label cellI,
200  const bool active
201 )
202 {
203  reactingCells_[cellI] = active;
204 }
205 
206 // ************************************************************************* //
Extends base solid chemistry model by adding a thermo package, and ODE functions. Introduces chemistr...
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
scalar Sh
Definition: solveChemistry.H:2
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
A class for handling words, derived from string.
Definition: word.H:59
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
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
label nCells() const
DimensionedInternalField & dimensionedInternalField()
Return dimensioned internal field.
const dimensionSet dimEnergy
virtual tmp< volScalarField > Sh() const
Return source for enthalpy equation [kg/m/s3].
dynamicFvMesh & mesh
virtual tmp< volScalarField > tc() const
Return the chemical time scale.
virtual scalar solve(const scalar deltaT)=0
Solve the reaction system for the given time step.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
virtual tmp< volScalarField > dQ() const
Return the heat release, i.e. enthalpy/sec [m2/s3].
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
basicMultiComponentMixture & composition
Definition: createFields.H:35
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::reactingMixture.
void setCellReacting(const label cellI, const bool active)
Set reacting status of cell, cellI.
PtrList< volScalarField > & Y
Definition: createFields.H:36
#define forAll(list, i)
Definition: UList.H:421
Fundamental solid thermodynamic properties.
Definition: solidThermo.H:54
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
dQ
Definition: YEEqn.H:14
virtual ~solidChemistryModel()
Destructor.
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118