Commit 339bda28 authored by Henry's avatar Henry
Browse files

TurbulenceModels/turbulenceModels/LES: new LESeddyViscosity base-class

parent ded58b23
......@@ -47,7 +47,7 @@ Smagorinsky<BasicTurbulenceModel>::Smagorinsky
const word& type
)
:
eddyViscosity<LESModel<BasicTurbulenceModel> >
LESeddyViscosity<BasicTurbulenceModel>
(
type,
alpha,
......@@ -67,16 +67,6 @@ Smagorinsky<BasicTurbulenceModel>::Smagorinsky
this->coeffDict_,
0.094
)
),
Ce_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Ce",
this->coeffDict_,
1.048
)
)
{
if (type == typeName)
......@@ -92,10 +82,9 @@ Smagorinsky<BasicTurbulenceModel>::Smagorinsky
template<class BasicTurbulenceModel>
bool Smagorinsky<BasicTurbulenceModel>::read()
{
if (eddyViscosity<LESModel<BasicTurbulenceModel> >::read())
if (LESeddyViscosity<BasicTurbulenceModel>::read())
{
Ck_.readIfPresent(this->coeffDict());
Ce_.readIfPresent(this->coeffDict());
return true;
}
......@@ -114,7 +103,7 @@ tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::k
{
volSymmTensorField D(symm(gradU));
volScalarField a(Ce_/this->delta());
volScalarField a(this->Ce_/this->delta());
volScalarField b((2.0/3.0)*tr(D));
volScalarField c(2*Ck_*this->delta()*(dev(D) && D));
......@@ -137,7 +126,7 @@ tmp<volScalarField> Smagorinsky<BasicTurbulenceModel>::epsilon() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
Ce_*k()*sqrt(k())/this->delta()
this->Ce_*k()*sqrt(k())/this->delta()
)
);
}
......@@ -156,7 +145,7 @@ void Smagorinsky<BasicTurbulenceModel>::correctNut()
template<class BasicTurbulenceModel>
void Smagorinsky<BasicTurbulenceModel>::correct()
{
eddyViscosity<LESModel<BasicTurbulenceModel> >::correct();
LESeddyViscosity<BasicTurbulenceModel>::correct();
correctNut();
}
......
......@@ -62,7 +62,7 @@ SourceFiles
#define Smagorinsky_H
#include "LESModel.H"
#include "eddyViscosity.H"
#include "LESeddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -78,7 +78,7 @@ namespace LESModels
template<class BasicTurbulenceModel>
class Smagorinsky
:
public eddyViscosity<LESModel<BasicTurbulenceModel> >
public LESeddyViscosity<BasicTurbulenceModel>
{
// Private Member Functions
......@@ -92,7 +92,6 @@ protected:
// Protected data
dimensionedScalar Ck_;
dimensionedScalar Ce_;
// Protected Member Functions
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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 "LESeddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
LESeddyViscosity<BasicTurbulenceModel>::LESeddyViscosity
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
eddyViscosity<LESModel<BasicTurbulenceModel> >
(
type,
alpha,
rho,
U,
alphaPhi,
phi,
transport,
propertiesName
),
Ce_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Ce",
this->coeffDict_,
1.048
)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool LESeddyViscosity<BasicTurbulenceModel>::read()
{
if (eddyViscosity<LESModel<BasicTurbulenceModel> >::read())
{
Ce_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}
template<class BasicTurbulenceModel>
tmp<volScalarField> LESeddyViscosity<BasicTurbulenceModel>::epsilon() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
IOobject::groupName("epsilon", this->U_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
Ce_*this->k()*sqrt(this->k())/this->delta()
)
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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/>.
Class
Foam::LESModels::LESeddyViscosity
Group
grpLESTurbulence
Description
Eddy viscosity LES SGS model base class
SourceFiles
LESeddyViscosity.C
\*---------------------------------------------------------------------------*/
#ifndef LESeddyViscosity_H
#define LESeddyViscosity_H
#include "LESModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class LESeddyViscosity Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class LESeddyViscosity
:
public eddyViscosity<LESModel<BasicTurbulenceModel> >
{
// Private Member Functions
// Disallow default bitwise copy construct and assignment
LESeddyViscosity(const LESeddyViscosity&);
LESeddyViscosity& operator=(const LESeddyViscosity&);
protected:
// Protected data
dimensionedScalar Ce_;
// Protected Member Functions
virtual void correctNut() = 0;
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
//- Runtime type information
TypeName("LESeddyViscosity");
// Constructors
//- Construct from components
LESeddyViscosity
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~LESeddyViscosity()
{}
// Member Functions
//- Read model coefficients if they have changed
virtual bool read();
//- Return sub-grid disipation rate
virtual tmp<volScalarField> epsilon() const;
//- Correct Eddy-Viscosity and related properties
virtual void correct() = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "LESeddyViscosity.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -47,7 +47,7 @@ kEqn<BasicTurbulenceModel>::kEqn
const word& type
)
:
eddyViscosity<LESModel<BasicTurbulenceModel> >
LESeddyViscosity<BasicTurbulenceModel>
(
type,
alpha,
......@@ -80,16 +80,6 @@ kEqn<BasicTurbulenceModel>::kEqn
this->coeffDict_,
0.094
)
),
Ce_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Ce",
this->coeffDict_,
1.048
)
)
{
if (type == typeName)
......@@ -105,10 +95,9 @@ kEqn<BasicTurbulenceModel>::kEqn
template<class BasicTurbulenceModel>
bool kEqn<BasicTurbulenceModel>::read()
{
if (eddyViscosity<LESModel<BasicTurbulenceModel> >::read())
if (LESeddyViscosity<BasicTurbulenceModel>::read())
{
Ck_.readIfPresent(this->coeffDict());
Ce_.readIfPresent(this->coeffDict());
return true;
}
......@@ -134,7 +123,7 @@ tmp<volScalarField> kEqn<BasicTurbulenceModel>::epsilon() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
Ce_*k()*sqrt(k())/this->delta()
this->Ce_*k()*sqrt(k())/this->delta()
)
);
}
......@@ -179,7 +168,7 @@ void kEqn<BasicTurbulenceModel>::correct()
const volVectorField& U = this->U_;
volScalarField& nut = this->nut_;
eddyViscosity<LESModel<BasicTurbulenceModel> >::correct();
LESeddyViscosity<BasicTurbulenceModel>::correct();
volScalarField divU(fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U)));
......@@ -196,7 +185,7 @@ void kEqn<BasicTurbulenceModel>::correct()
==
alpha*rho*G
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
- fvm::Sp(Ce_*alpha*rho*sqrt(k_)/this->delta(), k_)
- fvm::Sp(this->Ce_*alpha*rho*sqrt(k_)/this->delta(), k_)
+ kSource()
);
......
......@@ -66,7 +66,7 @@ SourceFiles
#define kEqn_H
#include "LESModel.H"
#include "eddyViscosity.H"
#include "LESeddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -82,7 +82,7 @@ namespace LESModels
template<class BasicTurbulenceModel>
class kEqn
:
public eddyViscosity<LESModel<BasicTurbulenceModel> >
public LESeddyViscosity<BasicTurbulenceModel>
{
// Private Member Functions
......@@ -98,7 +98,6 @@ protected:
volScalarField k_;
dimensionedScalar Ck_;
dimensionedScalar Ce_;
// Protected Member Functions
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment