Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-03-30 16:11:39 +01:00
5 changed files with 53 additions and 36 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,10 +53,15 @@ Foam::combustionModels::PaSR<CombThermoType>::PaSR
dimensionedScalar("kappa", dimless, 0.0) dimensionedScalar("kappa", dimless, 0.0)
), ),
useReactionRate_(this->coeffs().lookupOrDefault("useReactionRate", false)) useReactionRate_(this->coeffs().lookupOrDefault("useReactionRate", false))
{} {
if (useReactionRate_)
{
Info<< " using reaction rate" << endl;
}
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType> template<class CombThermoType>
Foam::combustionModels::PaSR<CombThermoType>::~PaSR() Foam::combustionModels::PaSR<CombThermoType>::~PaSR()
@ -79,13 +84,12 @@ void Foam::combustionModels::PaSR<CombThermoType>::correct()
{ {
if (this->active()) if (this->active())
{ {
const scalar t = this->mesh().time().value();
const scalar dt = this->mesh().time().deltaTValue();
if (!useReactionRate_) if (!useReactionRate_)
{ {
this->pChemistry_->solve this->pChemistry_->solve(t - dt, dt);
(
this->mesh().time().value()-this->mesh().time().deltaTValue(),
this->mesh().time().deltaTValue()
);
} }
else else
{ {
@ -94,35 +98,35 @@ void Foam::combustionModels::PaSR<CombThermoType>::correct()
if (turbulentReaction_) if (turbulentReaction_)
{ {
tmp<volScalarField> trho(this->rho());
const volScalarField& rho = trho();
tmp<volScalarField> tepsilon(this->turbulence().epsilon()); tmp<volScalarField> tepsilon(this->turbulence().epsilon());
const volScalarField& epsilon = tepsilon(); const volScalarField& epsilon = tepsilon();
tmp<volScalarField> tmuEff(this->turbulence().muEff()); tmp<volScalarField> tmuEff(this->turbulence().muEff());
const volScalarField& muEff = tmuEff(); const volScalarField& muEff = tmuEff();
tmp<volScalarField> ttc(tc()); tmp<volScalarField> ttc(tc());
const volScalarField& tc = ttc(); const volScalarField& tc = ttc();
const dimensionedScalar e0
(
"e0",
sqr(dimLength)/pow3(dimTime),
SMALL
);
forAll(epsilon, i) forAll(epsilon, i)
{ {
if (epsilon[i] > 0) if (epsilon[i] > 0)
{ {
const dimensionedScalar e0
(
"e0",
sqr(dimLength)/pow3(dimTime), SMALL
);
scalar tk = scalar tk =
Cmix_.value() Cmix_.value()
*Foam::sqrt *Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + e0.value()));
(
muEff[i]/this->rho()()[i]/(epsilon[i] + e0.value())
);
// Chalmers PaSR model // Chalmers PaSR model
if (!useReactionRate_) if (!useReactionRate_)
{ {
kappa_[i] = kappa_[i] = (dt + tc[i])/(dt + tc[i] + tk);
( this->mesh().time().deltaTValue() + tc[i])
/( this->mesh().time().deltaTValue() + tc[i] + tk);
} }
else else
{ {
@ -148,11 +152,7 @@ template<class CombThermoType>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::PaSR<CombThermoType>::R(const volScalarField& Y) const Foam::combustionModels::PaSR<CombThermoType>::R(const volScalarField& Y) const
{ {
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
tmp<fvScalarMatrix> tSu
(
new fvScalarMatrix(Y, dimMass/dimTime)
);
fvScalarMatrix& Su = tSu(); fvScalarMatrix& Su = tSu();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -398,7 +398,7 @@ const surfaceScalarField& fvMesh::phi() const
if (!phiPtr_) if (!phiPtr_)
{ {
FatalErrorIn("fvMesh::phi()") 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); << exit(FatalError);
} }
@ -418,7 +418,7 @@ surfaceScalarField& fvMesh::setPhi()
if (!phiPtr_) if (!phiPtr_)
{ {
FatalErrorIn("fvMesh::setPhi()") 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); << exit(FatalError);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -743,6 +743,8 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
const scalar deltaT const scalar deltaT
) )
{ {
CompType::correct();
scalar deltaTMin = GREAT; scalar deltaTMin = GREAT;
const volScalarField rho const volScalarField rho

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,6 +34,18 @@ namespace Foam
defineTypeNameAndDebug(basicChemistryModel, 0); defineTypeNameAndDebug(basicChemistryModel, 0);
} }
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::basicChemistryModel::correct()
{
if (mesh_.changing())
{
deltaTChem_.setSize(mesh_.nCells());
deltaTChem_ = deltaTChemIni_;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh) Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
@ -51,11 +63,8 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
), ),
mesh_(mesh), mesh_(mesh),
chemistry_(lookup("chemistry")), chemistry_(lookup("chemistry")),
deltaTChem_ deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))),
( deltaTChem_(mesh.nCells(), deltaTChemIni_)
mesh.nCells(),
readScalar(lookup("initialChemicalTimeStep"))
)
{} {}

View File

@ -76,6 +76,9 @@ protected:
//- Chemistry activation switch //- Chemistry activation switch
Switch chemistry_; Switch chemistry_;
//- Initial chemical time step
const scalar deltaTChemIni_;
//- Latest estimation of integration step //- Latest estimation of integration step
scalarField deltaTChem_; scalarField deltaTChem_;
@ -86,6 +89,9 @@ protected:
// step, e.g. for multi-chemistry model // step, e.g. for multi-chemistry model
scalarField& deltaTChem(); scalarField& deltaTChem();
//- Correct function - updates due to mesh changes
void correct();
public: public: