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  return 0;
104 }
105 
106 
107 template<class CompType, class SolidThermo>
110 {
112  return volScalarField::null();
113 }
114 
115 
116 template<class CompType, class SolidThermo>
119 {
121  (
122  new volScalarField
123  (
124  IOobject
125  (
126  "Sh",
127  this->mesh_.time().timeName(),
128  this->mesh_,
129  IOobject::NO_READ,
130  IOobject::AUTO_WRITE,
131  false
132  ),
133  this->mesh_,
135  zeroGradientFvPatchScalarField::typeName
136  )
137  );
138 
139  if (this->chemistry_)
140  {
141  scalarField& Sh = tSh();
142 
143  forAll(Ys_, i)
144  {
145  forAll(Sh, cellI)
146  {
147  scalar hf = solidThermo_[i].Hc();
148  Sh[cellI] -= hf*RRs_[i][cellI];
149  }
150  }
151  }
152 
153  return tSh;
154 }
155 
156 
157 template<class CompType, class SolidThermo>
160 {
162  (
163  new volScalarField
164  (
165  IOobject
166  (
167  "dQ",
168  this->mesh_.time().timeName(),
169  this->mesh_,
170  IOobject::NO_READ,
171  IOobject::NO_WRITE,
172  false
173  ),
174  this->mesh_,
175  dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
176  zeroGradientFvPatchScalarField::typeName
177  )
178  );
179 
180  if (this->chemistry_)
181  {
182  volScalarField& dQ = tdQ();
183  dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
184  }
185 
186  return tdQ;
187 }
188 
189 
190 template<class CompType, class SolidThermo>
192 (
193  const label cellI,
194  const bool active
195 )
196 {
197  reactingCells_[cellI] = active;
198 }
199 
200 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
reactingMixture.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Sh
scalar Sh
Definition: solveChemistry.H:2
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::dimEnergy
const dimensionSet dimEnergy
Foam::reactingMixture
Foam::reactingMixture.
Definition: reactingMixture.H:51
dQ
dQ
Definition: YEEqn.H:14
Foam::solidChemistryModel::~solidChemistryModel
virtual ~solidChemistryModel()
Destructor.
Definition: solidChemistryModel.C:90
Foam::solidChemistryModel::Sh
virtual tmp< volScalarField > Sh() const
Return source for enthalpy equation [kg/m/s3].
Definition: solidChemistryModel.C:118
Foam::solidThermo
Fundamental solid thermodynamic properties.
Definition: solidThermo.H:54
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::solidChemistryModel::dQ
virtual tmp< volScalarField > dQ() const
Return the heat release, i.e. enthalpy/sec [m2/s3].
Definition: solidChemistryModel.C:159
solidChemistryModel.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
Foam::solidChemistryModel::setCellReacting
void setCellReacting(const label cellI, const bool active)
Set reacting status of cell, cellI.
Definition: solidChemistryModel.C:192
Foam::solidChemistryModel::tc
virtual tmp< volScalarField > tc() const
Return the chemical time scale.
Definition: solidChemistryModel.C:109
Foam::ODESystem
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
composition
basicMultiComponentMixture & composition
Definition: createFields.H:35
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
zeroGradientFvPatchFields.H
Foam::solidChemistryModel::solidChemistryModel
solidChemistryModel(const solidChemistryModel &)
Disallow copy constructor.
Foam::solidChemistryModel::solve
virtual scalar solve(const scalar deltaT)=0
Solve the reaction system for the given time step.
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Y
PtrList< volScalarField > & Y
Definition: createFields.H:36
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51