mixtureFraction.C
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) 2013-2020 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 "mixtureFraction.H"
27 #include "singleStepCombustion.H"
29 
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace radiationModels
36 {
37 namespace sootModels
38 {
40 
42  (
43  sootModel,
46  );
47 }
48 }
49 }
50 
51 
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 
55 (
56  const dictionary& dict,
57  const fvMesh& mesh,
58  const word& modelType
59 )
60 :
61  sootModel(dict, mesh, modelType),
62  soot_
63  (
64  IOobject
65  (
66  "soot",
67  mesh_.time().timeName(),
68  mesh_,
71  ),
72  mesh_
73  ),
74  coeffsDict_(dict.subOrEmptyDict(modelType + "Coeffs")),
75  nuSoot_(coeffsDict_.lookup<scalar>("nuSoot")),
76  Wsoot_(coeffsDict_.lookup<scalar>("Wsoot")),
77  sootMax_(-1),
78  mappingFieldName_
79  (
80  coeffsDict_.lookupOrDefault<word>("mappingField", "none")
81  ),
82  mapFieldMax_(1)
83 {
84  const combustionModels::singleStepCombustion& combustion =
86  (
88  );
89 
90  const basicSpecieMixture& mixture = combustion.mixture();
91 
92  const reaction& singleReaction = combustion.singleReaction();
93 
94  scalar totalMol = 0;
95  forAll(singleReaction.rhs(), i)
96  {
97  const scalar stoichCoeff = singleReaction.rhs()[i].stoichCoeff;
98  totalMol += mag(stoichCoeff);
99  }
100 
101  totalMol += nuSoot_;
102 
103  scalarList Xi(singleReaction.rhs().size());
104 
105  scalar Wm = 0;
106  forAll(singleReaction.rhs(), i)
107  {
108  const label speciei = singleReaction.rhs()[i].index;
109  const scalar stoichCoeff = singleReaction.rhs()[i].stoichCoeff;
110  Xi[i] = mag(stoichCoeff)/totalMol;
111  Wm += Xi[i]*mixture.Wi(speciei);
112  }
113 
114  scalarList Yprod0(mixture.species().size(), 0.0);
115 
116  forAll(singleReaction.rhs(), i)
117  {
118  const label speciei = singleReaction.rhs()[i].index;
119  Yprod0[speciei] = mixture.Wi(speciei)/Wm*Xi[i];
120  }
121 
122  const scalar XSoot = nuSoot_/totalMol;
123  Wm += XSoot*Wsoot_;
124 
125  sootMax_ = XSoot*Wsoot_/Wm;
126 
127  Info << "Maximum soot mass concentrations: " << sootMax_ << nl;
128 
129  if (mappingFieldName_ == "none")
130  {
131  const label index = singleReaction.rhs()[0].index;
132  mappingFieldName_ = mixture.Y(index).name();
133  }
134 
135  const label mapFieldIndex = mixture.species()[mappingFieldName_];
136 
137  mapFieldMax_ = Yprod0[mapFieldIndex];
138 }
139 
140 
141 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
142 
144 {}
145 
146 
147 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
148 
150 {
151  const volScalarField& mapField =
152  mesh_.lookupObject<volScalarField>(mappingFieldName_);
153 
154  soot_ = sootMax_*(mapField/mapFieldMax_);
155 }
156 
157 
158 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Specialisation of basicMixture for a mixture consisting of a number for molecular species...
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Macros for easy insertion into run-time selection tables.
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:56
A class for handling words, derived from string.
Definition: word.H:59
addToRunTimeSelectionTable(sootModel, mixtureFraction, dictionary)
mixtureFraction(const dictionary &dict, const fvMesh &mesh, const word &modelType)
Construct from components.
static const char nl
Definition: Ostream.H:260
This soot model is purely an state model. The amount of soot produced is determined by a single step ...
const reaction & singleReaction() const
Return the single step reaction.
virtual void correct()
Main update/correction routine.
defineTypeNameAndDebug(mixtureFraction, 0)
const basicSpecieMixture & mixture() const
Return the mixture.
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
Definition: reactionI.H:42
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Base class for soot models.
Definition: sootModel.H:50
messageStream Info
dimensioned< scalar > mag(const dimensioned< Type > &)
Base class for combustion models using basicSpecieMixture.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
Definition: dictionary.C:1033
Namespace for OpenFOAM.
static const word combustionPropertiesName
Default combustionProperties dictionary name.