SingleKineticRateDevolatilisation.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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class CloudType>
33 (
34  const dictionary& dict,
35  CloudType& owner
36 )
37 :
38  DevolatilisationModel<CloudType>(dict, owner, typeName),
39  volatileData_(this->coeffDict().lookup("volatileData")),
40  YVolatile0_(volatileData_.size()),
41  volatileToGasMap_(volatileData_.size()),
42  residualCoeff_(readScalar(this->coeffDict().lookup("residualCoeff")))
43 {
44  if (volatileData_.empty())
45  {
47  << "Devolatilisation model selected, but no volatiles defined"
48  << nl << endl;
49  }
50  else
51  {
52  Info<< "Participating volatile species:" << endl;
53 
54  // Determine mapping between active volatiles and cloud gas components
55  const label idGas = owner.composition().idGas();
56  const scalar YGasTot = owner.composition().YMixture0()[idGas];
57  const scalarField& YGas = owner.composition().Y0(idGas);
58  forAll(volatileData_, i)
59  {
60  const word& specieName = volatileData_[i].name();
61  const label id = owner.composition().localId(idGas, specieName);
62  volatileToGasMap_[i] = id;
63  YVolatile0_[i] = YGasTot*YGas[id];
64 
65  Info<< " " << specieName << ": particle mass fraction = "
66  << YVolatile0_[i] << endl;
67  }
68  }
69 }
70 
71 
72 template<class CloudType>
75 (
77 )
78 :
80  volatileData_(dm.volatileData_),
81  YVolatile0_(dm.YVolatile0_),
82  volatileToGasMap_(dm.volatileToGasMap_),
83  residualCoeff_(dm.residualCoeff_)
84 {}
85 
86 
87 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
88 
89 template<class CloudType>
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
97 template<class CloudType>
99 (
100  const scalar dt,
101  const scalar age,
102  const scalar mass0,
103  const scalar mass,
104  const scalar T,
105  const scalarField& YGasEff,
106  const scalarField& YLiquidEff,
107  const scalarField& YSolidEff,
108  label& canCombust,
109  scalarField& dMassDV
110 ) const
111 {
112  bool done = true;
113  forAll(volatileData_, i)
114  {
115  const label id = volatileToGasMap_[i];
116  const scalar massVolatile0 = mass0*YVolatile0_[i];
117  const scalar massVolatile = mass*YGasEff[id];
118 
119  // Combustion allowed once all volatile components evolved
120  done = done && (massVolatile <= residualCoeff_*massVolatile0);
121 
122  // Model coefficients
123  const scalar A1 = volatileData_[i].A1();
124  const scalar E = volatileData_[i].E();
125 
126  // Kinetic rate
127  const scalar kappa = A1*exp(-E/(RR*T));
128 
129  // Mass transferred from particle to carrier gas phase
130  dMassDV[id] = min(dt*kappa*massVolatile, massVolatile);
131  }
132 
133  if (done && canCombust != -1)
134  {
135  canCombust = 1;
136  }
137 }
138 
139 
140 // ************************************************************************* //
Foam::constant::thermodynamic::RR
const scalar RR
Universal gas constant (default in [J/(kmol K)])
Definition: thermodynamicConstants.C:44
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::SingleKineticRateDevolatilisation::~SingleKineticRateDevolatilisation
virtual ~SingleKineticRateDevolatilisation()
Destructor.
Definition: SingleKineticRateDevolatilisation.C:91
SingleKineticRateDevolatilisation.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:252
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
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::SingleKineticRateDevolatilisation::SingleKineticRateDevolatilisation
SingleKineticRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: SingleKineticRateDevolatilisation.C:33
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::SingleKineticRateDevolatilisation::YVolatile0_
List< scalar > YVolatile0_
List of initial volatile mass fractions.
Definition: SingleKineticRateDevolatilisation.H:179
Foam::DevolatilisationModel< CloudType >
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::SingleKineticRateDevolatilisation::volatileToGasMap_
List< label > volatileToGasMap_
Mapping between local and cloud gaseous species.
Definition: SingleKineticRateDevolatilisation.H:182
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::SingleKineticRateDevolatilisation
Single kinetic rate devolatisation model.
Definition: SingleKineticRateDevolatilisation.H:69
Foam::SingleKineticRateDevolatilisation::calculate
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.
Definition: SingleKineticRateDevolatilisation.C:99
readScalar
#define readScalar
Definition: doubleScalar.C:38
T
const volScalarField & T
Definition: createFields.H:25
Foam::SingleKineticRateDevolatilisation::volatileData_
List< volatileData > volatileData_
List of volatile data - (name A1 E)
Definition: SingleKineticRateDevolatilisation.H:176
Foam::SingleKineticRateDevolatilisation::residualCoeff_
const scalar residualCoeff_
Volatile residual coefficient (0-1)
Definition: SingleKineticRateDevolatilisation.H:187
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress