LTS: Formalize the naming of the rDeltaT and rSubDeltaT fields

Now the specification of the LTS time scheme is simply:

ddtSchemes
{
    default         localEuler;
}
This commit is contained in:
Henry Weller
2015-06-28 21:41:40 +01:00
parent af8185c0a6
commit f92d657ab7
20 changed files with 145 additions and 71 deletions

View File

@ -77,11 +77,7 @@ int main(int argc, char *argv[])
{ {
#include "readTimeControls.H" #include "readTimeControls.H"
if (LTS) if (!LTS)
{
#include "setRDeltaT.H"
}
else
{ {
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "setDeltaT.H" #include "setDeltaT.H"
@ -93,6 +89,11 @@ int main(int argc, char *argv[])
parcels.evolve(); parcels.evolve();
if (LTS)
{
#include "setRDeltaT.H"
}
#include "rhoEqn.H" #include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop

View File

@ -79,11 +79,7 @@
( (
( (
LTS LTS
? fv::localEulerDdtScheme<scalar> ? fv::localEulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
(
mesh,
nAlphaSubCycles > 1 ? "rSubDeltaT" : "rDeltaT"
).fvmDdt(alpha1)
: fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1) : fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
) )
+ fv::gaussConvectionScheme<scalar> + fv::gaussConvectionScheme<scalar>

View File

@ -17,10 +17,8 @@ if (nAlphaSubCycles > 1)
if (LTS) if (LTS)
{ {
trSubDeltaT = tmp<volScalarField> trSubDeltaT =
( fv::localEulerDdt::localRSubDeltaT(mesh, nAlphaSubCycles);
new volScalarField("rSubDeltaT", trDeltaT()*nAlphaSubCycles)
);
} }
for for

View File

@ -75,7 +75,7 @@
if (LTS) if (LTS)
{ {
const volScalarField& rDeltaT = const volScalarField& rDeltaT =
mesh.objectRegistry::lookupObject<volScalarField>("rSubDeltaT"); fv::localEulerDdt::localRDeltaT(mesh);
MULES::limiter MULES::limiter
( (
@ -138,7 +138,7 @@
if (LTS) if (LTS)
{ {
const volScalarField& rDeltaT = const volScalarField& rDeltaT =
mesh.objectRegistry::lookupObject<volScalarField>("rSubDeltaT"); fv::localEulerDdt::localRDeltaT(mesh);
MULES::limiter MULES::limiter
( (

View File

@ -324,16 +324,8 @@ void Foam::twoPhaseSystem::solve()
if (LTS) if (LTS)
{ {
const volScalarField& rDeltaT = trSubDeltaT =
mesh.objectRegistry::lookupObject<volScalarField> fv::localEulerDdt::localRSubDeltaT(mesh, nAlphaSubCycles);
(
"rDeltaT"
);
trSubDeltaT = tmp<volScalarField>
(
new volScalarField("rSubDeltaT", rDeltaT*nAlphaSubCycles)
);
} }
for for

View File

@ -83,11 +83,7 @@ void Foam::combustionModels::laminar<Type>::correct()
if (ddtScheme == fv::localEulerDdtScheme<scalar>::typeName) if (ddtScheme == fv::localEulerDdtScheme<scalar>::typeName)
{ {
const scalarField& rDeltaT = const scalarField& rDeltaT =
this->mesh().objectRegistry:: fv::localEulerDdt::localRDeltaT(this->mesh());
template lookupObject<volScalarField>
(
"rDeltaT"
);
if (this->coeffs().found("maxIntegrationTime")) if (this->coeffs().found("maxIntegrationTime"))
{ {

View File

@ -335,6 +335,7 @@ $(ddtSchemes)/steadyStateDdtScheme/steadyStateDdtSchemes.C
$(ddtSchemes)/EulerDdtScheme/EulerDdtSchemes.C $(ddtSchemes)/EulerDdtScheme/EulerDdtSchemes.C
$(ddtSchemes)/CoEulerDdtScheme/CoEulerDdtSchemes.C $(ddtSchemes)/CoEulerDdtScheme/CoEulerDdtSchemes.C
$(ddtSchemes)/SLTSDdtScheme/SLTSDdtSchemes.C $(ddtSchemes)/SLTSDdtScheme/SLTSDdtSchemes.C
$(ddtSchemes)/localEulerDdtScheme/localEulerDdt.C
$(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C $(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C
$(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C
$(ddtSchemes)/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C $(ddtSchemes)/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C

View File

@ -14,7 +14,7 @@ if (LTS)
( (
IOobject IOobject
( (
"rDeltaT", fv::localEulerDdt::rDeltaTName,
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,

View File

@ -33,7 +33,8 @@ Description
using transient codes where local time-stepping is preferably to using transient codes where local time-stepping is preferably to
under-relaxation for transport consistency reasons. under-relaxation for transport consistency reasons.
See also CoEulerDdtScheme. See Also
Foam::fv::CoEulerDdtScheme
SourceFiles SourceFiles
SLTSDdtScheme.C SLTSDdtScheme.C

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "localEulerDdtScheme.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::word Foam::fv::localEulerDdt::rDeltaTName("rDeltaT");
Foam::word Foam::fv::localEulerDdt::rSubDeltaTName("rSubDeltaTName");
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::fv::localEulerDdt::localRDeltaT
(
const fvMesh& mesh
)
{
return mesh.objectRegistry::template lookupObject<volScalarField>
(
mesh.time().subCycling() ? rSubDeltaTName : rDeltaTName
);
}
Foam::tmp<Foam::volScalarField> Foam::fv::localEulerDdt::localRSubDeltaT
(
const fvMesh& mesh,
const label nAlphaSubCycles
)
{
return tmp<volScalarField>
(
new volScalarField
(
rSubDeltaTName,
nAlphaSubCycles
*mesh.objectRegistry::template lookupObject<volScalarField>
(
rDeltaTName
)
)
);
}
// ************************************************************************* //

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-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,8 +42,7 @@ namespace fv
template<class Type> template<class Type>
const volScalarField& localEulerDdtScheme<Type>::localRDeltaT() const const volScalarField& localEulerDdtScheme<Type>::localRDeltaT() const
{ {
return mesh().objectRegistry::template lookupObject<volScalarField> return localEulerDdt::localRDeltaT(mesh());
(rDeltaTName_);
} }

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-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,14 +26,15 @@ Class
Description Description
Local time-step first-order Euler implicit/explicit ddt. Local time-step first-order Euler implicit/explicit ddt.
The reciprocal of the local time-step field is looked-up from the
database with the name provided.
This scheme should only be used for steady-state computations The reciprocal of the local time-step field is looked-up from the database.
using transient codes where local time-stepping is preferably to
under-relaxation for transport consistency reasons.
See also CoEulerDdtScheme. This scheme should only be used for steady-state computations using
transient codes where local time-stepping is preferably to under-relaxation
for transport consistency reasons.
See Also
Foam::fv::CoEulerDdtScheme
SourceFiles SourceFiles
localEulerDdtScheme.C localEulerDdtScheme.C
@ -56,6 +57,41 @@ namespace Foam
namespace fv namespace fv
{ {
/*---------------------------------------------------------------------------*\
Class localEulerDdt Declaration
\*---------------------------------------------------------------------------*/
class localEulerDdt
{
public:
//- Name of the reciprocal local time-step field
static word rDeltaTName;
//- Name of the reciprocal local sub-cycling time-step field
static word rSubDeltaTName;
// Constructors
localEulerDdt()
{}
// Member Functions
//- Return the reciprocal of the local time-step
// looked-up from the objectRegistry
static const volScalarField& localRDeltaT(const fvMesh& mesh);
//- Calculate and return the reciprocal of the local sub-cycling
// time-step
static tmp<volScalarField> localRSubDeltaT
(
const fvMesh& mesh,
const label nAlphaSubCycles
);
};
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class localEulerDdtScheme Declaration Class localEulerDdtScheme Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -63,14 +99,9 @@ namespace fv
template<class Type> template<class Type>
class localEulerDdtScheme class localEulerDdtScheme
: :
public localEulerDdt,
public fv::ddtScheme<Type> public fv::ddtScheme<Type>
{ {
// Private Data
//- Name of the reciprocal local time-step field
word rDeltaTName_;
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
@ -91,18 +122,16 @@ public:
// Constructors // Constructors
//- Construct from mesh and name of the rDeltaT field //- Construct from mesh
localEulerDdtScheme(const fvMesh& mesh, const word& rDeltaTName) localEulerDdtScheme(const fvMesh& mesh)
: :
ddtScheme<Type>(mesh), ddtScheme<Type>(mesh)
rDeltaTName_(rDeltaTName)
{} {}
//- Construct from mesh and Istream //- Construct from mesh and Istream
localEulerDdtScheme(const fvMesh& mesh, Istream& is) localEulerDdtScheme(const fvMesh& mesh, Istream& is)
: :
ddtScheme<Type>(mesh, is), ddtScheme<Type>(mesh, is)
rDeltaTName_(is)
{} {}

View File

@ -95,11 +95,7 @@ void Foam::MULES::correct
if (LTS) if (LTS)
{ {
const volScalarField& rDeltaT = const volScalarField& rDeltaT = fv::localEulerDdt::localRDeltaT(mesh);
mesh.objectRegistry::lookupObject<volScalarField>
(
mesh.time().subCycling() ? "rSubDeltaT" : "rDeltaT"
);
limitCorr limitCorr
( (

View File

@ -117,11 +117,7 @@ void Foam::MULES::explicitSolve
if (LTS) if (LTS)
{ {
const volScalarField& rDeltaT = const volScalarField& rDeltaT = fv::localEulerDdt::localRDeltaT(mesh);
mesh.objectRegistry::lookupObject<volScalarField>
(
mesh.time().subCycling() ? "rSubDeltaT" : "rDeltaT"
);
limit limit
( (

View File

@ -17,7 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default localEuler rDeltaT; default localEuler;
} }
gradSchemes gradSchemes

View File

@ -19,7 +19,7 @@ fluxScheme Kurganov;
ddtSchemes ddtSchemes
{ {
default localEuler rDeltaT; default localEuler;
} }
gradSchemes gradSchemes

View File

@ -17,7 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default localEuler rDeltaT; default localEuler;
} }
gradSchemes gradSchemes

View File

@ -17,7 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default localEuler rDeltaT; default localEuler;
} }
gradSchemes gradSchemes

View File

@ -17,7 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default localEuler rDeltaT; default localEuler;
} }
gradSchemes gradSchemes

View File

@ -17,7 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default localEuler rDeltaT; default localEuler;
} }
gradSchemes gradSchemes