From 1431ca218f98c8f9551f21c9ac079901b86810c8 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 15 Jun 2012 14:51:32 +0100 Subject: [PATCH 01/10] STYLE: minor code formatting --- .../psiCombustionModel/psiCombustionModel.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModel.C b/src/combustionModels/psiCombustionModel/psiCombustionModel.C index 906934ab70..aaa6a7442f 100644 --- a/src/combustionModels/psiCombustionModel/psiCombustionModel.C +++ b/src/combustionModels/psiCombustionModel/psiCombustionModel.C @@ -38,7 +38,6 @@ namespace combustionModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - Foam::combustionModels::psiCombustionModel::psiCombustionModel ( const word& modelType, @@ -49,13 +48,14 @@ Foam::combustionModels::psiCombustionModel::psiCombustionModel thermo_(psiReactionThermo::New(mesh)) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::combustionModels::psiCombustionModel::~psiCombustionModel() {} -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // bool Foam::combustionModels::psiCombustionModel::read() { @@ -69,10 +69,12 @@ bool Foam::combustionModels::psiCombustionModel::read() } } + Foam::tmp Foam::combustionModels::psiCombustionModel::rho() const { return thermo_->rho(); } + // ************************************************************************* // From bf1012a798d391eeccea5d76baf791f69df649b3 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 15 Jun 2012 14:51:59 +0100 Subject: [PATCH 02/10] ENH: PaSR model improvements --- src/combustionModels/PaSR/PaSR.C | 19 ++++--------------- src/combustionModels/PaSR/PaSR.H | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C index 16720de35b..e6b1123d8f 100644 --- a/src/combustionModels/PaSR/PaSR.C +++ b/src/combustionModels/PaSR/PaSR.C @@ -25,7 +25,6 @@ License #include "PaSR.H" #include "fvmSup.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -36,18 +35,17 @@ Foam::combustionModels::PaSR::PaSR ) : CombThermoType(modelType, mesh), - Cmix_(this->coeffs().lookup("Cmix")), + Cmix_(readScalar(this->coeffs().lookup("Cmix"))), turbulentReaction_(this->coeffs().lookup("turbulentReaction")), kappa_ ( IOobject ( - "kappa", + "PaSR::kappa", mesh.time().timeName(), mesh, IOobject::NO_READ, - IOobject::AUTO_WRITE, - false + IOobject::AUTO_WRITE ), mesh, dimensionedScalar("kappa", dimless, 0.0) @@ -70,7 +68,6 @@ Foam::combustionModels::PaSR::~PaSR() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - template Foam::tmp Foam::combustionModels::PaSR::tc() const @@ -108,20 +105,12 @@ void Foam::combustionModels::PaSR::correct() tmp ttc(tc()); const volScalarField& tc = ttc(); - const dimensionedScalar e0 - ( - "e0", - sqr(dimLength)/pow3(dimTime), - SMALL - ); - forAll(epsilon, i) { if (epsilon[i] > 0) { scalar tk = - Cmix_.value() - *Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + e0.value())); + Cmix_*Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + SMALL)); // Chalmers PaSR model if (!useReactionRate_) diff --git a/src/combustionModels/PaSR/PaSR.H b/src/combustionModels/PaSR/PaSR.H index 125c9182c6..b351d8c705 100644 --- a/src/combustionModels/PaSR/PaSR.H +++ b/src/combustionModels/PaSR/PaSR.H @@ -55,7 +55,7 @@ class PaSR // Private data //- Mixing constant - dimensionedScalar Cmix_; + scalar Cmix_; //- Turbulent reaction switch Switch turbulentReaction_; From 57f76609d725eaa22272c8ef101adb4d0a95451a Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 15 Jun 2012 15:20:00 +0100 Subject: [PATCH 03/10] STYLE: minor code formatting --- .../infinitelyFastChemistrys.C | 3 +-- .../psiChemistryCombustionModel.C | 9 +++++---- .../singleStepCombustion/singleStepCombustion.C | 12 +++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C index 0dc939fd2b..2d56c58845 100644 --- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistrys.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,6 @@ namespace Foam { namespace combustionModels { - makeCombustionTypesThermo ( infinitelyFastChemistry, diff --git a/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C index e78febd054..8bd136d4bc 100644 --- a/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C +++ b/src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,6 @@ namespace combustionModels defineRunTimeSelectionTable(psiChemistryCombustionModel, dictionary); - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // psiChemistryCombustionModel::psiChemistryCombustionModel @@ -48,13 +47,14 @@ psiChemistryCombustionModel::psiChemistryCombustionModel pChemistry_(psiChemistryModel::New(mesh)) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // psiChemistryCombustionModel::~psiChemistryCombustionModel() {} -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // bool psiChemistryCombustionModel::read() { @@ -68,9 +68,10 @@ bool psiChemistryCombustionModel::read() } } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam } // End namespace combustionModels +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.C b/src/combustionModels/singleStepCombustion/singleStepCombustion.C index 319e5476b2..080a3b6b05 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.C +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,10 +33,10 @@ namespace combustionModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -singleStepCombustion -::singleStepCombustion +singleStepCombustion::singleStepCombustion ( - const word& modelType, const fvMesh& mesh + const word& modelType, + const fvMesh& mesh ) : CombThermoType(modelType, mesh), @@ -63,14 +63,12 @@ singleStepCombustion // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // template -singleStepCombustion -::~singleStepCombustion() +singleStepCombustion::~singleStepCombustion() {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - template Foam::tmp singleStepCombustion::R From 9075f54d69ac6110b95177a4aa244609c5be2f97 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 18 Jun 2012 10:58:48 +0100 Subject: [PATCH 04/10] BUG: Corrected output of yPlusRAS/LES for parallel running - mantis #556 --- .../postProcessing/wall/yPlusLES/yPlusLES.C | 12 ++++++------ .../postProcessing/wall/yPlusRAS/yPlusRAS.C | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C index 0bc6773518..d02da85df5 100644 --- a/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C +++ b/applications/utilities/postProcessing/wall/yPlusLES/yPlusLES.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,9 +41,9 @@ int main(int argc, char *argv[]) { timeSelector::addOptions(); #include "setRootCase.H" -# include "createTime.H" + #include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); -# include "createMesh.H" + #include "createMesh.H" forAll(timeDirs, timeI) { @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) mesh ); -# include "createPhi.H" + #include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); @@ -124,8 +124,8 @@ int main(int argc, char *argv[]) Info<< "Patch " << patchi << " named " << currPatch.name() - << " y+ : min: " << min(Yp) << " max: " << max(Yp) - << " average: " << average(Yp) << nl << endl; + << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) + << " average: " << gAverage(Yp) << nl << endl; } } diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C index c8de884de9..7af0a901af 100644 --- a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C +++ b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C @@ -86,8 +86,8 @@ void calcIncompressibleYPlus Info<< "Patch " << patchi << " named " << nutPw.patch().name() - << " y+ : min: " << min(Yp) << " max: " << max(Yp) - << " average: " << average(Yp) << nl << endl; + << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) + << " average: " << gAverage(Yp) << nl << endl; } } @@ -166,8 +166,8 @@ void calcCompressibleYPlus Info<< "Patch " << patchi << " named " << mutPw.patch().name() - << " y+ : min: " << min(Yp) << " max: " << max(Yp) - << " average: " << average(Yp) << nl << endl; + << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp) + << " average: " << gAverage(Yp) << nl << endl; } } From ca0b964bb25a5b38144a030a2ec4ea44df471c29 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 19 Jun 2012 12:44:59 +0100 Subject: [PATCH 05/10] ENH: Re-worked combustion models so that thermo/chemistry variants can operate within the same structure --- src/combustionModels/FSD/FSD.C | 71 +++++------- src/combustionModels/FSD/FSDs.C | 31 ++++- src/combustionModels/Make/files | 12 +- src/combustionModels/PaSR/PaSR.C | 49 ++++---- src/combustionModels/PaSR/PaSR.H | 13 +-- src/combustionModels/PaSR/PaSRs.C | 21 +--- .../combustionModel/makeCombustionTypes.H | 31 +++-- .../infinitelyFastChemistry.C | 19 +-- .../infinitelyFastChemistry.H | 12 +- .../infinitelyFastChemistrys.C | 28 +++-- .../noCombustion/noCombustions.C | 5 + .../psiChemistryCombustion.C} | 56 ++++----- .../psiChemistryCombustion.H} | 94 ++++----------- .../psiChemistryCombustionModelNew.C | 78 ------------- .../psiCombustionModel/psiCombustionModel.C | 10 +- .../psiCombustionModel/psiCombustionModel.H | 36 ++---- .../psiCombustionModel/psiCombustionModelI.H | 42 ------- .../psiThermoCombustion.C} | 51 ++++----- .../psiThermoCombustion/psiThermoCombustion.H | 108 ++++++++++++++++++ .../rhoChemistryCombustion.C} | 58 +++++----- .../rhoChemistryCombustion.H} | 94 ++++----------- .../rhoChemistryCombustionModelNew.C | 78 ------------- .../rhoCombustionModel/rhoCombustionModel.C | 13 +-- .../rhoCombustionModel/rhoCombustionModel.H | 32 ++---- .../rhoCombustionModel/rhoCombustionModelI.H | 42 ------- .../rhoThermoCombustion.C} | 58 +++++----- .../rhoThermoCombustion/rhoThermoCombustion.H | 108 ++++++++++++++++++ .../singleStepCombustion.C | 44 +++++-- .../singleStepCombustion.H | 39 +++---- 29 files changed, 590 insertions(+), 743 deletions(-) rename src/combustionModels/{rhoChemistryCombustionModel/rhoChemistryCombustionModel.C => psiChemistryCombustion/psiChemistryCombustion.C} (60%) rename src/combustionModels/{psiChemistryCombustionModel/psiChemistryCombustionModel.H => psiChemistryCombustion/psiChemistryCombustion.H} (51%) delete mode 100644 src/combustionModels/psiChemistryCombustionModel/psiChemistryCombustionModelNew.C delete mode 100644 src/combustionModels/psiCombustionModel/psiCombustionModelI.H rename src/combustionModels/{psiChemistryCombustionModel/psiChemistryCombustionModel.C => psiThermoCombustion/psiThermoCombustion.C} (59%) create mode 100644 src/combustionModels/psiThermoCombustion/psiThermoCombustion.H rename src/combustionModels/{rhoChemistryCombustionModel/rhoChemistryCombustionModelI.H => rhoChemistryCombustion/rhoChemistryCombustion.C} (54%) rename src/combustionModels/{rhoChemistryCombustionModel/rhoChemistryCombustionModel.H => rhoChemistryCombustion/rhoChemistryCombustion.H} (51%) delete mode 100644 src/combustionModels/rhoChemistryCombustionModel/rhoChemistryCombustionModelNew.C delete mode 100644 src/combustionModels/rhoCombustionModel/rhoCombustionModelI.H rename src/combustionModels/{psiChemistryCombustionModel/psiChemistryCombustionModelI.H => rhoThermoCombustion/rhoThermoCombustion.C} (56%) create mode 100644 src/combustionModels/rhoThermoCombustion/rhoThermoCombustion.H diff --git a/src/combustionModels/FSD/FSD.C b/src/combustionModels/FSD/FSD.C index c7b646d8bb..26f58505a7 100644 --- a/src/combustionModels/FSD/FSD.C +++ b/src/combustionModels/FSD/FSD.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,8 @@ namespace combustionModels template FSD::FSD ( - const word& modelType, const fvMesh& mesh + const word& modelType, + const fvMesh& mesh ) : singleStepCombustion(modelType, mesh), @@ -62,14 +63,8 @@ FSD::FSD this->mesh(), dimensionedScalar("zero", dimless, 0.0) ), - YFuelFuelStream_ - ( - dimensionedScalar("YFuelStream", dimless, 1.0) - ), - YO2OxiStream_ - ( - dimensionedScalar("YOxiStream", dimless, 0.23) - ), + YFuelFuelStream_(dimensionedScalar("YFuelStream", dimless, 1.0)), + YO2OxiStream_(dimensionedScalar("YOxiStream", dimless, 0.23)), Cv_(readScalar(this->coeffs().lookup("Cv"))), C_(5.0), ftMin_(0.0), @@ -91,15 +86,15 @@ FSD::~FSD() template void FSD::calculateSourceNorm() { - this->singleMixture_.fresCorrect(); + this->singleMixturePtr_->fresCorrect(); - const label fuelI = this->singleMixture_.fuelIndex(); + const label fuelI = this->singleMixturePtr_->fuelIndex(); - const volScalarField& YFuel = this->thermo_->composition().Y()[fuelI]; + const volScalarField& YFuel = this->thermoPtr_->composition().Y()[fuelI]; - const volScalarField& YO2 = this->thermo_->composition().Y("O2"); + const volScalarField& YO2 = this->thermoPtr_->composition().Y("O2"); - const dimensionedScalar s = this->singleMixture_.s(); + const dimensionedScalar s = this->singleMixturePtr_->s(); ft_ = (s*YFuel - (YO2 - YO2OxiStream_))/(s*YFuelFuelStream_ + YO2OxiStream_); @@ -195,7 +190,7 @@ void FSD::calculateSourceNorm() volScalarField deltaF ( - lesModel.delta()/dimensionedScalar("flame",dimLength, 1.5e-3) + lesModel.delta()/dimensionedScalar("flame", dimLength, 1.5e-3) ); // Linear correlation between delta and flame thickness @@ -205,33 +200,33 @@ void FSD::calculateSourceNorm() forAll(ft_, cellI) { - if(ft_[cellI] > ftMin_ && ft_[cellI] < ftMax_) + if (ft_[cellI] > ftMin_ && ft_[cellI] < ftMax_) { scalar ftCell = ft_[cellI]; - if(ftVar[cellI] > ftVarMin_) //sub-grid beta pdf of ft_ + if (ftVar[cellI] > ftVarMin_) //sub-grid beta pdf of ft_ { scalar ftVarc = ftVar[cellI]; scalar a = max(ftCell*(ftCell*(1.0 - ftCell)/ftVarc - 1.0), 0.0); scalar b = max(a/ftCell - a, 0.0); - for(int i=1; i::calculateSourceNorm() else { omegaFuelBar[cellI] = - (omegaFuel[cellI]/omegaF[cellI]) - *exp - ( - -sqr(ftCell - ftStoich)/(2.0*sqr(0.01*omegaF[cellI])) - ); + omegaFuel[cellI]/omegaF[cellI] + *exp(-sqr(ftCell - ftStoich)/(2.0*sqr(0.01*omegaF[cellI]))); } - } else { - omegaFuelBar[cellI] = 0.0; + omegaFuelBar[cellI] = 0.0; } } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Combustion progress variable (c). -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // Combustion progress variable, c List