turbulenceModels/RAS/kEpsilon/kEpsilon: Added experimental support for fvOptions

This commit is contained in:
Henry Weller
2015-11-28 19:07:42 +00:00
parent 2dbf835485
commit c0ddac32ae
7 changed files with 109 additions and 7 deletions

View File

@ -16,7 +16,8 @@ EXE_INC = \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude -I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lengine \ -lengine \
@ -29,4 +30,5 @@ EXE_LIBS = \
-lspecie \ -lspecie \
-llaminarFlameSpeedModels \ -llaminarFlameSpeedModels \
-lfiniteVolume \ -lfiniteVolume \
-ldynamicFvMesh -ldynamicFvMesh \
-lfvOptions

View File

@ -7,4 +7,5 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude

View File

@ -6,7 +6,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-lcompressibleTransportModels \ -lcompressibleTransportModels \
@ -16,4 +17,5 @@ LIB_LIBS = \
-lturbulenceModels \ -lturbulenceModels \
-lspecie \ -lspecie \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools -lmeshTools \
-lfvOptions

View File

@ -2,10 +2,12 @@ EXE_INC = \
-I../turbulenceModels/lnInclude \ -I../turbulenceModels/lnInclude \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lturbulenceModels \ -lturbulenceModels \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools -lmeshTools \
-lfvOptions

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "kEpsilon.H" #include "kEpsilon.H"
#include "fvOptionList.H"
#include "bound.H" #include "bound.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -238,6 +239,14 @@ void kEpsilon<BasicTurbulenceModel>::correct()
const volVectorField& U = this->U_; const volVectorField& U = this->U_;
volScalarField& nut = this->nut_; volScalarField& nut = this->nut_;
// const_cast needed because the operators and functions of fvOptions
// are currently non-const.
fv::optionList& fvOptions = const_cast<fv::optionList&>
(
this->mesh_.objectRegistry::template
lookupObject<fv::optionList>("fvOptions")
);
eddyViscosity<RASModel<BasicTurbulenceModel> >::correct(); eddyViscosity<RASModel<BasicTurbulenceModel> >::correct();
volScalarField divU(fvc::div(fvc::absolute(this->phi(), U))); volScalarField divU(fvc::div(fvc::absolute(this->phi(), U)));
@ -260,11 +269,14 @@ void kEpsilon<BasicTurbulenceModel>::correct()
- fvm::SuSp(((2.0/3.0)*C1_ + C3_)*alpha*rho*divU, epsilon_) - fvm::SuSp(((2.0/3.0)*C1_ + C3_)*alpha*rho*divU, epsilon_)
- fvm::Sp(C2_*alpha*rho*epsilon_/k_, epsilon_) - fvm::Sp(C2_*alpha*rho*epsilon_/k_, epsilon_)
+ epsilonSource() + epsilonSource()
+ fvOptions(alpha, rho, epsilon_)
); );
epsEqn().relax(); epsEqn().relax();
fvOptions.constrain(epsEqn());
epsEqn().boundaryManipulate(epsilon_.boundaryField()); epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn); solve(epsEqn);
fvOptions.correct(epsilon_);
bound(epsilon_, this->epsilonMin_); bound(epsilon_, this->epsilonMin_);
// Turbulent kinetic energy equation // Turbulent kinetic energy equation
@ -278,13 +290,17 @@ void kEpsilon<BasicTurbulenceModel>::correct()
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_) - fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
- fvm::Sp(alpha*rho*epsilon_/k_, k_) - fvm::Sp(alpha*rho*epsilon_/k_, k_)
+ kSource() + kSource()
+ fvOptions(alpha, rho, k_)
); );
kEqn().relax(); kEqn().relax();
fvOptions.constrain(kEqn());
solve(kEqn); solve(kEqn);
fvOptions.correct(k_);
bound(k_, this->kMin_); bound(k_, this->kMin_);
correctNut(); correctNut();
fvOptions.correct(nut);
} }

View File

@ -38,6 +38,7 @@ SourceFile
#include "fvOption.H" #include "fvOption.H"
#include "PtrList.H" #include "PtrList.H"
#include "GeometricField.H" #include "GeometricField.H"
#include "geometricOneField.H"
#include "fvPatchField.H" #include "fvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -173,6 +174,33 @@ public:
const word& fieldName const word& fieldName
); );
//- Return source for equation
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const volScalarField& alpha,
const geometricOneField& rho,
GeometricField<Type, fvPatchField, volMesh>& field
);
//- Return source for equation
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const geometricOneField& alpha,
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& field
);
//- Return source for equation
template<class Type>
tmp<fvMatrix<Type> > operator()
(
const geometricOneField& alpha,
const geometricOneField& rho,
GeometricField<Type, fvPatchField, volMesh>& field
);
// Constraints // Constraints

View File

@ -191,6 +191,57 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator()
} }
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator()
(
const geometricOneField& alpha,
const geometricOneField& rho,
GeometricField<Type, fvPatchField, volMesh>& field
)
{
return this->operator()(field, field.name());
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator()
(
const volScalarField& alpha,
const geometricOneField& rho,
GeometricField<Type, fvPatchField, volMesh>& field
)
{
volScalarField one
(
IOobject
(
"one",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh_,
dimensionedScalar("one", dimless, 1.0)
);
return this->operator()(alpha, one, field, field.name());
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator()
(
const geometricOneField& alpha,
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& field
)
{
return this->operator()(rho, field, field.name());
}
template<class Type> template<class Type>
void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn) void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn)
{ {