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 | 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>
34 (
35  const dictionary& dict,
36  CloudType& owner
37 )
38 :
39  DevolatilisationModel<CloudType>(dict, owner, typeName),
40  volatileData_(this->coeffDict().lookup("volatileData")),
41  YVolatile0_(volatileData_.size()),
42  volatileToGasMap_(volatileData_.size()),
43  residualCoeff_(this->coeffDict().getScalar("residualCoeff"))
44 {
45  if (volatileData_.empty())
46  {
48  << "Devolatilisation model selected, but no volatiles defined"
49  << nl << endl;
50  }
51  else
52  {
53  Info<< "Participating volatile species:" << endl;
54 
55  // Determine mapping between active volatiles and cloud gas components
56  const label idGas = owner.composition().idGas();
57  const scalar YGasTot = owner.composition().YMixture0()[idGas];
58  const scalarField& YGas = owner.composition().Y0(idGas);
59  forAll(volatileData_, i)
60  {
61  const word& specieName = volatileData_[i].first();
62  const label id = owner.composition().localId(idGas, specieName);
63  volatileToGasMap_[i] = id;
64  YVolatile0_[i] = YGasTot*YGas[id];
65 
66  Info<< " " << specieName << ": particle mass fraction = "
67  << YVolatile0_[i] << endl;
68  }
69  }
70 }
71 
72 
73 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>
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
95 
96 template<class CloudType>
98 (
99  const scalar dt,
100  const scalar age,
101  const scalar mass0,
102  const scalar mass,
103  const scalar T,
104  const scalarField& YGasEff,
105  const scalarField& YLiquidEff,
106  const scalarField& YSolidEff,
107  label& canCombust,
108  scalarField& dMassDV
109 ) const
110 {
111  bool done = true;
112  forAll(volatileData_, i)
113  {
114  const label id = volatileToGasMap_[i];
115  const scalar massVolatile0 = mass0*YVolatile0_[i];
116  const scalar massVolatile = mass*YGasEff[id];
117 
118  // Combustion allowed once all volatile components evolved
119  done = done && (massVolatile <= residualCoeff_*massVolatile0);
120 
121  // Model coefficients
122  const scalar A0 = volatileData_[i].second();
123 
124  // Mass transferred from particle to carrier gas phase
125  dMassDV[id] = min(dt*A0*massVolatile0, massVolatile);
126  }
127 
128  if (done && canCombust != -1)
129  {
130  canCombust = 1;
131  }
132 }
133 
134 
135 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::ConstantRateDevolatilisation::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: ConstantRateDevolatilisation.C:98
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
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:296
Foam::Field< scalar >
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::DevolatilisationModel
Templated devolatilisation model class.
Definition: ReactingMultiphaseCloud.H:58
Foam::radiation::lookup
Lookup type of boundary radiation properties.
Definition: lookup.H:63
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:123
T
const volScalarField & T
Definition: createFieldRefs.H:2
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::ConstantRateDevolatilisation
Constant rate devolatisation model.
Definition: ConstantRateDevolatilisation.H:51
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:328
ConstantRateDevolatilisation.H
Foam::ConstantRateDevolatilisation::ConstantRateDevolatilisation
ConstantRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: ConstantRateDevolatilisation.C:34
Foam::ConstantRateDevolatilisation::~ConstantRateDevolatilisation
virtual ~ConstantRateDevolatilisation()
Destructor.
Definition: ConstantRateDevolatilisation.C:90