diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C index 286b9f3f0c..16720de35b 100644 --- a/src/combustionModels/PaSR/PaSR.C +++ b/src/combustionModels/PaSR/PaSR.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 @@ -53,10 +53,15 @@ Foam::combustionModels::PaSR::PaSR dimensionedScalar("kappa", dimless, 0.0) ), useReactionRate_(this->coeffs().lookupOrDefault("useReactionRate", false)) -{} +{ + if (useReactionRate_) + { + Info<< " using reaction rate" << endl; + } +} -// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template Foam::combustionModels::PaSR::~PaSR() @@ -79,13 +84,12 @@ void Foam::combustionModels::PaSR::correct() { if (this->active()) { + const scalar t = this->mesh().time().value(); + const scalar dt = this->mesh().time().deltaTValue(); + if (!useReactionRate_) { - this->pChemistry_->solve - ( - this->mesh().time().value()-this->mesh().time().deltaTValue(), - this->mesh().time().deltaTValue() - ); + this->pChemistry_->solve(t - dt, dt); } else { @@ -94,35 +98,35 @@ void Foam::combustionModels::PaSR::correct() if (turbulentReaction_) { + tmp trho(this->rho()); + const volScalarField& rho = trho(); tmp tepsilon(this->turbulence().epsilon()); const volScalarField& epsilon = tepsilon(); tmp tmuEff(this->turbulence().muEff()); const volScalarField& muEff = tmuEff(); + tmp ttc(tc()); const volScalarField& tc = ttc(); + + const dimensionedScalar e0 + ( + "e0", + sqr(dimLength)/pow3(dimTime), + SMALL + ); + forAll(epsilon, i) { if (epsilon[i] > 0) { - const dimensionedScalar e0 - ( - "e0", - sqr(dimLength)/pow3(dimTime), SMALL - ); - scalar tk = Cmix_.value() - *Foam::sqrt - ( - muEff[i]/this->rho()()[i]/(epsilon[i] + e0.value()) - ); + *Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + e0.value())); // Chalmers PaSR model if (!useReactionRate_) { - kappa_[i] = - ( this->mesh().time().deltaTValue() + tc[i]) - /( this->mesh().time().deltaTValue() + tc[i] + tk); + kappa_[i] = (dt + tc[i])/(dt + tc[i] + tk); } else { @@ -148,11 +152,7 @@ template Foam::tmp Foam::combustionModels::PaSR::R(const volScalarField& Y) const { - - tmp tSu - ( - new fvScalarMatrix(Y, dimMass/dimTime) - ); + tmp tSu(new fvScalarMatrix(Y, dimMass/dimTime)); fvScalarMatrix& Su = tSu(); diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index 8006caf0a9..0a06ef7364 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.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 @@ -398,7 +398,7 @@ const surfaceScalarField& fvMesh::phi() const if (!phiPtr_) { FatalErrorIn("fvMesh::phi()") - << "mesh flux field does not exists, is the mesh actually moving?" + << "mesh flux field does not exist, is the mesh actually moving?" << exit(FatalError); } @@ -418,7 +418,7 @@ surfaceScalarField& fvMesh::setPhi() if (!phiPtr_) { FatalErrorIn("fvMesh::setPhi()") - << "mesh flux field does not exists, is the mesh actually moving?" + << "mesh flux field does not exist, is the mesh actually moving?" << exit(FatalError); } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index 117412407c..f0807eb725 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.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 @@ -743,6 +743,8 @@ Foam::scalar Foam::ODEChemistryModel::solve const scalar deltaT ) { + CompType::correct(); + scalar deltaTMin = GREAT; const volScalarField rho diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C index 3b2aafecd8..38efa9e858 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.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 @@ -34,6 +34,18 @@ namespace Foam defineTypeNameAndDebug(basicChemistryModel, 0); } +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::basicChemistryModel::correct() +{ + if (mesh_.changing()) + { + deltaTChem_.setSize(mesh_.nCells()); + deltaTChem_ = deltaTChemIni_; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh) @@ -51,11 +63,8 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh) ), mesh_(mesh), chemistry_(lookup("chemistry")), - deltaTChem_ - ( - mesh.nCells(), - readScalar(lookup("initialChemicalTimeStep")) - ) + deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))), + deltaTChem_(mesh.nCells(), deltaTChemIni_) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H index 607133ce7e..2f27d59f70 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H @@ -76,6 +76,9 @@ protected: //- Chemistry activation switch Switch chemistry_; + //- Initial chemical time step + const scalar deltaTChemIni_; + //- Latest estimation of integration step scalarField deltaTChem_; @@ -86,6 +89,9 @@ protected: // step, e.g. for multi-chemistry model scalarField& deltaTChem(); + //- Correct function - updates due to mesh changes + void correct(); + public: