ConstantRateDevolatilisation.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-2013 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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class CloudType>
32 (
33  const dictionary& dict,
34  CloudType& owner
35 )
36 :
37  DevolatilisationModel<CloudType>(dict, owner, typeName),
38  volatileData_(this->coeffDict().lookup("volatileData")),
39  YVolatile0_(volatileData_.size()),
40  volatileToGasMap_(volatileData_.size()),
41  residualCoeff_(readScalar(this->coeffDict().lookup("residualCoeff")))
42 {
43  if (volatileData_.empty())
44  {
45  WarningIn
46  (
47  "Foam::ConstantRateDevolatilisation<CloudType>::"
48  "ConstantRateDevolatilisation"
49  "("
50  "const dictionary& dict, "
51  "CloudType& owner"
52  ")"
53  ) << "Devolatilisation model selected, but no volatiles defined"
54  << nl << endl;
55  }
56  else
57  {
58  Info<< "Participating volatile species:" << endl;
59 
60  // Determine mapping between active volatiles and cloud gas components
61  const label idGas = owner.composition().idGas();
62  const scalar YGasTot = owner.composition().YMixture0()[idGas];
63  const scalarField& YGas = owner.composition().Y0(idGas);
64  forAll(volatileData_, i)
65  {
66  const word& specieName = volatileData_[i].first();
67  const label id = owner.composition().localId(idGas, specieName);
68  volatileToGasMap_[i] = id;
69  YVolatile0_[i] = YGasTot*YGas[id];
70 
71  Info<< " " << specieName << ": particle mass fraction = "
72  << YVolatile0_[i] << endl;
73  }
74  }
75 }
76 
77 
78 template<class CloudType>
80 (
82 )
83 :
85  volatileData_(dm.volatileData_),
86  YVolatile0_(dm.YVolatile0_),
87  volatileToGasMap_(dm.volatileToGasMap_),
88  residualCoeff_(dm.residualCoeff_)
89 {}
90 
91 
92 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 
94 template<class CloudType>
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
101 template<class CloudType>
103 (
104  const scalar dt,
105  const scalar age,
106  const scalar mass0,
107  const scalar mass,
108  const scalar T,
109  const scalarField& YGasEff,
110  const scalarField& YLiquidEff,
111  const scalarField& YSolidEff,
112  label& canCombust,
113  scalarField& dMassDV
114 ) const
115 {
116  bool done = true;
117  forAll(volatileData_, i)
118  {
119  const label id = volatileToGasMap_[i];
120  const scalar massVolatile0 = mass0*YVolatile0_[i];
121  const scalar massVolatile = mass*YGasEff[id];
122 
123  // Combustion allowed once all volatile components evolved
124  done = done && (massVolatile <= residualCoeff_*massVolatile0);
125 
126  // Model coefficients
127  const scalar A0 = volatileData_[i].second();
128 
129  // Mass transferred from particle to carrier gas phase
130  dMassDV[id] = min(dt*A0*massVolatile0, massVolatile);
131  }
132 
133  if (done && canCombust != -1)
134  {
135  canCombust = 1;
136  }
137 }
138 
139 
140 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
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
Constant rate devolatisation model.
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Templated devolatilisation model class.
dictionary dict
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
stressControl lookup("compactNormalStress") >> compactNormalStress
#define WarningIn(functionName)
Report a warning using Foam::Warning.
#define forAll(list, i)
Definition: UList.H:421
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
virtual void calculate(const scalar dt, const scalar age, const scalar mass0, const scalar mass, const scalar T, const scalarField &YGasEff, const scalarField &YLiquidEff, const scalarField &YSolidEff, label &canCombust, scalarField &dMassDV) const
Update model.
ConstantRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)