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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class CloudType>
35 (
36  const dictionary& dict,
37  CloudType& owner
38 )
39 :
40  DevolatilisationModel<CloudType>(dict, owner, typeName),
41  volatileData_(this->coeffDict().lookup("volatileData")),
42  YVolatile0_(volatileData_.size()),
43  volatileToGasMap_(volatileData_.size()),
44  residualCoeff_(this->coeffDict().getScalar("residualCoeff"))
45 {
46  if (volatileData_.empty())
47  {
49  << "Devolatilisation model selected, but no volatiles defined"
50  << nl << endl;
51  }
52  else
53  {
54  Info<< "Participating volatile species:" << endl;
55 
56  // Determine mapping between active volatiles and cloud gas components
57  const label idGas = owner.composition().idGas();
58  const scalar YGasTot = owner.composition().YMixture0()[idGas];
59  const scalarField& YGas = owner.composition().Y0(idGas);
60  forAll(volatileData_, i)
61  {
62  const word& specieName = volatileData_[i].name();
63  const label id = owner.composition().localId(idGas, specieName);
64  volatileToGasMap_[i] = id;
65  YVolatile0_[i] = YGasTot*YGas[id];
66 
67  Info<< " " << specieName << ": particle mass fraction = "
68  << YVolatile0_[i] << endl;
69  }
70  }
71 }
72 
73 
74 template<class CloudType>
77 (
79 )
80 :
82  volatileData_(dm.volatileData_),
83  YVolatile0_(dm.YVolatile0_),
84  volatileToGasMap_(dm.volatileToGasMap_),
85  residualCoeff_(dm.residualCoeff_)
86 {}
87 
88 
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 
91 template<class CloudType>
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
99 template<class CloudType>
101 (
102  const scalar dt,
103  const scalar age,
104  const scalar mass0,
105  const scalar mass,
106  const scalar T,
107  const scalarField& YGasEff,
108  const scalarField& YLiquidEff,
109  const scalarField& YSolidEff,
110  label& canCombust,
111  scalarField& dMassDV
112 ) const
113 {
114  bool done = true;
115  forAll(volatileData_, i)
116  {
117  const label id = volatileToGasMap_[i];
118  const scalar massVolatile0 = mass0*YVolatile0_[i];
119  const scalar massVolatile = mass*YGasEff[id];
120 
121  // Combustion allowed once all volatile components evolved
122  done = done && (massVolatile <= residualCoeff_*massVolatile0);
123 
124  // Model coefficients
125  const scalar A1 = volatileData_[i].A1();
126  const scalar E = volatileData_[i].E();
127 
128  // Kinetic rate
129  const scalar kappa = A1*exp(-E/(RR*T));
130 
131  // Mass transferred from particle to carrier gas phase
132  dMassDV[id] = min(dt*kappa*massVolatile, massVolatile);
133  }
134 
135  if (done && canCombust != -1)
136  {
137  canCombust = 1;
138  }
139 }
140 
141 
142 // ************************************************************************* //
Foam::constant::thermodynamic::RR
const scalar RR
Universal gas constant: default in [J/(kmol K)].
Definition: thermodynamicConstants.C:46
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::SingleKineticRateDevolatilisation::~SingleKineticRateDevolatilisation
virtual ~SingleKineticRateDevolatilisation()
Destructor.
Definition: SingleKineticRateDevolatilisation.C:93
SingleKineticRateDevolatilisation.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
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:62
Foam::SingleKineticRateDevolatilisation::SingleKineticRateDevolatilisation
SingleKineticRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: SingleKineticRateDevolatilisation.C:35
Foam::Field< scalar >
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::cellModeller::lookup
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
Definition: cellModeller.H:46
Foam::DevolatilisationModel
Templated devolatilisation model class.
Definition: ReactingMultiphaseCloud.H:58
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
T
const volScalarField & T
Definition: createFieldRefs.H:2
Foam::SingleKineticRateDevolatilisation
Single kinetic rate devolatisation model.
Definition: SingleKineticRateDevolatilisation.H:75
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:101
Foam::nl
constexpr char nl
Definition: Ostream.H:372
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:294