limitTemperature-multiphase-support.patch (4,646 bytes)
From 04ad509db07674c5b8f1b038c3df299ae7d16029 Mon Sep 17 00:00:00 2001
From: Juho Peltola <jpjuho@hila3.ad.vtt.fi>
Date: Wed, 7 Jun 2017 10:22:14 +0300
Subject: [PATCH] Add multiphase support to limitTemperature
---
.../reactingMultiphaseEulerFoam/EEqns.H | 1 +
.../reactingTwoPhaseEulerFoam/EEqns.H | 2 ++
.../limitTemperature/limitTemperature.C | 16 +++++++++++-----
.../limitTemperature/limitTemperature.H | 4 ++++
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H
index e4689ef..dc53815 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/EEqns.H
@@ -31,6 +31,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
EEqn->relax();
fvOptions.constrain(EEqn.ref());
EEqn->solve();
+ fvOptions.correct(phase.thermo().he());
}
}
diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H
index d9f1e85..246bea1 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/EEqns.H
@@ -25,6 +25,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
E1Eqn->relax();
fvOptions.constrain(E1Eqn.ref());
E1Eqn->solve();
+ fvOptions.correct(phase1.thermo().he());
}
}
@@ -45,6 +46,7 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
E2Eqn->relax();
fvOptions.constrain(E2Eqn.ref());
E2Eqn->solve();
+ fvOptions.correct(phase2.thermo().he());
}
}
diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.C b/src/fvOptions/corrections/limitTemperature/limitTemperature.C
index c5d7ead..63f9141 100644
--- a/src/fvOptions/corrections/limitTemperature/limitTemperature.C
+++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -57,13 +57,16 @@ Foam::fv::limitTemperature::limitTemperature
:
cellSetOption(name, modelType, dict, mesh),
Tmin_(readScalar(coeffs_.lookup("min"))),
- Tmax_(readScalar(coeffs_.lookup("max")))
+ Tmax_(readScalar(coeffs_.lookup("max"))),
+ phaseName_(coeffs_.lookupOrDefault<word>("phaseName",""))
{
// Set the field name to that of the energy field from which the temperature
// is obtained
-
const basicThermo& thermo =
- mesh_.lookupObject<basicThermo>(basicThermo::dictName);
+ mesh_.lookupObject<basicThermo>
+ (
+ IOobject::groupName(basicThermo::dictName, phaseName_)
+ );
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)
{
const basicThermo& thermo =
- mesh_.lookupObject<basicThermo>(basicThermo::dictName);
+ mesh_.lookupObject<basicThermo>
+ (
+ IOobject::groupName(basicThermo::dictName, phaseName_)
+ );
scalarField Tmin(cells_.size(), Tmin_);
scalarField Tmax(cells_.size(), Tmax_);
diff --git a/src/fvOptions/corrections/limitTemperature/limitTemperature.H b/src/fvOptions/corrections/limitTemperature/limitTemperature.H
index 956515e..a9574ac 100644
--- a/src/fvOptions/corrections/limitTemperature/limitTemperature.H
+++ b/src/fvOptions/corrections/limitTemperature/limitTemperature.H
@@ -39,6 +39,7 @@ Usage
selectionMode all;
min 200;
max 500;
+ phaseName gas; //optional
}
\endverbatim
@@ -78,6 +79,9 @@ protected:
//- Maximum temperature limit [K]
scalar Tmax_;
+ //- Optional phase name [K]
+ word phaseName_;
+
private:
--
1.6.2.5