化学反应相关的类,以热学相关的类为基础,它位于路径src/chemistryModel/
。它的类间关系如下:
接下来我们逐个介绍这些类的内容
basicChemistryModel
最基础的类,头文件内容如下:
class basicChemistryModel
:
public IOdictionary
{
protected:
//- Reference to the mesh database
const fvMesh& mesh_;
//- Chemistry activation switch
Switch chemistry_;
//- Initial chemical time step
const scalar deltaTChemIni_;
//- Maximum chemical time step
const scalar deltaTChemMax_;
//- Latest estimation of integration step
volScalarField::Internal deltaTChem_;
构造函数和析构函数
返回类中的成员变量
//- Return const access to chemical source terms
virtual const volScalarField::Internal& R(const label i)=0
//- Return reaction rate of the speciei in reactioni
virtual tmp<volScalarField::Internal> calculateRR(const label reactioni,const label speciei)=0
//Solve the reaction system for the given time step
virtual scalar solve(const scalar deltaT) = 0;
//- Return the heat release rate [kg/m/s^3]
virtual tmp<volScalarField> Qdot() const = 0;
};
最重要的功能是最后几个函数,可以计算化学源项,以及反映速率。还有chemFoam
中使用的solve
函数,以及放热速率。不过这里的几个函数均为纯虚函数,需要后面给出具体的实现
BasicChemistryModel
其头文件内容如下:
template<class ReactionThermo>
class BasicChemistryModel
:
public basicChemistryModel
{
protected:
//- Thermo
ReactionThermo& thermo_;
构造函数和析构函数
返回成员变量thermo_
};
相当于在基础类basicChemistryModel
的基础上,添加了热学相关的类。但是并没有给出前面的纯虚函数的具体定义。
StandardChemistryModel
类的描述如下:
Description
Extends base chemistry model by adding a thermo package, and ODE functions.
Introduces chemistry equation system and evaluation of chemical source
terms.
在基础类上添加热学包,和ode函数。引入化学方程和化学源项的实现
头文件内容如下:
template<class ReactionThermo, class ThermoType>
class StandardChemistryModel
:
public BasicChemistryModel<ReactionThermo>,
public ODESystem
{ 成员变量,含有各种组分的信息,以及反应速率
//- Reference to the field of specie mass fractions
PtrList<volScalarField>& Y_;
//- Reactions
const PtrList<Reaction<ThermoType>>& reactions_;
//- Thermodynamic data of the species
const PtrList<ThermoType>& specieThermo_;
//- Number of species
label nSpecie_;
//- Number of reactions
label nReaction_;
//- Temperature below which the reaction rates are assumed 0
scalar Treact_;
//- List of reaction rate per specie [kg/m^3/s]
PtrList<volScalarField::Internal> RR_;
//- Temporary concentration field
mutable scalarField c_;
//- Temporary rate-of-change of concentration field
mutable scalarField dcdt_;
构造函数和析构函数
各类功能性的成员函数
};
这里我们比较关注的是solve
函数具体实现,这里把它贴出来:
template<class ReactionThermo, class ThermoType>
template<class DeltaTType>
Foam::scalar Foam::StandardChemistryModel<ReactionThermo, ThermoType>::solve
(
const DeltaTType& deltaT
)
{
BasicChemistryModel<ReactionThermo>::correct();
scalar deltaTMin = great;
if (!this->chemistry_)
{
return deltaTMin;
}
tmp<volScalarField> trho(this->thermo().rho());
const scalarField& rho = trho(); //得到密度域
const scalarField& T = this->thermo().T(); //得到速度和压力域
const scalarField& p = this->thermo().p();
scalarField c0(nSpecie_); //得到各个组分的浓度
forAll(rho, celli) //对每个单元遍历
{
scalar Ti = T[celli];
if (Ti > Treact_) //超出燃点后才会发生反应
{
const scalar rhoi = rho[celli]; //取出域中的单个密度和压力
scalar pi = p[celli];
for (label i=0; i<nSpecie_; i++) //对每个组分计算浓度
{
c_[i] = rhoi*Y_[i][celli]/specieThermo_[i].W();
c0[i] = c_[i];
}
// Initialise time progress
scalar timeLeft = deltaT[celli];
// Calculate the chemical source terms 计算化学源项,调用另外一个solve
while (timeLeft > small)
{
scalar dt = timeLeft;
this->solve(c_, Ti, pi, dt, this->deltaTChem_[celli]);
timeLeft -= dt;
}
deltaTMin = min(this->deltaTChem_[celli], deltaTMin);
this->deltaTChem_[celli] =
min(this->deltaTChem_[celli], this->deltaTChemMax_);
for (label i=0; i<nSpecie_; i++) //计算反应速率
{
RR_[i][celli] =
(c_[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
}
}
else //如果温度未到,反应速率就为零
{
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = 0;
}
}
}
return deltaTMin;
}
TDACChemistryModel
首先看描述
Description
Extends StandardChemistryModel by adding the TDAC method.
References:
\\verbatim
Contino, F., Jeanmart, H., Lucchini, T., & D’Errico, G. (2011).
Coupling of in situ adaptive tabulation and dynamic adaptive chemistry:
An effective method for solving combustion in engine simulations.
Proceedings of the Combustion Institute, 33(2), 3057-3064.
Contino, F., Lucchini, T., D'Errico, G., Duynslaegher, C.,
Dias, V., & Jeanmart, H. (2012).
Simulations of advanced combustion modes using detailed chemistry
combined with tabulation and mechanism reduction techniques.
SAE International Journal of Engines,
5(2012-01-0145), 185-196.
Contino, F., Foucher, F., Dagaut, P., Lucchini, T., D’Errico, G., &
Mounaïm-Rousselle, C. (2013).
Experimental and numerical analysis of nitric oxide effect on the
ignition of iso-octane in a single cylinder HCCI engine.
Combustion and Flame, 160(8), 1476-1483.
Contino, F., Masurier, J. B., Foucher, F., Lucchini, T., D’Errico, G., &
Dagaut, P. (2014).
CFD simulations using the TDAC method to model iso-octane combustion
for a large range of ozone seeding and temperature conditions
in a single cylinder HCCI engine.
Fuel, 137, 179-184.
\\endverbatim
类继承自StandardChemistryModel
,这里使用了一个新的方法TDAC
并给出了若干参考文献。这里也给出了solve
一个实现,这里不再继续展开
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容