Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / lagrangian / intermediate / submodels / ReactingMultiphase / DevolatilisationModel / ConstantRateDevolatilisation / ConstantRateDevolatilisation.C
blob85e0472c792eaec998282fad1effe51f95ec3a74
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ConstantRateDevolatilisation.H"
28 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
30 template<class CloudType>
31 Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
33     const dictionary& dict,
34     CloudType& owner
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")))
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;
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];
71             Info<< "    " << specieName << ": particle mass fraction = "
72                 << YVolatile0_[i] << endl;
73         }
74     }
78 template<class CloudType>
79 Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
81     const ConstantRateDevolatilisation<CloudType>& dm
84     DevolatilisationModel<CloudType>(dm),
85     volatileData_(dm.volatileData_),
86     YVolatile0_(dm.YVolatile0_),
87     volatileToGasMap_(dm.volatileToGasMap_),
88     residualCoeff_(dm.residualCoeff_)
92 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
94 template<class CloudType>
95 Foam::ConstantRateDevolatilisation<CloudType>::~ConstantRateDevolatilisation()
99 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
101 template<class CloudType>
102 void Foam::ConstantRateDevolatilisation<CloudType>::calculate
104     const scalar dt,
105     const scalar mass0,
106     const scalar mass,
107     const scalar T,
108     const scalarField& YGasEff,
109     bool& canCombust,
110     scalarField& dMassDV
111 ) const
113     bool done = true;
114     forAll(volatileData_, i)
115     {
116         const label id = volatileToGasMap_[i];
117         const scalar massVolatile0 = mass0*YVolatile0_[i];
118         const scalar massVolatile = mass*YGasEff[id];
120         // Combustion allowed once all volatile components evolved
121         done = done && (massVolatile <= residualCoeff_*massVolatile0);
123         // Model coefficients
124         const scalar A0 = volatileData_[i].second();
126         // Mass transferred from particle to carrier gas phase
127         dMassDV[id] = min(dt*A0*massVolatile0, massVolatile);
128     }
130     canCombust = done;
134 // ************************************************************************* //