mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TurbulenceModels: Added kEqn (k-equation eddy-viscosity model, formally oneEqEddy) SGS model
This commit is contained in:
@ -107,6 +107,7 @@ namespace Foam
|
|||||||
|
|
||||||
#include "LESModel.H"
|
#include "LESModel.H"
|
||||||
#include "Smagorinsky.H"
|
#include "Smagorinsky.H"
|
||||||
|
#include "kEqn.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -138,6 +139,22 @@ namespace Foam
|
|||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
typedef kEqn<incompressibleTransportTurbulenceModel>
|
||||||
|
incompressiblekEqn;
|
||||||
|
|
||||||
|
defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
incompressibleLESModel,
|
||||||
|
incompressiblekEqn,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public:
|
|||||||
//- Correct Eddy-Viscosity and related properties
|
//- Correct Eddy-Viscosity and related properties
|
||||||
virtual void correct();
|
virtual void correct();
|
||||||
|
|
||||||
//- Re-read model coefficients if they have changed
|
//- Read model coefficients if they have changed
|
||||||
virtual bool read();
|
virtual bool read();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
217
src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.C
Normal file
217
src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.C
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-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 "kEqn.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
kEqn<BasicTurbulenceModel>::kEqn
|
||||||
|
(
|
||||||
|
const alphaField& alpha,
|
||||||
|
const rhoField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& alphaPhi,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const transportModel& transport,
|
||||||
|
const word& propertiesName,
|
||||||
|
const word& type
|
||||||
|
)
|
||||||
|
:
|
||||||
|
eddyViscosity<LESModel<BasicTurbulenceModel> >
|
||||||
|
(
|
||||||
|
type,
|
||||||
|
alpha,
|
||||||
|
rho,
|
||||||
|
U,
|
||||||
|
alphaPhi,
|
||||||
|
phi,
|
||||||
|
transport,
|
||||||
|
propertiesName
|
||||||
|
),
|
||||||
|
|
||||||
|
k_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
IOobject::groupName("k", this->U_.group()),
|
||||||
|
this->runTime_.timeName(),
|
||||||
|
this->mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
this->mesh_
|
||||||
|
),
|
||||||
|
|
||||||
|
ck_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"ck",
|
||||||
|
this->coeffDict_,
|
||||||
|
0.094
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
ce_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"ce",
|
||||||
|
this->coeffDict_,
|
||||||
|
1.048
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (type == typeName)
|
||||||
|
{
|
||||||
|
correctNut();
|
||||||
|
this->printCoeffs(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
bool kEqn<BasicTurbulenceModel>::read()
|
||||||
|
{
|
||||||
|
if (eddyViscosity<LESModel<BasicTurbulenceModel> >::read())
|
||||||
|
{
|
||||||
|
ck_.readIfPresent(this->coeffDict());
|
||||||
|
ce_.readIfPresent(this->coeffDict());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
tmp<volScalarField> kEqn<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_*k()*sqrt(k())/this->delta()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
void kEqn<BasicTurbulenceModel>::correctNut()
|
||||||
|
{
|
||||||
|
this->nut_ = ck_*sqrt(k_)*this->delta();
|
||||||
|
this->nut_.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
tmp<fvScalarMatrix> kEqn<BasicTurbulenceModel>::kSource() const
|
||||||
|
{
|
||||||
|
return tmp<fvScalarMatrix>
|
||||||
|
(
|
||||||
|
new fvScalarMatrix
|
||||||
|
(
|
||||||
|
k_,
|
||||||
|
dimVolume*this->rho_.dimensions()*k_.dimensions()
|
||||||
|
/dimTime
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
void kEqn<BasicTurbulenceModel>::correct()
|
||||||
|
{
|
||||||
|
// Local references
|
||||||
|
const alphaField& alpha = this->alpha_;
|
||||||
|
const rhoField& rho = this->rho_;
|
||||||
|
const surfaceScalarField& alphaPhi = this->alphaPhi_;
|
||||||
|
const surfaceScalarField& phi = this->phi_;
|
||||||
|
const volVectorField& U = this->U_;
|
||||||
|
volScalarField& nut = this->nut_;
|
||||||
|
|
||||||
|
if (!this->turbulence_)
|
||||||
|
{
|
||||||
|
correctNut();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
eddyViscosity<LESModel<BasicTurbulenceModel> >::correct();
|
||||||
|
|
||||||
|
volScalarField divU(fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U)));
|
||||||
|
|
||||||
|
tmp<volTensorField> tgradU(fvc::grad(U));
|
||||||
|
volScalarField G(this->GName(), nut*(tgradU() && dev(twoSymm(tgradU()))));
|
||||||
|
tgradU.clear();
|
||||||
|
|
||||||
|
tmp<fvScalarMatrix> kEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(alpha, rho, k_)
|
||||||
|
+ fvm::div(alphaPhi, k_)
|
||||||
|
- fvm::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaPhi), k_)
|
||||||
|
- fvm::laplacian(alpha*rho*DkEff(), k_)
|
||||||
|
==
|
||||||
|
alpha*rho*G
|
||||||
|
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
|
||||||
|
- fvm::Sp(ce_*alpha*rho*sqrt(k_)/this->delta(), k_)
|
||||||
|
+ kSource()
|
||||||
|
);
|
||||||
|
|
||||||
|
kEqn().relax();
|
||||||
|
solve(kEqn);
|
||||||
|
bound(k_, this->kMin_);
|
||||||
|
|
||||||
|
correctNut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace LESModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
180
src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.H
Normal file
180
src/TurbulenceModels/turbulenceModels/LES/kEqn/kEqn.H
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-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::kEqn
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpLESTurbulence
|
||||||
|
|
||||||
|
Description
|
||||||
|
One Equation Eddy Viscosity Model
|
||||||
|
|
||||||
|
Eddy viscosity SGS model using a modeled balance equation to simulate the
|
||||||
|
behaviour of k, hence,
|
||||||
|
\verbatim
|
||||||
|
d/dt(rho*k) + div(rho*U*k) - div(rho*nuEff*grad(k))
|
||||||
|
=
|
||||||
|
-rho*D:B - ce*rho*k^(3/2)/delta
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
B = 2/3*k*I - 2*nuSgs*dev(D)
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
D = symm(grad(U));
|
||||||
|
nuSgs = ck*sqrt(k)*delta
|
||||||
|
nuEff = nuSgs + nu
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
kEqn.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef kEqn_H
|
||||||
|
#define kEqn_H
|
||||||
|
|
||||||
|
#include "LESModel.H"
|
||||||
|
#include "eddyViscosity.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class kEqn Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
class kEqn
|
||||||
|
:
|
||||||
|
public eddyViscosity<LESModel<BasicTurbulenceModel> >
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
volScalarField k_;
|
||||||
|
|
||||||
|
dimensionedScalar ck_;
|
||||||
|
dimensionedScalar ce_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update sub-grid scale fields
|
||||||
|
void updateSubGridScaleFields();
|
||||||
|
|
||||||
|
// Disallow default bitwise copy construct and assignment
|
||||||
|
kEqn(const kEqn&);
|
||||||
|
kEqn& operator=(const kEqn&);
|
||||||
|
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
|
virtual void correctNut();
|
||||||
|
virtual tmp<fvScalarMatrix> kSource() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||||
|
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||||
|
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||||
|
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("kEqn");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Constructor from components
|
||||||
|
kEqn
|
||||||
|
(
|
||||||
|
const alphaField& alpha,
|
||||||
|
const rhoField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& alphaPhi,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const transportModel& transport,
|
||||||
|
const word& propertiesName = turbulenceModel::propertiesName,
|
||||||
|
const word& type = typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~kEqn()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return SGS kinetic energy
|
||||||
|
virtual tmp<volScalarField> k() const
|
||||||
|
{
|
||||||
|
return k_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return sub-grid disipation rate
|
||||||
|
virtual tmp<volScalarField> epsilon() const;
|
||||||
|
|
||||||
|
//- Return the effective diffusivity for k
|
||||||
|
tmp<volScalarField> DkEff() const
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField("DkEff", this->nut_ + this->nu())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Correct Eddy-Viscosity and related properties
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read model coefficients if they have changed
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace LESModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "kEqn.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user