limitTemperature: added support for multiphase solvers

Based on patch contributed by Juho Peltola, VTT

Resolves feature request https://bugs.openfoam.org/view.php?id=2572
This commit is contained in:
Henry Weller
2017-09-04 16:52:03 +01:00
committed by Andrew Heather
parent 9a1435ed9b
commit f8a8857cae
5 changed files with 20 additions and 5 deletions

View File

@ -31,6 +31,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
EEqn->relax(); EEqn->relax();
fvOptions.constrain(EEqn.ref()); fvOptions.constrain(EEqn.ref());
EEqn->solve(); EEqn->solve();
fvOptions.correct(phase.thermo().he());
} }
} }

View File

@ -25,6 +25,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
E1Eqn->relax(); E1Eqn->relax();
fvOptions.constrain(E1Eqn.ref()); fvOptions.constrain(E1Eqn.ref());
E1Eqn->solve(); E1Eqn->solve();
fvOptions.correct(phase1.thermo().he());
} }
} }
@ -45,6 +46,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
E2Eqn->relax(); E2Eqn->relax();
fvOptions.constrain(E2Eqn.ref()); fvOptions.constrain(E2Eqn.ref());
E2Eqn->solve(); E2Eqn->solve();
fvOptions.correct(phase2.thermo().he());
} }
} }

View File

@ -75,9 +75,11 @@
fvOptions.constrain(E1Eqn); fvOptions.constrain(E1Eqn);
E1Eqn.solve(); E1Eqn.solve();
fvOptions.correct(he1);
fvOptions.constrain(E2Eqn); fvOptions.constrain(E2Eqn);
E2Eqn.solve(); E2Eqn.solve();
fvOptions.correct(he2);
thermo1.correct(); thermo1.correct();
Info<< "min " << thermo1.T().name() Info<< "min " << thermo1.T().name()

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) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,13 +57,16 @@ Foam::fv::limitTemperature::limitTemperature
: :
cellSetOption(name, modelType, dict, mesh), cellSetOption(name, modelType, dict, mesh),
Tmin_(readScalar(coeffs_.lookup("min"))), Tmin_(readScalar(coeffs_.lookup("min"))),
Tmax_(readScalar(coeffs_.lookup("max"))) Tmax_(readScalar(coeffs_.lookup("max"))),
phase_(coeffs_.lookupOrDefault<word>("phase", word::null))
{ {
// Set the field name to that of the energy field from which the temperature // Set the field name to that of the energy field from which the temperature
// is obtained // is obtained
const basicThermo& thermo = const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName); mesh_.lookupObject<basicThermo>
(
IOobject::groupName(basicThermo::dictName, phase_)
);
fieldNames_.setSize(1, thermo.he().name()); fieldNames_.setSize(1, thermo.he().name());
@ -92,7 +95,10 @@ bool Foam::fv::limitTemperature::read(const dictionary& dict)
void Foam::fv::limitTemperature::correct(volScalarField& he) void Foam::fv::limitTemperature::correct(volScalarField& he)
{ {
const basicThermo& thermo = const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName); mesh_.lookupObject<basicThermo>
(
IOobject::groupName(basicThermo::dictName, phase_)
);
scalarField Tmin(cells_.size(), Tmin_); scalarField Tmin(cells_.size(), Tmin_);
scalarField Tmax(cells_.size(), Tmax_); scalarField Tmax(cells_.size(), Tmax_);

View File

@ -42,6 +42,7 @@ Usage
selectionMode all; selectionMode all;
min 200; min 200;
max 500; max 500;
phase gas; //optional
} }
\endverbatim \endverbatim
@ -81,6 +82,9 @@ protected:
//- Maximum temperature limit [K] //- Maximum temperature limit [K]
scalar Tmax_; scalar Tmax_;
//- Optional phase name [K]
word phase_;
private: private: