ENH: TDACChemistryModel: Added support for multiphase

Patch contributed by Timo Niemi, VTT.
Resolves patch request https://bugs.openfoam.org/view.php?id=2753

STYLE: TDACChemistryModel: Removed unnecessary warning messages

Patch contributed by Francesco Contino
This commit is contained in:
Henry Weller
2017-11-09 16:58:17 +00:00
committed by Andrew Heather
parent f30e0ab808
commit 5bfd575a44
10 changed files with 42 additions and 55 deletions

View File

@ -54,7 +54,7 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
(
IOobject
(
"TabulationResults",
IOobject::groupName("TabulationResults", phaseName),
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
@ -75,7 +75,7 @@ Foam::TDACChemistryModel<CompType, ThermoType>::TDACChemistryModel
forAll(specieComp_, i)
{
specieComp_[i] = specComp[this->Y()[i].name()];
specieComp_[i] = specComp[this->Y()[i].member()];
}
mechRed_ = chemistryReductionMethod<CompType, ThermoType>::New

View File

@ -45,8 +45,14 @@ template<class CompType, class ThermoType>
inline Foam::autoPtr<Foam::OFstream>
Foam::TDACChemistryModel<CompType, ThermoType>::logFile(const word& name) const
{
mkDir(this->mesh().time().path()/"TDAC");
return autoPtr<OFstream>::New(this->mesh().time().path()/"TDAC"/name);
mkDir(this->mesh().time().path()/"TDAC"/this->group());
return autoPtr<OFstream>
(
new OFstream
(
this->mesh().time().path()/"TDAC"/this->group()/name
)
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,7 +89,7 @@ Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::DAC
for (label i = 0; i < chemistry.nSpecie(); i++)
{
if (initSet.found(chemistry.Y()[i].name()))
if (initSet.found(chemistry.Y()[i].member()))
{
searchInitSet_[j++] = i;
}
@ -140,23 +140,23 @@ Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::DAC
<< endl;
}
}
if (this->chemistry_.Y()[i].name() == CO2Name_)
if (this->chemistry_.Y()[i].member() == CO2Name_)
{
CO2Id_ = i;
}
else if (this->chemistry_.Y()[i].name() == COName_)
else if (this->chemistry_.Y()[i].member() == COName_)
{
COId_ = i;
}
else if (this->chemistry_.Y()[i].name() == HO2Name_)
else if (this->chemistry_.Y()[i].member() == HO2Name_)
{
HO2Id_ = i;
}
else if (this->chemistry_.Y()[i].name() == H2OName_)
else if (this->chemistry_.Y()[i].member() == H2OName_)
{
H2OId_ = i;
}
else if (this->chemistry_.Y()[i].name() == NOName_)
else if (this->chemistry_.Y()[i].member() == NOName_)
{
NOId_ = i;
}
@ -206,7 +206,7 @@ Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::DAC
fuelSpeciesProp_[i] = readScalar(fuelDict.lookup(fuelSpecies_[i]));
for (label j=0; j<this->nSpecie_; j++)
{
if (this->chemistry_.Y()[j].name() == fuelSpecies_[i])
if (this->chemistry_.Y()[j].member() == fuelSpecies_[i])
{
fuelSpeciesID_[i] = j;
break;
@ -472,8 +472,8 @@ void Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::reduceMechanism
// Complete combustion products are not considered
if
(
this->chemistry_.Y()[i].name() == "CO2"
|| this->chemistry_.Y()[i].name() == "H2O"
this->chemistry_.Y()[i].member() == "CO2"
|| this->chemistry_.Y()[i].member() == "H2O"
)
{
continue;
@ -482,7 +482,7 @@ void Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::reduceMechanism
Na[0] += sC_[i]*c[i];
Na[1] += sH_[i]*c[i];
Na[2] += sO_[i]*c[i];
if (sC_[i]>nbCLarge_ || this->chemistry_.Y()[i].name() == "O2")
if (sC_[i]>nbCLarge_ || this->chemistry_.Y()[i].member() == "O2")
{
Nal[0] += sC_[i]*c[i];
Nal[1] += sH_[i]*c[i];
@ -619,21 +619,15 @@ void Foam::chemistryReductionMethods::DAC<CompType, ThermoType>::reduceMechanism
{
label u = Q.pop();
scalar Den = max(PA[u], CA[u]);
if (Den != 0.0)
if (Den != 0)
{
for (label v=0; v<NbrABInit[u]; ++v)
{
label otherSpec = rABOtherSpec(u, v);
scalar rAB = mag(rABNum(u, v))/Den;
if (rAB > 1)
{
Info<< "Badly Conditioned rAB : " << rAB
<< " for species : "
<< this->chemistry_.Y()[u].name() << ","
<< this->chemistry_.Y()[otherSpec].name()
<< endl;
rAB = 1.0;
rAB = 1;
}
// The direct link is weaker than the user-defined tolerance

View File

@ -41,7 +41,7 @@ Foam::chemistryReductionMethods::DRG<CompType, ThermoType>::DRG
dictionary initSet = this->coeffsDict_.subDict("initialSet");
for (label i=0; i<chemistry.nSpecie(); i++)
{
if (initSet.found(chemistry.Y()[i].name()))
if (initSet.found(chemistry.Y()[i].member()))
{
searchInitSet_[j++] = i;
}
@ -255,12 +255,7 @@ void Foam::chemistryReductionMethods::DRG<CompType, ThermoType>::reduceMechanism
if (rAB > 1)
{
Info<< "Badly Conditioned rAB : " << rAB
<< " for species : "
<< this->chemistry_.Y()[u].name() << ","
<< this->chemistry_.Y()[otherSpec].name()
<< endl;
rAB = 1.0;
rAB = 1;
}
// Include B only if rAB is above the tolerance and if the

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,7 +47,7 @@ Foam::chemistryReductionMethods::DRGEP<CompType, ThermoType>::DRGEP
dictionary initSet = this->coeffsDict_.subDict("initialSet");
for (label i=0; i<chemistry.nSpecie(); ++i)
{
if (initSet.found(chemistry.Y()[i].name()))
if (initSet.found(chemistry.Y()[i].member()))
{
searchInitSet_[j++] = i;
}
@ -443,15 +443,9 @@ reduceMechanism
{
label otherSpec = rABOtherSpec(u, v);
scalar rAB = mag(rABNum(u, v))/Den;
if (rAB > 1)
{
Info<< "Badly Conditioned rAB : " << rAB
<< " for species : "
<< this->chemistry_.Y()[u].name() << ","
<< this->chemistry_.Y()[otherSpec].name()
<< endl;
rAB = 1.0;
rAB = 1;
}
scalar Rtemp = Rvalue[u]*rAB;
@ -653,12 +647,7 @@ reduceMechanism
scalar rAB = mag(rABNum(u, v))/Den;
if (rAB > 1)
{
Info<< "Badly Conditioned rAB : " << rAB
<< " for species : "
<< this->chemistry_.Y()[u].name() << ","
<< this->chemistry_.Y()[otherSpec].name()
<< endl;
rAB = 1.0;
rAB = 1;
}
scalar Rtemp = Rvalue[u]*rAB;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,7 +43,7 @@ Foam::chemistryReductionMethods::PFA<CompType, ThermoType>::PFA
for (label i=0; i<chemistry.nSpecie(); i++)
{
if (initSet.found(chemistry.Y()[i].name()))
if (initSet.found(chemistry.Y()[i].member()))
{
searchInitSet_[j++] = i;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Foam::chemistryReductionMethod<CompType, ThermoType>::New
(
IOobject
(
"thermophysicalProperties",
IOobject::groupName("thermophysicalProperties",dict.group()),
dict.db().time().constant(),
dict.db(),
IOobject::MUST_READ_IF_MODIFIED,

View File

@ -84,14 +84,17 @@ Foam::chemistryTabulationMethods::ISAT<CompType, ThermoType>::ISAT
scalar otherScaleFactor = readScalar(scaleDict.lookup("otherSpecies"));
for (label i=0; i<Ysize; ++i)
{
const word& yName = this->chemistry_.Y()[i].name();
if (!scaleDict.found(yName))
if (!scaleDict.found(this->chemistry_.Y()[i].member()))
{
scaleFactor_[i] = otherScaleFactor;
}
else
{
scaleFactor_[i] = readScalar(scaleDict.lookup(yName));
scaleFactor_[i] =
readScalar
(
scaleDict.lookup(this->chemistry_.Y()[i].member())
);
}
}
scaleFactor_[Ysize] = readScalar(scaleDict.lookup("Temperature"));

View File

@ -512,7 +512,7 @@ bool Foam::chemPointISAT<CompType, ThermoType>::inEOA(const scalarField& phiq)
}
else
{
propName = chemistry_.Y()[maxIndex].name();
propName = chemistry_.Y()[maxIndex].member();
}
Info<< "Direction maximum impact to error in ellipsoid: "

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ Foam::chemistryTabulationMethod<CompType, ThermoType>::New
(
IOobject
(
"thermophysicalProperties",
IOobject::groupName("thermophysicalProperties",dict.group()),
dict.db().time().constant(),
dict.db(),
IOobject::MUST_READ_IF_MODIFIED,