Commit 17890e02 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Updated devolatilisation models to operate on a per-specie basis

parent dea66be8
......@@ -287,9 +287,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
T0,
mass0,
this->mass0_,
idG,
YMix[GAS],
YGas_,
YMix[GAS]*YGas_,
canCombust_,
dMassDV,
Sh,
......@@ -494,9 +492,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
const scalar T,
const scalar mass,
const scalar mass0,
const label idVolatile,
const scalar YVolatileTot,
const scalarField& YVolatile,
const scalarField& YGasEff,
bool& canCombust,
scalarField& dMassDV,
scalar& Sh,
......@@ -510,30 +506,29 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
if
(
!td.cloud().devolatilisation().active()
|| T < td.constProps().Tvap()
|| T < td.cloud().constProps().Tvap()
)
{
return;
}
// Total mass of volatiles evolved
const scalar dMassTot = td.cloud().devolatilisation().calculate
td.cloud().devolatilisation().calculate
(
dt,
mass0,
mass,
T,
td.cloud().composition().YMixture0()[idVolatile],
YVolatileTot,
canCombust
YGasEff,
canCombust,
dMassDV
);
// Volatile mass transfer - equal components of each volatile specie
dMassDV = YVolatile*dMassTot;
scalar dMassTot = sum(dMassDV);
td.cloud().addToMassDevolatilisation(this->nParticle_*dMassTot);
Sh -= dMassTot*td.constProps().LDevol()/dt;
Sh -= dMassTot*td.cloud().constProps().LDevol()/dt;
// Molar average molecular weight of carrier mix
const scalar Wc = this->rhoc_*specie::RR*this->Tc_/this->pc_;
......@@ -546,8 +541,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
const scalar beta = sqr(cbrt(15.0) + cbrt(15.0));
const label id =
td.cloud().composition().localToGlobalCarrierId(GAS, i);
const scalar Cp = td.cloud().thermo().carrier().Cp(id, Ts);
const scalar W = td.cloud().thermo().carrier().W(id);
const scalar Cp = td.cloud().mcCarrierThermo().speciesData()[id].Cp(Ts);
const scalar W = td.cloud().mcCarrierThermo().speciesData()[id].W();
const scalar Ni = dMassDV[i]/(this->areaS(d)*dt*W);
// Dab calc'd using API vapour mass diffusivity function
......
......@@ -225,9 +225,7 @@ protected:
const scalar T, // temperature
const scalar mass, // mass
const scalar mass0, // mass (initial on injection)
const label idVolatile, // id of volatile phase
const scalar YVolatileTot, // total volatile mass fraction
const scalarField& YVolatile, // volatile component mass fractions
const scalarField& YGasEff,// Gas component mass fractions
bool& canCombust, // 'can combust' flag
scalarField& dMassDV, // mass transfer - local to particle
scalar& Sh, // explicit particle enthalpy source
......
......@@ -8,10 +8,10 @@
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
......@@ -19,7 +19,8 @@ License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
......@@ -27,7 +28,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class CloudType>
template<class CloudType>
Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
(
const dictionary& dict,
......@@ -35,29 +36,65 @@ Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
)
:
DevolatilisationModel<CloudType>(dict, owner, typeName),
A0_(dimensionedScalar(this->coeffDict().lookup("A0")).value()),
volatileResidualCoeff_
(
readScalar(this->coeffDict().lookup("volatileResidualCoeff"))
)
{}
volatileData_(this->coeffDict().lookup("volatileData")),
YVolatile0_(volatileData_.size()),
volatileToGasMap_(volatileData_.size()),
residualCoeff_(readScalar(this->coeffDict().lookup("residualCoeff")))
{
if (volatileData_.empty())
{
WarningIn
(
"Foam::ConstantRateDevolatilisation<CloudType>::"
"ConstantRateDevolatilisation"
"("
"const dictionary& dict, "
"CloudType& owner"
")"
) << "Devolatilisation model selected, but no volatiles defined"
<< nl << endl;
}
else
{
Info<< "Participating volatile species:" << endl;
// Determine mapping between active volatiles and cloud gas components
const label idGas = owner.composition().idGas();
const scalar YGasTot = owner.composition().YMixture0()[idGas];
const scalarField& YGas = owner.composition().Y0(idGas);
forAll(volatileData_, i)
{
const word& specieName = volatileData_[i].first();
Info<< " " << specieName << endl;
const label id = owner.composition().localId(idGas, specieName);
volatileToGasMap_[i] = id;
YVolatile0_[i] = YGasTot*YGas[id];
Info<< " " << specieName << ": particle mass fraction = "
<< YVolatile0_[i] << endl;
}
}
}
template <class CloudType>
template<class CloudType>
Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
(
const ConstantRateDevolatilisation<CloudType>& dm
)
:
DevolatilisationModel<CloudType>(dm),
A0_(dm.A0_),
volatileResidualCoeff_(dm.volatileResidualCoeff_)
volatileData_(dm.volatileData_),
YVolatile0_(dm.YVolatile0_),
volatileToGasMap_(dm.volatileToGasMap_),
residualCoeff_(dm.residualCoeff_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
template<class CloudType>
Foam::ConstantRateDevolatilisation<CloudType>::~ConstantRateDevolatilisation()
{}
......@@ -65,29 +102,34 @@ Foam::ConstantRateDevolatilisation<CloudType>::~ConstantRateDevolatilisation()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::ConstantRateDevolatilisation<CloudType>::calculate
void Foam::ConstantRateDevolatilisation<CloudType>::calculate
(
const scalar dt,
const scalar mass0,
const scalar mass,
const scalar T,
const scalar YVolatile0,
const scalar YVolatile,
bool& canCombust
const scalarField& YGasEff,
bool& canCombust,
scalarField& dMassDV
) const
{
const scalar massVolatile0 = YVolatile0*mass0;
const scalar massVolatile = YVolatile*mass;
if (massVolatile <= volatileResidualCoeff_*massVolatile0)
forAll(volatileData_, i)
{
canCombust = true;
}
const label id = volatileToGasMap_[i];
const scalar massVolatile0 = mass0*YVolatile0_[id];
const scalar massVolatile = mass*YGasEff[id];
// Combustion allowed once all volatile components evolved
canCombust =
canCombust
&& (massVolatile <= residualCoeff_*massVolatile0);
// Volatile devolatilisation from particle to carrier gas phase
const scalar dMass = min(dt*A0_*massVolatile0, massVolatile);
// Model coefficients
const scalar A0 = volatileData_[i].second();
return dMass;
// Mass transferred from particle to carrier gas phase
dMassDV = min(dt*A0*massVolatile0, massVolatile);
}
}
......
......@@ -52,13 +52,19 @@ class ConstantRateDevolatilisation
// Model constants
//- Rate constant (suggested default = 12) [1/s]
const scalar A0_;
//- List of volatile data - (name A0)
List<Tuple2<word, scalar> > volatileData_;
//- List of initial volatile mass fractions
List<scalar> YVolatile0_;
//- Mapping between local and cloud gaseous species
List<label> volatileToGasMap_;
//- Volatile residual coefficient (0-1)
// When the fraction of volatiles are depleted below this
// threshold, combustion can occur
const scalar volatileResidualCoeff_;
const scalar residualCoeff_;
public:
......@@ -95,15 +101,15 @@ public:
// Member Functions
//- Update model
virtual scalar calculate
virtual void calculate
(
const scalar dt,
const scalar mass0,
const scalar mass,
const scalar T,
const scalar YVolatile0,
const scalar YVolatile,
bool& canCombust
const scalarField& YGasEff,
bool& canCombust,
scalarField& dMassDV
) const;
};
......
......@@ -69,15 +69,15 @@ Foam::DevolatilisationModel<CloudType>::~DevolatilisationModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::DevolatilisationModel<CloudType>::calculate
void Foam::DevolatilisationModel<CloudType>::calculate
(
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
bool&
const scalarField&,
bool&,
scalarField&
) const
{
notImplemented
......@@ -88,13 +88,11 @@ Foam::scalar Foam::DevolatilisationModel<CloudType>::calculate
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalar, "
"const scalarField&, "
"bool&, "
"scalarField&"
") const"
);
return 0.0;
}
......
......@@ -115,15 +115,15 @@ public:
// Member Functions
//- Update model
virtual scalar calculate
virtual void calculate
(
const scalar dt,
const scalar mass0,
const scalar mass,
const scalar T,
const scalar YVolatile0,
const scalar YVolatile,
bool& canCombust
const scalarField& YGasEff,
bool& canCombust,
scalarField& dMassDV
) const;
};
......
......@@ -65,21 +65,19 @@ bool Foam::NoDevolatilisation<CloudType>::active() const
template<class CloudType>
Foam::scalar Foam::NoDevolatilisation<CloudType>::calculate
void Foam::NoDevolatilisation<CloudType>::calculate
(
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
bool& canCombust
const scalarField&,
bool& canCombust,
scalarField&
) const
{
// Model does not stop combustion taking place
canCombust = true;
return 0.0;
}
......
......@@ -82,15 +82,15 @@ public:
virtual bool active() const;
//- Update model
virtual scalar calculate
virtual void calculate
(
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
const scalar,
bool&
const scalar dt,
const scalar mass0,
const scalar mass,
const scalar T,
const scalarField& YGasEff,
bool& canCombust,
scalarField& dMassDV
) const;
};
......
......@@ -8,10 +8,10 @@
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
......@@ -19,7 +19,8 @@ License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
......@@ -27,7 +28,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class CloudType>
template<class CloudType>
Foam::SingleKineticRateDevolatilisation<CloudType>::
SingleKineticRateDevolatilisation
(
......@@ -36,13 +37,44 @@ SingleKineticRateDevolatilisation
)
:
DevolatilisationModel<CloudType>(dict, owner, typeName),
A1_(dimensionedScalar(this->coeffDict().lookup("A1")).value()),
E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
volatileResidualCoeff_
(
readScalar(this->coeffDict().lookup("volatileResidualCoeff"))
)
{}
volatileData_(this->coeffDict().lookup("volatileData")),
YVolatile0_(volatileData_.size()),
volatileToGasMap_(volatileData_.size()),
residualCoeff_(readScalar(this->coeffDict().lookup("residualCoeff")))
{
if (volatileData_.empty())
{
WarningIn
(
"Foam::SingleKineticRateDevolatilisation<CloudType>::"
"SingleKineticRateDevolatilisation"
"("
"const dictionary& dict, "
"CloudType& owner"
")"
) << "Devolatilisation model selected, but no volatiles defined"
<< nl << endl;
}
else
{
Info<< "Participating volatile species:" << endl;
// Determine mapping between active volatiles and cloud gas components
const label idGas = owner.composition().idGas();
const scalar YGasTot = owner.composition().YMixture0()[idGas];
const scalarField& YGas = owner.composition().Y0(idGas);
forAll(volatileData_, i)
{
const word& specieName = volatileData_[i].name();
const label id = owner.composition().localId(idGas, specieName);
volatileToGasMap_[i] = id;
YVolatile0_[i] = YGasTot*YGas[id];
Info<< " " << specieName << ": particle mass fraction = "
<< YVolatile0_[i] << endl;
}
}
}
template<class CloudType>
......@@ -53,15 +85,16 @@ SingleKineticRateDevolatilisation
)
:
DevolatilisationModel<CloudType>(dm),
A1_(dm.A1_),
E_(dm.E_),
volatileResidualCoeff_(dm.volatileResidualCoeff_)
volatileData_(dm.volatileData_),
YVolatile0_(dm.YVolatile0_),
volatileToGasMap_(dm.volatileToGasMap_),
residualCoeff_(dm.residualCoeff_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template <class CloudType>
template<class CloudType>
Foam::SingleKineticRateDevolatilisation<CloudType>::
~SingleKineticRateDevolatilisation()
{}
......@@ -70,32 +103,39 @@ Foam::SingleKineticRateDevolatilisation<CloudType>::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::SingleKineticRateDevolatilisation<CloudType>::calculate
void Foam::SingleKineticRateDevolatilisation<CloudType>::calculate
(
const scalar dt,
const scalar mass0,
const scalar mass,
const scalar T,
const scalar YVolatile0,
const scalar YVolatile,
bool& canCombust
const scalarField& YGasEff,
bool& canCombust,
scalarField& dMassDV
) const
{
const scalar massVolatile0 = YVolatile0*mass;
const scalar massVolatile = YVolatile*mass;
if (massVolatile <= volatileResidualCoeff_*massVolatile0)
bool done = true;
forAll(volatileData_, i)
{
canCombust = true;
}
const label id = volatileToGasMap_[i];
const scalar massVolatile0 = mass0*YVolatile0_[id];
const scalar massVolatile = mass*YGasEff[id];
// Kinetic rate
const scalar kappa = A1_*exp(-E_/(specie::RR*T));
// Combustion allowed once all volatile components evolved
done = done && (massVolatile <= residualCoeff_*massVolatile0);
// Volatile devolatilisation from particle to carrier gas phase
const scalar dMass = min(dt*kappa*massVolatile, massVolatile);
// Model coefficients
const scalar A1 = volatileData_[i].A1();
const scalar E = volatileData_[i].E();
// Kinetic rate
const scalar kappa = A1*exp(-E/(specie::RR*T));
// Mass transferred from particle to carrier gas phase
dMassDV[id] = min(dt*kappa*massVolatile, massVolatile);
}
return dMass;
canCombust