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-2016 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"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class CompType, class SolidThermo>
34 (
35  const fvMesh& mesh,
36  const word& phaseName
37 )
38 :
39  CompType(mesh, phaseName),
40  ODESystem(),
41  Ys_(this->solidThermo().composition().Y()),
42  reactions_
43  (
44  dynamic_cast<const reactingMixture<SolidThermo>& >
45  (
46  this->solidThermo()
47  )
48  ),
49  solidThermo_
50  (
51  dynamic_cast<const reactingMixture<SolidThermo>& >
52  (
53  this->solidThermo()
54  ).speciesData()
55  ),
56  nSolids_(Ys_.size()),
57  nReaction_(reactions_.size()),
58  RRs_(nSolids_),
59  reactingCells_(mesh.nCells(), true)
60 {
61  // create the fields for the chemistry sources
62  forAll(RRs_, fieldi)
63  {
64  RRs_.set
65  (
66  fieldi,
68  (
69  IOobject
70  (
71  "RRs." + Ys_[fieldi].name(),
72  mesh.time().timeName(),
73  mesh,
74  IOobject::NO_READ,
75  IOobject::NO_WRITE
76  ),
77  mesh,
79  )
80  );
81  }
82 }
83 
84 
85 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
86 
87 template<class CompType, class SolidThermo>
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 
95 template<class CompType, class SolidThermo>
97 (
98  const scalarField& deltaT
99 )
100 {
102  return 0;
103 }
104 
105 
106 template<class CompType, class SolidThermo>
109 {
111  return volScalarField::null();
112 }
113 
114 
115 template<class CompType, class SolidThermo>
118 {
120  (
121  new volScalarField
122  (
123  IOobject
124  (
125  "Sh",
126  this->mesh_.time().timeName(),
127  this->mesh_,
128  IOobject::NO_READ,
129  IOobject::AUTO_WRITE,
130  false
131  ),
132  this->mesh_,
134  )
135  );
136 
137  if (this->chemistry_)
138  {
139  scalarField& Sh = tSh.ref();
140 
141  forAll(Ys_, i)
142  {
143  forAll(Sh, celli)
144  {
145  scalar hf = solidThermo_[i].Hc();
146  Sh[celli] -= hf*RRs_[i][celli];
147  }
148  }
149  }
150 
151  return tSh;
152 }
153 
154 
155 template<class CompType, class SolidThermo>
158 {
160  (
161  new volScalarField
162  (
163  IOobject
164  (
165  "dQ",
166  this->mesh_.time().timeName(),
167  this->mesh_,
168  IOobject::NO_READ,
169  IOobject::NO_WRITE,
170  false
171  ),
172  this->mesh_,
174  )
175  );
176 
177  if (this->chemistry_)
178  {
179  volScalarField& dQ = tdQ.ref();
180  dQ.ref() = this->mesh_.V()*Sh()();
181  }
182 
183  return tdQ;
184 }
185 
186 
187 template<class CompType, class SolidThermo>
189 (
190  const label celli,
191  const bool active
192 )
193 {
194  reactingCells_[celli] = active;
195 }
196 
197 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
Foam::reactingMixture.
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
virtual tmp< volScalarField > Sh() const
Return source for enthalpy equation [kg/m/s3].
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
void setCellReacting(const label celli, const bool active)
Set reacting status of cell, celli.
scalar Sh
Definition: solveChemistry.H:2
basicMultiComponentMixture & composition
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:715
Extends base solid chemistry model by adding a thermo package, and ODE functions. Introduces chemistr...
virtual ~solidChemistryModel()
Destructor.
label nCells() const
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
dynamicFvMesh & mesh
dQ
Definition: YEEqn.H:14
virtual tmp< volScalarField > tc() const
Return the chemical time scale.
A class for handling words, derived from string.
Definition: word.H:59
virtual scalar solve(const scalar deltaT)=0
Solve the reaction system for the given time step.
Fundamental solid thermodynamic properties.
Definition: solidThermo.H:54
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
const dimensionSet dimEnergy
Internal & ref()
Return a reference to the dimensioned internal field.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
PtrList< volScalarField > & Y
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
A class for managing temporary objects.
Definition: PtrList.H:54
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
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].