mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TurbulenceModels: Added structure for LES model and the Smagorinsky model within this structure.
This commit is contained in:
@ -2,7 +2,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
|
||||||
-IphaseIncompressibleTurbulenceModels/lnInclude \
|
-IphaseIncompressibleTurbulenceModels/lnInclude \
|
||||||
|
|||||||
@ -3,7 +3,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/transportModel \
|
-I$(LIB_SRC)/transportModels/incompressible/transportModel \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
-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../twoPhaseSystem/lnInclude \
|
-I../twoPhaseSystem/lnInclude \
|
||||||
|
|||||||
@ -24,10 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "kineticTheoryModel.H"
|
#include "kineticTheoryModel.H"
|
||||||
#include "surfaceInterpolate.H"
|
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "twoPhaseSystem.H"
|
#include "twoPhaseSystem.H"
|
||||||
#include "fvcDiv.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,7 +41,7 @@ Foam::kineticTheoryModel::kineticTheoryModel
|
|||||||
const word& type
|
const word& type
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
RASModels::eddyViscosity<PhaseIncompressibleTurbulenceModel<phaseModel> >
|
eddyViscosity<RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> > >
|
||||||
(
|
(
|
||||||
type,
|
type,
|
||||||
alpha,
|
alpha,
|
||||||
@ -517,9 +515,9 @@ bool Foam::kineticTheoryModel::read()
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
RASModels::eddyViscosity
|
eddyViscosity
|
||||||
<
|
<
|
||||||
PhaseIncompressibleTurbulenceModel<phaseModel>
|
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
|
||||||
>::read()
|
>::read()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,11 +34,11 @@ SourceFiles
|
|||||||
#ifndef kineticTheoryModel_H
|
#ifndef kineticTheoryModel_H
|
||||||
#define kineticTheoryModel_H
|
#define kineticTheoryModel_H
|
||||||
|
|
||||||
|
#include "RASModel.H"
|
||||||
#include "eddyViscosity.H"
|
#include "eddyViscosity.H"
|
||||||
#include "PhaseIncompressibleTurbulenceModel.H"
|
#include "PhaseIncompressibleTurbulenceModel.H"
|
||||||
#include "dragModel.H"
|
|
||||||
#include "phaseModel.H"
|
#include "phaseModel.H"
|
||||||
#include "autoPtr.H"
|
#include "dragModel.H"
|
||||||
#include "viscosityModel.H"
|
#include "viscosityModel.H"
|
||||||
#include "conductivityModel.H"
|
#include "conductivityModel.H"
|
||||||
#include "radialModel.H"
|
#include "radialModel.H"
|
||||||
@ -57,9 +57,9 @@ namespace Foam
|
|||||||
|
|
||||||
class kineticTheoryModel
|
class kineticTheoryModel
|
||||||
:
|
:
|
||||||
public RASModels::eddyViscosity
|
public eddyViscosity
|
||||||
<
|
<
|
||||||
PhaseIncompressibleTurbulenceModel<phaseModel>
|
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|||||||
@ -24,13 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "PhaseIncompressibleTurbulenceModel.H"
|
#include "PhaseIncompressibleTurbulenceModel.H"
|
||||||
#include "laminar.H"
|
|
||||||
#include "RASModel.H"
|
|
||||||
#include "kEpsilon.H"
|
|
||||||
#include "LaheyKEpsilon.H"
|
|
||||||
#include "continuousGasKEpsilon.H"
|
|
||||||
#include "kineticTheoryModel.H"
|
|
||||||
#include "phasePressureModel.H"
|
|
||||||
#include "phaseModel.H"
|
#include "phaseModel.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -52,7 +45,13 @@ namespace Foam
|
|||||||
|
|
||||||
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
||||||
incompressibleTransportTurbulenceModel;
|
incompressibleTransportTurbulenceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "laminar.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
typedef laminar<incompressibleTransportTurbulenceModel>
|
typedef laminar<incompressibleTransportTurbulenceModel>
|
||||||
incompressibleLaminar;
|
incompressibleLaminar;
|
||||||
|
|
||||||
@ -64,8 +63,16 @@ namespace Foam
|
|||||||
incompressibleLaminar,
|
incompressibleLaminar,
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "kEpsilon.H"
|
||||||
|
#include "LaheyKEpsilon.H"
|
||||||
|
#include "continuousGasKEpsilon.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||||
incompressibleRASModel;
|
incompressibleRASModel;
|
||||||
|
|
||||||
@ -131,6 +138,8 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "kineticTheoryModel.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
||||||
@ -150,6 +159,8 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "phasePressureModel.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
||||||
@ -169,4 +180,40 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "LESModel.H"
|
||||||
|
#include "Smagorinsky.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef LESModel<incompressibleTransportTurbulenceModel>
|
||||||
|
incompressibleLESModel;
|
||||||
|
|
||||||
|
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
|
||||||
|
|
||||||
|
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
basePhaseIncompressibleTransportTurbulenceModel,
|
||||||
|
incompressibleLESModel,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
|
||||||
|
incompressibleSmagorinsky;
|
||||||
|
|
||||||
|
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
incompressibleLESModel,
|
||||||
|
incompressibleSmagorinsky,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,9 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "phasePressureModel.H"
|
#include "phasePressureModel.H"
|
||||||
#include "surfaceInterpolate.H"
|
|
||||||
#include "twoPhaseSystem.H"
|
#include "twoPhaseSystem.H"
|
||||||
#include "dimensionedType.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ Foam::phasePressureModel::phasePressureModel
|
|||||||
const word& type
|
const word& type
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
RASModels::eddyViscosity<PhaseIncompressibleTurbulenceModel<phaseModel> >
|
eddyViscosity<RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> > >
|
||||||
(
|
(
|
||||||
type,
|
type,
|
||||||
alpha,
|
alpha,
|
||||||
@ -196,9 +194,9 @@ bool Foam::phasePressureModel::read()
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
RASModels::eddyViscosity
|
eddyViscosity
|
||||||
<
|
<
|
||||||
PhaseIncompressibleTurbulenceModel<phaseModel>
|
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
|
||||||
>::read()
|
>::read()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,16 +34,10 @@ SourceFiles
|
|||||||
#ifndef phasePressureModel_H
|
#ifndef phasePressureModel_H
|
||||||
#define phasePressureModel_H
|
#define phasePressureModel_H
|
||||||
|
|
||||||
|
#include "RASModel.H"
|
||||||
#include "eddyViscosity.H"
|
#include "eddyViscosity.H"
|
||||||
#include "PhaseIncompressibleTurbulenceModel.H"
|
#include "PhaseIncompressibleTurbulenceModel.H"
|
||||||
#include "dragModel.H"
|
|
||||||
#include "phaseModel.H"
|
#include "phaseModel.H"
|
||||||
#include "autoPtr.H"
|
|
||||||
#include "viscosityModel.H"
|
|
||||||
#include "conductivityModel.H"
|
|
||||||
#include "radialModel.H"
|
|
||||||
#include "granularPressureModel.H"
|
|
||||||
#include "frictionalStressModel.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -57,9 +51,9 @@ namespace Foam
|
|||||||
|
|
||||||
class phasePressureModel
|
class phasePressureModel
|
||||||
:
|
:
|
||||||
public RASModels::eddyViscosity
|
public eddyViscosity
|
||||||
<
|
<
|
||||||
PhaseIncompressibleTurbulenceModel<phaseModel>
|
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels \
|
-I$(LIB_SRC)/transportModels \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||||
|
|||||||
@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory
|
|||||||
makeType=${1:-libso}
|
makeType=${1:-libso}
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
wmake libso turbulenceModel
|
wmake libso turbulenceModels
|
||||||
wmake libso incompressible
|
wmake libso incompressible
|
||||||
wmake libso compressible
|
wmake libso compressible
|
||||||
wmakeLnInclude phaseIncompressible
|
wmakeLnInclude phaseIncompressible
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I../turbulenceModel/lnInclude \
|
-I../turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
@ -9,4 +9,5 @@ LIB_LIBS = \
|
|||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lfluidThermophysicalModels \
|
-lfluidThermophysicalModels \
|
||||||
|
-lturbulenceModels \
|
||||||
-lspecie
|
-lspecie
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I../turbulenceModel/lnInclude \
|
-I../turbulenceModels/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lincompressibleTransportModels \
|
-lincompressibleTransportModels \
|
||||||
|
-lturbulenceModels \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools
|
-lmeshTools
|
||||||
|
|||||||
@ -24,9 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "IncompressibleTurbulenceModel.H"
|
#include "IncompressibleTurbulenceModel.H"
|
||||||
#include "laminar.H"
|
|
||||||
#include "RASModel.H"
|
|
||||||
#include "kEpsilon.H"
|
|
||||||
#include "transportModel.H"
|
#include "transportModel.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -50,7 +47,13 @@ namespace Foam
|
|||||||
<
|
<
|
||||||
transportModel
|
transportModel
|
||||||
> incompressibleTransportTurbulenceModel;
|
> incompressibleTransportTurbulenceModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "laminar.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
typedef laminar<incompressibleTransportTurbulenceModel>
|
typedef laminar<incompressibleTransportTurbulenceModel>
|
||||||
incompressibleLaminar;
|
incompressibleLaminar;
|
||||||
|
|
||||||
@ -62,8 +65,15 @@ namespace Foam
|
|||||||
incompressibleLaminar,
|
incompressibleLaminar,
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "RASModel.H"
|
||||||
|
#include "kEpsilon.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||||
incompressibleRASModel;
|
incompressibleRASModel;
|
||||||
|
|
||||||
@ -95,4 +105,40 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "LESModel.H"
|
||||||
|
#include "Smagorinsky.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef LESModel<incompressibleTransportTurbulenceModel>
|
||||||
|
incompressibleLESModel;
|
||||||
|
|
||||||
|
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
|
||||||
|
|
||||||
|
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
baseIncompressibleTransportTurbulenceModel,
|
||||||
|
incompressibleLESModel,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
|
||||||
|
incompressibleSmagorinsky;
|
||||||
|
|
||||||
|
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
incompressibleLESModel,
|
||||||
|
incompressibleSmagorinsky,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
187
src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C
Normal file
187
src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.C
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "LESModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
void Foam::LESModel<BasicTurbulenceModel>::printCoeffs(const word& type)
|
||||||
|
{
|
||||||
|
if (printCoeffs_)
|
||||||
|
{
|
||||||
|
Info<< type << "Coeffs" << coeffDict_ << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
Foam::LESModel<BasicTurbulenceModel>::LESModel
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const alphaField& alpha,
|
||||||
|
const rhoField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& alphaPhi,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const transportModel& transport,
|
||||||
|
const word& propertiesName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
BasicTurbulenceModel
|
||||||
|
(
|
||||||
|
alpha,
|
||||||
|
rho,
|
||||||
|
U,
|
||||||
|
alphaPhi,
|
||||||
|
phi,
|
||||||
|
transport,
|
||||||
|
propertiesName
|
||||||
|
),
|
||||||
|
|
||||||
|
LESDict_(this->subOrEmptyDict("LES")),
|
||||||
|
turbulence_(LESDict_.lookup("turbulence")),
|
||||||
|
printCoeffs_(LESDict_.lookupOrDefault<Switch>("printCoeffs", false)),
|
||||||
|
coeffDict_(LESDict_.subOrEmptyDict(type + "Coeffs")),
|
||||||
|
|
||||||
|
kMin_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"kMin",
|
||||||
|
LESDict_,
|
||||||
|
SMALL,
|
||||||
|
sqr(dimVelocity)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
delta_(LESdelta::New("delta", U.mesh(), LESDict_))
|
||||||
|
{
|
||||||
|
// Force the construction of the mesh deltaCoeffs which may be needed
|
||||||
|
// for the construction of the derived models and BCs
|
||||||
|
this->mesh_.deltaCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
Foam::autoPtr<Foam::LESModel<BasicTurbulenceModel> >
|
||||||
|
Foam::LESModel<BasicTurbulenceModel>::New
|
||||||
|
(
|
||||||
|
const alphaField& alpha,
|
||||||
|
const rhoField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& alphaPhi,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const transportModel& transport,
|
||||||
|
const word& propertiesName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// get model name, but do not register the dictionary
|
||||||
|
// otherwise it is registered in the database twice
|
||||||
|
const word modelType
|
||||||
|
(
|
||||||
|
IOdictionary
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
IOobject::groupName(propertiesName, U.group()),
|
||||||
|
U.time().constant(),
|
||||||
|
U.db(),
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
).subDict("LES").lookup("LESModel")
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Selecting LES turbulence model " << modelType << endl;
|
||||||
|
|
||||||
|
typename dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(modelType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"LESModel::New"
|
||||||
|
"("
|
||||||
|
"const volScalarField&, "
|
||||||
|
"const volVectorField&, "
|
||||||
|
"const surfaceScalarField&, "
|
||||||
|
"transportModel&, "
|
||||||
|
"const word&"
|
||||||
|
")"
|
||||||
|
) << "Unknown LESModel type "
|
||||||
|
<< modelType << nl << nl
|
||||||
|
<< "Valid LESModel types:" << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<LESModel>
|
||||||
|
(
|
||||||
|
cstrIter()(alpha, rho, U, alphaPhi, phi, transport, propertiesName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
void Foam::LESModel<BasicTurbulenceModel>::correct()
|
||||||
|
{
|
||||||
|
BasicTurbulenceModel::correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
bool Foam::LESModel<BasicTurbulenceModel>::read()
|
||||||
|
{
|
||||||
|
if (turbulenceModel::read())
|
||||||
|
{
|
||||||
|
LESDict_ <<= this->subDict("LES");
|
||||||
|
LESDict_.lookup("turbulence") >> turbulence_;
|
||||||
|
|
||||||
|
if (const dictionary* dictPtr = LESDict_.subDictPtr(type() + "Coeffs"))
|
||||||
|
{
|
||||||
|
coeffDict_ <<= *dictPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
kMin_.readIfPresent(LESDict_);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
239
src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H
Normal file
239
src/TurbulenceModels/turbulenceModels/LES/LESModel/LESModel.H
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
Namespace
|
||||||
|
Foam::LESModels
|
||||||
|
|
||||||
|
Description
|
||||||
|
Namespace for LES SGS models.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::LESModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
Templated abstract base class for LES SGS models
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
LESModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef LESModel_H
|
||||||
|
#define LESModel_H
|
||||||
|
|
||||||
|
#include "TurbulenceModel.H"
|
||||||
|
#include "LESdelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class LESModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
class LESModel
|
||||||
|
:
|
||||||
|
public BasicTurbulenceModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- LES coefficients dictionary
|
||||||
|
dictionary LESDict_;
|
||||||
|
|
||||||
|
//- Turbulence on/off flag
|
||||||
|
Switch turbulence_;
|
||||||
|
|
||||||
|
//- Flag to print the model coeffs at run-time
|
||||||
|
Switch printCoeffs_;
|
||||||
|
|
||||||
|
//- Model coefficients dictionary
|
||||||
|
dictionary coeffDict_;
|
||||||
|
|
||||||
|
//- Lower limit of k
|
||||||
|
dimensionedScalar kMin_;
|
||||||
|
|
||||||
|
//- Run-time selectable delta model
|
||||||
|
autoPtr<Foam::LESdelta> delta_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Print model coefficients
|
||||||
|
virtual void printCoeffs(const word& type);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
LESModel(const LESModel&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const LESModel&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||||
|
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||||
|
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||||
|
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("LES");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
LESModel,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const alphaField& alpha,
|
||||||
|
const rhoField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& alphaPhi,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const transportModel& transport,
|
||||||
|
const word& propertiesName
|
||||||
|
),
|
||||||
|
(alpha, rho, U, alphaPhi, phi, transport, propertiesName)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
LESModel
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const alphaField& alpha,
|
||||||
|
const rhoField& rho,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& alphaPhi,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const transportModel& transport,
|
||||||
|
const word& propertiesName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected LES model
|
||||||
|
static autoPtr<LESModel> New
|
||||||
|
(
|
||||||
|
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 ~LESModel()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Const access to the coefficients dictionary
|
||||||
|
virtual const dictionary& coeffDict() const
|
||||||
|
{
|
||||||
|
return coeffDict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the lower allowable limit for k (default: SMALL)
|
||||||
|
const dimensionedScalar& kMin() const
|
||||||
|
{
|
||||||
|
return kMin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Allow kMin to be changed
|
||||||
|
dimensionedScalar& kMin()
|
||||||
|
{
|
||||||
|
return kMin_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Access function to filter width
|
||||||
|
inline const volScalarField& delta() const
|
||||||
|
{
|
||||||
|
return delta_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the effective viscosity
|
||||||
|
virtual tmp<volScalarField> nuEff() const
|
||||||
|
{
|
||||||
|
return tmp<volScalarField>
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject::groupName("nuEff", this->U_.group()),
|
||||||
|
this->nut() + this->nu()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the effective viscosity on patch
|
||||||
|
virtual tmp<scalarField> nuEff(const label patchi) const
|
||||||
|
{
|
||||||
|
return this->nut(patchi) + this->nu(patchi);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read LESProperties dictionary
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "LESModel.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 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 "LESdelta.H"
|
||||||
|
#include "calculatedFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(LESdelta, 0);
|
||||||
|
defineRunTimeSelectionTable(LESdelta, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::LESdelta::LESdelta(const word& name, const fvMesh& mesh)
|
||||||
|
:
|
||||||
|
mesh_(mesh),
|
||||||
|
delta_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name,
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar(name, dimLength, SMALL),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word deltaType(dict.lookup("delta"));
|
||||||
|
|
||||||
|
Info<< "Selecting LES delta type " << deltaType << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(deltaType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"LESdelta::New(const fvMesh&, const dictionary&)"
|
||||||
|
) << "Unknown LESdelta type "
|
||||||
|
<< deltaType << nl << nl
|
||||||
|
<< "Valid LESdelta types are :" << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict,
|
||||||
|
const dictionaryConstructorTable& additionalConstructors
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word deltaType(dict.lookup("delta"));
|
||||||
|
|
||||||
|
Info<< "Selecting LES delta type " << deltaType << endl;
|
||||||
|
|
||||||
|
// First on additional ones
|
||||||
|
dictionaryConstructorTable::const_iterator cstrIter =
|
||||||
|
additionalConstructors.find(deltaType);
|
||||||
|
|
||||||
|
if (cstrIter != additionalConstructors.end())
|
||||||
|
{
|
||||||
|
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dictionaryConstructorTable::const_iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(deltaType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"LESdelta::New(const fvMesh&, const dictionary&)"
|
||||||
|
) << "Unknown LESdelta type "
|
||||||
|
<< deltaType << nl << nl
|
||||||
|
<< "Valid LESdelta types are :" << endl
|
||||||
|
<< additionalConstructors.sortedToc()
|
||||||
|
<< " and "
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
return autoPtr<LESdelta>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,160 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 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::LESdelta
|
||||||
|
|
||||||
|
Description
|
||||||
|
Abstract base class for LES deltas
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
LESdelta.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef LESdelta_H
|
||||||
|
#define LESdelta_H
|
||||||
|
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class fvMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class LESdelta Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class LESdelta
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
volScalarField delta_;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
// Disallow default bitwise copy construct and assignment
|
||||||
|
LESdelta(const LESdelta&);
|
||||||
|
void operator=(const LESdelta&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("LESdelta");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
LESdelta,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& LESdeltaDict
|
||||||
|
),
|
||||||
|
(name, mesh, LESdeltaDict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name and mesh
|
||||||
|
LESdelta(const word& name, const fvMesh&);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected LES delta
|
||||||
|
static autoPtr<LESdelta> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return a reference to the selected LES delta
|
||||||
|
static autoPtr<LESdelta> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh&,
|
||||||
|
const dictionary&,
|
||||||
|
const dictionaryConstructorTable&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~LESdelta()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return mesh reference
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the LESdelta dictionary
|
||||||
|
virtual void read(const dictionary&) = 0;
|
||||||
|
|
||||||
|
// Correct values
|
||||||
|
virtual void correct() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
virtual operator const volScalarField&() const
|
||||||
|
{
|
||||||
|
return delta_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "PrandtlDelta.H"
|
||||||
|
#include "wallDist.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(PrandtlDelta, 0);
|
||||||
|
addToRunTimeSelectionTable(LESdelta, PrandtlDelta, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::PrandtlDelta::calcDelta()
|
||||||
|
{
|
||||||
|
delta_ = min
|
||||||
|
(
|
||||||
|
static_cast<const volScalarField&>(geometricDelta_()),
|
||||||
|
(kappa_/Cdelta_)*wallDist(mesh_).y()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::PrandtlDelta::PrandtlDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESdelta(name, mesh),
|
||||||
|
geometricDelta_(LESdelta::New(name, mesh, dict.subDict(type() + "Coeffs"))),
|
||||||
|
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||||
|
Cdelta_
|
||||||
|
(
|
||||||
|
dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cdelta", 0.158)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::PrandtlDelta::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
const dictionary& coeffDict(dict.subDict(type() + "Coeffs"));
|
||||||
|
|
||||||
|
geometricDelta_().read(coeffDict);
|
||||||
|
dict.readIfPresent<scalar>("kappa", kappa_);
|
||||||
|
coeffDict.readIfPresent<scalar>("Cdelta", Cdelta_);
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::PrandtlDelta::correct()
|
||||||
|
{
|
||||||
|
geometricDelta_().correct();
|
||||||
|
|
||||||
|
if (mesh_.changing())
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::PrandtlDelta
|
||||||
|
|
||||||
|
Description
|
||||||
|
Simple cube-root of cell volume delta used in LES models.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
PrandtlDelta.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef PrandtlDelta_H
|
||||||
|
#define PrandtlDelta_H
|
||||||
|
|
||||||
|
#include "LESdelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class PrandtlDelta Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class PrandtlDelta
|
||||||
|
:
|
||||||
|
public LESdelta
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
autoPtr<LESdelta> geometricDelta_;
|
||||||
|
scalar kappa_;
|
||||||
|
scalar Cdelta_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
PrandtlDelta(const PrandtlDelta&);
|
||||||
|
void operator=(const PrandtlDelta&);
|
||||||
|
|
||||||
|
// Calculate the delta values
|
||||||
|
void calcDelta();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("Prandtl");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name, mesh and IOdictionary
|
||||||
|
PrandtlDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~PrandtlDelta()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESdelta dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
// Correct values
|
||||||
|
virtual void correct();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "cubeRootVolDelta.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(cubeRootVolDelta, 0);
|
||||||
|
addToRunTimeSelectionTable(LESdelta, cubeRootVolDelta, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cubeRootVolDelta::calcDelta()
|
||||||
|
{
|
||||||
|
label nD = mesh().nGeometricD();
|
||||||
|
|
||||||
|
if (nD == 3)
|
||||||
|
{
|
||||||
|
delta_.internalField() = deltaCoeff_*pow(mesh().V(), 1.0/3.0);
|
||||||
|
}
|
||||||
|
else if (nD == 2)
|
||||||
|
{
|
||||||
|
WarningIn("cubeRootVolDelta::calcDelta()")
|
||||||
|
<< "Case is 2D, LES is not strictly applicable\n"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
const Vector<label>& directions = mesh().geometricD();
|
||||||
|
|
||||||
|
scalar thickness = 0.0;
|
||||||
|
for (direction dir=0; dir<directions.nComponents; dir++)
|
||||||
|
{
|
||||||
|
if (directions[dir] == -1)
|
||||||
|
{
|
||||||
|
thickness = mesh().bounds().span()[dir];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delta_.internalField() = deltaCoeff_*sqrt(mesh().V()/thickness);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn("cubeRootVolDelta::calcDelta()")
|
||||||
|
<< "Case is not 3D or 2D, LES is not applicable"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cubeRootVolDelta::cubeRootVolDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESdelta(name, mesh),
|
||||||
|
deltaCoeff_
|
||||||
|
(
|
||||||
|
dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("deltaCoeff", 1)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cubeRootVolDelta::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.subDict(type() + "Coeffs").readIfPresent<scalar>
|
||||||
|
(
|
||||||
|
"deltaCoeff",
|
||||||
|
deltaCoeff_
|
||||||
|
);
|
||||||
|
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cubeRootVolDelta::correct()
|
||||||
|
{
|
||||||
|
if (mesh_.changing())
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,108 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cubeRootVolDelta
|
||||||
|
|
||||||
|
Description
|
||||||
|
Simple cube-root of cell volume delta used in LES models.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cubeRootVolDelta.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cubeRootVolDelta_H
|
||||||
|
#define cubeRootVolDelta_H
|
||||||
|
|
||||||
|
#include "LESdelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cubeRootVolDelta Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cubeRootVolDelta
|
||||||
|
:
|
||||||
|
public LESdelta
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar deltaCoeff_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
cubeRootVolDelta(const cubeRootVolDelta&);
|
||||||
|
void operator=(const cubeRootVolDelta&);
|
||||||
|
|
||||||
|
// Calculate the delta values
|
||||||
|
void calcDelta();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cubeRootVol");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name, mesh and IOdictionary
|
||||||
|
cubeRootVolDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cubeRootVolDelta()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESdelta dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
// Correct values
|
||||||
|
virtual void correct();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,145 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "maxDeltaxyz.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(maxDeltaxyz, 0);
|
||||||
|
addToRunTimeSelectionTable(LESdelta, maxDeltaxyz, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::maxDeltaxyz::calcDelta()
|
||||||
|
{
|
||||||
|
label nD = mesh().nGeometricD();
|
||||||
|
|
||||||
|
tmp<volScalarField> hmax
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"hmax",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
dimensionedScalar("zrero", dimLength, 0.0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const cellList& cells = mesh().cells();
|
||||||
|
|
||||||
|
forAll(cells,cellI)
|
||||||
|
{
|
||||||
|
scalar deltaMaxTmp = 0.0;
|
||||||
|
const labelList& cFaces = mesh().cells()[cellI];
|
||||||
|
const point& centrevector = mesh().cellCentres()[cellI];
|
||||||
|
|
||||||
|
forAll(cFaces, cFaceI)
|
||||||
|
{
|
||||||
|
label faceI = cFaces[cFaceI];
|
||||||
|
const point& facevector = mesh().faceCentres()[faceI];
|
||||||
|
scalar tmp = mag(facevector - centrevector);
|
||||||
|
if (tmp > deltaMaxTmp)
|
||||||
|
{
|
||||||
|
deltaMaxTmp = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hmax()[cellI] = deltaCoeff_*deltaMaxTmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nD == 3)
|
||||||
|
{
|
||||||
|
delta_.internalField() = hmax();
|
||||||
|
}
|
||||||
|
else if (nD == 2)
|
||||||
|
{
|
||||||
|
WarningIn("maxDeltaxyz::calcDelta()")
|
||||||
|
<< "Case is 2D, LES is not strictly applicable\n"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
delta_.internalField() = hmax();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn("maxDeltaxyz::calcDelta()")
|
||||||
|
<< "Case is not 3D or 2D, LES is not applicable"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::maxDeltaxyz::maxDeltaxyz
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESdelta(name, mesh),
|
||||||
|
deltaCoeff_
|
||||||
|
(
|
||||||
|
dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("deltaCoeff", 1)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::maxDeltaxyz::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.subDict(type() + "Coeffs").readIfPresent<scalar>
|
||||||
|
(
|
||||||
|
"deltaCoeff",
|
||||||
|
deltaCoeff_
|
||||||
|
);
|
||||||
|
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::maxDeltaxyz::correct()
|
||||||
|
{
|
||||||
|
if (mesh_.changing())
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,111 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::maxDeltaxyz
|
||||||
|
|
||||||
|
Description
|
||||||
|
maxDeltaxyz takes the maximum of the three dimensions per cell:
|
||||||
|
max(hx, hy, hz). Valid for structures hexahedral cells only.
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
maxDeltaxyz.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef maxDeltaxyzDelta_H
|
||||||
|
#define maxDeltaxyzDelta_H
|
||||||
|
|
||||||
|
#include "LESdelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class maxDeltaxyz Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class maxDeltaxyz
|
||||||
|
:
|
||||||
|
public LESdelta
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar deltaCoeff_; //
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
maxDeltaxyz(const maxDeltaxyz&);
|
||||||
|
void operator=(const maxDeltaxyz&);
|
||||||
|
|
||||||
|
// Calculate the delta values
|
||||||
|
void calcDelta();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("maxDeltaxyz");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name, mesh and IOdictionary
|
||||||
|
maxDeltaxyz
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~maxDeltaxyz()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESdelta dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
// Correct values
|
||||||
|
virtual void correct();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,192 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "smoothDelta.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "FaceCellWave.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(smoothDelta, 0);
|
||||||
|
addToRunTimeSelectionTable(LESdelta, smoothDelta, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Fill changedFaces (with face labels) and changedFacesInfo (with delta)
|
||||||
|
// This is the initial set of faces from which to start the waves.
|
||||||
|
// Since there might be lots of places with delta jumps we can follow various
|
||||||
|
// strategies for this initial 'seed'.
|
||||||
|
// - start from single cell/face and let FaceCellWave pick up all others
|
||||||
|
// from there. might be quite a few waves before everything settles.
|
||||||
|
// - start from all faces. Lots of initial transfers.
|
||||||
|
// We do something inbetween:
|
||||||
|
// - start from all faces where there is a jump. Since we cannot easily
|
||||||
|
// determine this across coupled patches (cyclic, processor) introduce
|
||||||
|
// all faces of these and let FaceCellWave sort it out.
|
||||||
|
void Foam::smoothDelta::setChangedFaces
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const volScalarField& delta,
|
||||||
|
DynamicList<label>& changedFaces,
|
||||||
|
DynamicList<deltaData>& changedFacesInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
|
{
|
||||||
|
scalar ownDelta = delta[mesh.faceOwner()[faceI]];
|
||||||
|
|
||||||
|
scalar neiDelta = delta[mesh.faceNeighbour()[faceI]];
|
||||||
|
|
||||||
|
// Check if owner delta much larger than neighbour delta or vice versa
|
||||||
|
|
||||||
|
if (ownDelta > maxDeltaRatio_ * neiDelta)
|
||||||
|
{
|
||||||
|
changedFaces.append(faceI);
|
||||||
|
changedFacesInfo.append(deltaData(ownDelta));
|
||||||
|
}
|
||||||
|
else if (neiDelta > maxDeltaRatio_ * ownDelta)
|
||||||
|
{
|
||||||
|
changedFaces.append(faceI);
|
||||||
|
changedFacesInfo.append(deltaData(neiDelta));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert all faces of coupled patches no matter what. Let FaceCellWave
|
||||||
|
// sort it out.
|
||||||
|
forAll(mesh.boundaryMesh(), patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh.boundaryMesh()[patchI];
|
||||||
|
|
||||||
|
if (patch.coupled())
|
||||||
|
{
|
||||||
|
forAll(patch, patchFaceI)
|
||||||
|
{
|
||||||
|
label meshFaceI = patch.start() + patchFaceI;
|
||||||
|
|
||||||
|
scalar ownDelta = delta[mesh.faceOwner()[meshFaceI]];
|
||||||
|
|
||||||
|
changedFaces.append(meshFaceI);
|
||||||
|
changedFacesInfo.append(deltaData(ownDelta));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changedFaces.shrink();
|
||||||
|
changedFacesInfo.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::smoothDelta::calcDelta()
|
||||||
|
{
|
||||||
|
const volScalarField& geometricDelta = geometricDelta_();
|
||||||
|
|
||||||
|
// Fill changed faces with info
|
||||||
|
DynamicList<label> changedFaces(mesh_.nFaces()/100 + 100);
|
||||||
|
DynamicList<deltaData> changedFacesInfo(changedFaces.size());
|
||||||
|
|
||||||
|
setChangedFaces(mesh_, geometricDelta, changedFaces, changedFacesInfo);
|
||||||
|
|
||||||
|
// Set initial field on cells.
|
||||||
|
List<deltaData> cellDeltaData(mesh_.nCells());
|
||||||
|
|
||||||
|
forAll(geometricDelta, cellI)
|
||||||
|
{
|
||||||
|
cellDeltaData[cellI] = geometricDelta[cellI];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set initial field on faces.
|
||||||
|
List<deltaData> faceDeltaData(mesh_.nFaces());
|
||||||
|
|
||||||
|
|
||||||
|
// Propagate information over whole domain.
|
||||||
|
FaceCellWave<deltaData, scalar> deltaCalc
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
changedFaces,
|
||||||
|
changedFacesInfo,
|
||||||
|
faceDeltaData,
|
||||||
|
cellDeltaData,
|
||||||
|
mesh_.globalData().nTotalCells()+1, // max iterations
|
||||||
|
maxDeltaRatio_
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(delta_, cellI)
|
||||||
|
{
|
||||||
|
delta_[cellI] = cellDeltaData[cellI].delta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::smoothDelta::smoothDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESdelta(name, mesh),
|
||||||
|
geometricDelta_
|
||||||
|
(
|
||||||
|
LESdelta::New("geometricDelta", mesh, dict.subDict(type() + "Coeffs"))
|
||||||
|
),
|
||||||
|
maxDeltaRatio_
|
||||||
|
(
|
||||||
|
readScalar(dict.subDict(type() + "Coeffs").lookup("maxDeltaRatio"))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::smoothDelta::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
const dictionary& coeffsDict(dict.subDict(type() + "Coeffs"));
|
||||||
|
|
||||||
|
geometricDelta_().read(coeffsDict);
|
||||||
|
coeffsDict.lookup("maxDeltaRatio") >> maxDeltaRatio_;
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::smoothDelta::correct()
|
||||||
|
{
|
||||||
|
geometricDelta_().correct();
|
||||||
|
|
||||||
|
if (mesh_.changing())
|
||||||
|
{
|
||||||
|
calcDelta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,290 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2012 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::smoothDelta
|
||||||
|
|
||||||
|
Description
|
||||||
|
Smoothed delta which takes a given simple geometric delta and applies
|
||||||
|
smoothing to it such that the ratio of deltas between two cells is no
|
||||||
|
larger than a specified amount, typically 1.15.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
smoothDelta.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef smoothDelta_H
|
||||||
|
#define smoothDelta_H
|
||||||
|
|
||||||
|
#include "LESdelta.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class smoothDelta Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class smoothDelta
|
||||||
|
:
|
||||||
|
public LESdelta
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Public member class used by mesh-wave to propagate the delta-ratio
|
||||||
|
class deltaData
|
||||||
|
{
|
||||||
|
scalar delta_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update. Gets information from neighbouring face/cell and
|
||||||
|
// uses this to update itself (if necessary) and return true.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool update
|
||||||
|
(
|
||||||
|
const deltaData& w2,
|
||||||
|
const scalar scale,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline deltaData();
|
||||||
|
|
||||||
|
//- Construct from delta value
|
||||||
|
inline deltaData(const scalar delta);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
scalar delta() const
|
||||||
|
{
|
||||||
|
return delta_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Needed by FaceCellWave
|
||||||
|
|
||||||
|
//- Check whether origin has been changed at all or
|
||||||
|
// still contains original (invalid) value.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool valid(TrackingData& td) const;
|
||||||
|
|
||||||
|
//- Check for identical geometrical data.
|
||||||
|
// Used for cyclics checking.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool sameGeometry
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const deltaData&,
|
||||||
|
const scalar,
|
||||||
|
TrackingData& td
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Convert any absolute coordinates into relative to
|
||||||
|
// (patch)face centre
|
||||||
|
template<class TrackingData>
|
||||||
|
inline void leaveDomain
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const polyPatch&,
|
||||||
|
const label patchFaceI,
|
||||||
|
const point& faceCentre,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reverse of leaveDomain
|
||||||
|
template<class TrackingData>
|
||||||
|
inline void enterDomain
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const polyPatch&,
|
||||||
|
const label patchFaceI,
|
||||||
|
const point& faceCentre,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Apply rotation matrix to any coordinates
|
||||||
|
template<class TrackingData>
|
||||||
|
inline void transform
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const tensor&,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Influence of neighbouring face.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool updateCell
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const label thisCellI,
|
||||||
|
const label neighbourFaceI,
|
||||||
|
const deltaData& neighbourInfo,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Influence of neighbouring cell.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool updateFace
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const label thisFaceI,
|
||||||
|
const label neighbourCellI,
|
||||||
|
const deltaData& neighbourInfo,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Influence of different value on same face.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool updateFace
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const label thisFaceI,
|
||||||
|
const deltaData& neighbourInfo,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Same (like operator==)
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool equal(const deltaData&, TrackingData& td) const;
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
// Needed for List IO
|
||||||
|
inline bool operator==(const deltaData&) const;
|
||||||
|
|
||||||
|
inline bool operator!=(const deltaData&) const;
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
friend Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream& os,
|
||||||
|
const deltaData& wDist
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return os << wDist.delta_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend Istream& operator>>(Istream& is, deltaData& wDist)
|
||||||
|
{
|
||||||
|
return is >> wDist.delta_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
autoPtr<LESdelta> geometricDelta_;
|
||||||
|
scalar maxDeltaRatio_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
smoothDelta(const smoothDelta&);
|
||||||
|
void operator=(const smoothDelta&);
|
||||||
|
|
||||||
|
// Calculate the delta values
|
||||||
|
void calcDelta();
|
||||||
|
|
||||||
|
|
||||||
|
void setChangedFaces
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const volScalarField& delta,
|
||||||
|
DynamicList<label>& changedFaces,
|
||||||
|
DynamicList<deltaData>& changedFacesInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("smooth");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from name, mesh and IOdictionary
|
||||||
|
smoothDelta
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~smoothDelta()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESdelta dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
// Correct values
|
||||||
|
virtual void correct();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Data associated with deltaData type are contiguous
|
||||||
|
template<>
|
||||||
|
inline bool contiguous<smoothDelta::deltaData>()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "smoothDeltaDeltaDataI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,227 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Update this with w2 if applicable
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::update
|
||||||
|
(
|
||||||
|
const smoothDelta::deltaData& w2,
|
||||||
|
const scalar scale,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!valid(td) || (delta_ < VSMALL))
|
||||||
|
{
|
||||||
|
// My delta not set. Take over neighbour.
|
||||||
|
delta_ = w2.delta()/scale;
|
||||||
|
|
||||||
|
// Something changed. Let caller know.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (w2.delta() > (1 + tol)*scale*delta_)
|
||||||
|
{
|
||||||
|
// Neighbour is too big for me. Up my delta.
|
||||||
|
delta_ = w2.delta()/scale;
|
||||||
|
|
||||||
|
// Something changed. Let caller know.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Neighbour is not too big for me or change is too small
|
||||||
|
// Nothing changed.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Null constructor
|
||||||
|
inline smoothDelta::deltaData::deltaData()
|
||||||
|
:
|
||||||
|
delta_(-GREAT)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Construct from components
|
||||||
|
inline smoothDelta::deltaData::deltaData(const scalar delta)
|
||||||
|
:
|
||||||
|
delta_(delta)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::valid(TrackingData& td) const
|
||||||
|
{
|
||||||
|
return delta_ > -SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Checks for cyclic faces
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::sameGeometry
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const deltaData&,
|
||||||
|
const scalar,
|
||||||
|
TrackingData& td
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class TrackingData>
|
||||||
|
inline void smoothDelta::deltaData::leaveDomain
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const polyPatch&,
|
||||||
|
const label,
|
||||||
|
const point&,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class TrackingData>
|
||||||
|
inline void smoothDelta::deltaData::transform
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const tensor&,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Update absolute geometric quantities.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline void smoothDelta::deltaData::enterDomain
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const polyPatch&,
|
||||||
|
const label,
|
||||||
|
const point&,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Update this (cellI) with face information.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::updateCell
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const label,
|
||||||
|
const label,
|
||||||
|
const deltaData& neighbourWallInfo,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Take over info from face if more than deltaRatio larger.
|
||||||
|
return update(neighbourWallInfo, td, tol, td);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update this (face) with cell information.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::updateFace
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const label,
|
||||||
|
const label,
|
||||||
|
const deltaData& neighbourWallInfo,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Take over information from cell without any scaling (scale = 1.0)
|
||||||
|
return update(neighbourWallInfo, 1.0, tol, td);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update this (face) with coupled face information.
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::updateFace
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const label,
|
||||||
|
const deltaData& neighbourWallInfo,
|
||||||
|
const scalar tol,
|
||||||
|
TrackingData& td
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Take over information from coupled face without any scaling (scale = 1.0)
|
||||||
|
return update(neighbourWallInfo, 1.0, tol, td);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class TrackingData>
|
||||||
|
inline bool smoothDelta::deltaData::equal
|
||||||
|
(
|
||||||
|
const deltaData& rhs,
|
||||||
|
TrackingData& td
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return operator==(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline bool smoothDelta::deltaData::operator==
|
||||||
|
(
|
||||||
|
const deltaData& rhs
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return delta_ == rhs.delta();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool smoothDelta::deltaData::operator!=
|
||||||
|
(
|
||||||
|
const deltaData& rhs
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return !(*this == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "error.H"
|
||||||
|
#include "LESfilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(LESfilter, 0);
|
||||||
|
defineRunTimeSelectionTable(LESfilter, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::LESfilter> Foam::LESfilter::New
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word filterType(dict.lookup("filter"));
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(filterType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"LESfilter::New(const fvMesh&, const dictionary&)"
|
||||||
|
) << "Unknown LESfilter type "
|
||||||
|
<< filterType << nl << nl
|
||||||
|
<< "Valid LESfilter types are :" << endl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<LESfilter>(cstrIter()(mesh, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,158 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::LESfilter
|
||||||
|
|
||||||
|
Description
|
||||||
|
Abstract class for LES filters
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
LESfilter.C
|
||||||
|
newFilter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef LESfilter_H
|
||||||
|
#define LESfilter_H
|
||||||
|
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class fvMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class LESfilter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class LESfilter
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
// Disallow default bitwise copy construct and assignment
|
||||||
|
LESfilter(const LESfilter&);
|
||||||
|
void operator=(const LESfilter&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("LESfilter");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
LESfilter,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& LESfilterDict
|
||||||
|
),
|
||||||
|
(mesh, LESfilterDict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
LESfilter(const fvMesh& mesh)
|
||||||
|
:
|
||||||
|
mesh_(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected LES filter
|
||||||
|
static autoPtr<LESfilter> New
|
||||||
|
(
|
||||||
|
const fvMesh&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~LESfilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return mesh reference
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the LESfilter dictionary
|
||||||
|
virtual void read(const dictionary&) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
virtual tmp<volScalarField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>&
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
virtual tmp<volVectorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>&
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
virtual tmp<volSymmTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>&
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
virtual tmp<volTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>&
|
||||||
|
) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,239 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "anisotropicFilter.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "zeroGradientFvPatchFields.H"
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(anisotropicFilter, 0);
|
||||||
|
addToRunTimeSelectionTable(LESfilter, anisotropicFilter, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::anisotropicFilter::anisotropicFilter
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
scalar widthCoeff
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESfilter(mesh),
|
||||||
|
widthCoeff_(widthCoeff),
|
||||||
|
coeff_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"anisotropicFilterCoeff",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedVector("zero", dimLength*dimLength, vector::zero),
|
||||||
|
calculatedFvPatchVectorField::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (direction d=0; d<vector::nComponents; d++)
|
||||||
|
{
|
||||||
|
coeff_.internalField().replace
|
||||||
|
(
|
||||||
|
d,
|
||||||
|
(1/widthCoeff_)*
|
||||||
|
sqr
|
||||||
|
(
|
||||||
|
2.0*mesh.V()
|
||||||
|
/fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::anisotropicFilter::anisotropicFilter
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const dictionary& bd
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESfilter(mesh),
|
||||||
|
widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))),
|
||||||
|
coeff_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"anisotropicFilterCoeff",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedVector("zero", dimLength*dimLength, vector::zero),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (direction d=0; d<vector::nComponents; d++)
|
||||||
|
{
|
||||||
|
coeff_.internalField().replace
|
||||||
|
(
|
||||||
|
d,
|
||||||
|
(1/widthCoeff_)*
|
||||||
|
sqr
|
||||||
|
(
|
||||||
|
2.0*mesh.V()
|
||||||
|
/fvc::surfaceSum(mag(mesh.Sf().component(d)))().internalField()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::anisotropicFilter::read(const dictionary& bd)
|
||||||
|
{
|
||||||
|
bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::anisotropicFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tmpFilteredField =
|
||||||
|
unFilteredField
|
||||||
|
+ (
|
||||||
|
coeff_
|
||||||
|
& fvc::surfaceIntegrate
|
||||||
|
(
|
||||||
|
mesh().Sf()
|
||||||
|
*fvc::snGrad(unFilteredField())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return tmpFilteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volVectorField> Foam::anisotropicFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volVectorField> tmpFilteredField =
|
||||||
|
unFilteredField
|
||||||
|
+ (
|
||||||
|
coeff_
|
||||||
|
& fvc::surfaceIntegrate
|
||||||
|
(
|
||||||
|
mesh().Sf()
|
||||||
|
*fvc::snGrad(unFilteredField())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return tmpFilteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volSymmTensorField> tmpFilteredField
|
||||||
|
(
|
||||||
|
new volSymmTensorField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"anisotropicFilteredSymmTensorField",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
unFilteredField().dimensions()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (direction d=0; d<symmTensor::nComponents; d++)
|
||||||
|
{
|
||||||
|
tmpFilteredField().replace
|
||||||
|
(
|
||||||
|
d, anisotropicFilter::operator()(unFilteredField().component(d))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return tmpFilteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volTensorField> tmpFilteredField
|
||||||
|
(
|
||||||
|
new volTensorField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"anisotropicFilteredTensorField",
|
||||||
|
mesh().time().timeName(),
|
||||||
|
mesh()
|
||||||
|
),
|
||||||
|
mesh(),
|
||||||
|
unFilteredField().dimensions()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (direction d=0; d<tensor::nComponents; d++)
|
||||||
|
{
|
||||||
|
tmpFilteredField().replace
|
||||||
|
(
|
||||||
|
d, anisotropicFilter::operator()(unFilteredField().component(d))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return tmpFilteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,131 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::anisotropicFilter
|
||||||
|
|
||||||
|
Description
|
||||||
|
anisotropic filter
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
Kernel as filter as Test filter with ratio 2
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Box filter: g = delta2/24 -> g = delta2/6
|
||||||
|
Spherical box filter: g = delta2/64 -> g = delta2/16
|
||||||
|
Gaussian filter: g = delta2/24 -> g = delta2/6
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
anisotropicFilter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef anisotropicFilter_H
|
||||||
|
#define anisotropicFilter_H
|
||||||
|
|
||||||
|
#include "LESfilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class anisotropicFilter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class anisotropicFilter
|
||||||
|
:
|
||||||
|
public LESfilter
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar widthCoeff_;
|
||||||
|
volVectorField coeff_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
// Disallow default bitwise copy construct and assignment
|
||||||
|
anisotropicFilter(const anisotropicFilter&);
|
||||||
|
void operator=(const anisotropicFilter&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("anisotropic");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
anisotropicFilter(const fvMesh& mesh, scalar widthCoeff);
|
||||||
|
|
||||||
|
//- Construct from IOdictionary
|
||||||
|
anisotropicFilter(const fvMesh& mesh, const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~anisotropicFilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESfilter dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
virtual tmp<volScalarField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volVectorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volSymmTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>&
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "laplaceFilter.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "calculatedFvPatchFields.H"
|
||||||
|
#include "fvm.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(laplaceFilter, 0);
|
||||||
|
addToRunTimeSelectionTable(LESfilter, laplaceFilter, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff)
|
||||||
|
:
|
||||||
|
LESfilter(mesh),
|
||||||
|
widthCoeff_(widthCoeff),
|
||||||
|
coeff_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"laplaceFilterCoeff",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimLength*dimLength, 0),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
coeff_.dimensionedInternalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd)
|
||||||
|
:
|
||||||
|
LESfilter(mesh),
|
||||||
|
widthCoeff_(readScalar(bd.subDict(type() + "Coeffs").lookup("widthCoeff"))),
|
||||||
|
coeff_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"laplaceFilterCoeff",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimLength*dimLength, 0),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
coeff_.dimensionedInternalField() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::laplaceFilter::read(const dictionary& bd)
|
||||||
|
{
|
||||||
|
bd.subDict(type() + "Coeffs").lookup("widthCoeff") >> widthCoeff_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::laplaceFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> filteredField =
|
||||||
|
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volVectorField> Foam::laplaceFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volVectorField> filteredField =
|
||||||
|
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volSymmTensorField> Foam::laplaceFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volSymmTensorField> filteredField =
|
||||||
|
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volTensorField> Foam::laplaceFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volTensorField> filteredField =
|
||||||
|
unFilteredField() + fvc::laplacian(coeff_, unFilteredField());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::laplaceFilter
|
||||||
|
|
||||||
|
Description
|
||||||
|
Laplace filter for LES
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
Kernel as filter as Test filter with ratio 2
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Box filter: g = delta2/24 -> g = delta2/6
|
||||||
|
Spherical box filter: g = delta2/64 -> g = delta2/16
|
||||||
|
Gaussian filter: g = delta2/24 -> g = delta2/6
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
laplaceFilter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef laplaceFilter_H
|
||||||
|
#define laplaceFilter_H
|
||||||
|
|
||||||
|
#include "LESfilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class laplaceFilter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class laplaceFilter
|
||||||
|
:
|
||||||
|
public LESfilter
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
scalar widthCoeff_;
|
||||||
|
volScalarField coeff_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
laplaceFilter(const laplaceFilter&);
|
||||||
|
void operator=(const laplaceFilter&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("laplace");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
laplaceFilter(const fvMesh& mesh, scalar widthCoeff);
|
||||||
|
|
||||||
|
//- Construct from IOdictionary
|
||||||
|
laplaceFilter(const fvMesh& mesh, const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~laplaceFilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESfilter dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
virtual tmp<volScalarField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volVectorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volSymmTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>&
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "simpleFilter.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvc.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(simpleFilter, 0);
|
||||||
|
addToRunTimeSelectionTable(LESfilter, simpleFilter, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::simpleFilter::simpleFilter
|
||||||
|
(
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
LESfilter(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::simpleFilter::simpleFilter(const fvMesh& mesh, const dictionary&)
|
||||||
|
:
|
||||||
|
LESfilter(mesh)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::simpleFilter::read(const dictionary&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField> Foam::simpleFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> filteredField = fvc::surfaceSum
|
||||||
|
(
|
||||||
|
mesh().magSf()*fvc::interpolate(unFilteredField)
|
||||||
|
)/fvc::surfaceSum(mesh().magSf());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volVectorField> Foam::simpleFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volVectorField> filteredField = fvc::surfaceSum
|
||||||
|
(
|
||||||
|
mesh().magSf()*fvc::interpolate(unFilteredField)
|
||||||
|
)/fvc::surfaceSum(mesh().magSf());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volSymmTensorField> Foam::simpleFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volSymmTensorField> filteredField = fvc::surfaceSum
|
||||||
|
(
|
||||||
|
mesh().magSf()*fvc::interpolate(unFilteredField)
|
||||||
|
)/fvc::surfaceSum(mesh().magSf());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volTensorField> Foam::simpleFilter::operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>& unFilteredField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
tmp<volTensorField> filteredField = fvc::surfaceSum
|
||||||
|
(
|
||||||
|
mesh().magSf()*fvc::interpolate(unFilteredField)
|
||||||
|
)/fvc::surfaceSum(mesh().magSf());
|
||||||
|
|
||||||
|
unFilteredField.clear();
|
||||||
|
|
||||||
|
return filteredField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::simpleFilter
|
||||||
|
|
||||||
|
Description
|
||||||
|
Simple top-hat filter used in dynamic LES models.
|
||||||
|
|
||||||
|
Implemented as a surface integral of the face interpolate of the field.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
simpleFilter.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef simpleFilter_H
|
||||||
|
#define simpleFilter_H
|
||||||
|
|
||||||
|
#include "LESfilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class simpleFilter Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class simpleFilter
|
||||||
|
:
|
||||||
|
public LESfilter
|
||||||
|
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct and assignment
|
||||||
|
simpleFilter(const simpleFilter&);
|
||||||
|
void operator=(const simpleFilter&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("simple");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
simpleFilter(const fvMesh& mesh);
|
||||||
|
|
||||||
|
//- Construct from IOdictionary
|
||||||
|
simpleFilter(const fvMesh& mesh, const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~simpleFilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the LESfilter dictionary
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
virtual tmp<volScalarField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volScalarField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volVectorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volVectorField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volSymmTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volSymmTensorField>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
virtual tmp<volTensorField> operator()
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>&
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,168 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "Smagorinsky.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
Smagorinsky<BasicTurbulenceModel>::Smagorinsky
|
||||||
|
(
|
||||||
|
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
|
||||||
|
),
|
||||||
|
|
||||||
|
ck_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"ck",
|
||||||
|
this->coeffDict_,
|
||||||
|
0.02
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
ce_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"ce",
|
||||||
|
this->coeffDict_,
|
||||||
|
1.048
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (type == typeName)
|
||||||
|
{
|
||||||
|
correctNut();
|
||||||
|
this->printCoeffs(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
bool Smagorinsky<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> Smagorinsky<BasicTurbulenceModel>::k
|
||||||
|
(
|
||||||
|
const tmp<volTensorField>& gradU
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
volSymmTensorField D(symm(gradU));
|
||||||
|
|
||||||
|
volScalarField a(ce_/this->delta());
|
||||||
|
volScalarField b((2.0/3.0)*tr(D));
|
||||||
|
volScalarField c(2*ck_*this->delta()*(dev(D) && D));
|
||||||
|
|
||||||
|
return sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
tmp<volScalarField> Smagorinsky<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 Smagorinsky<BasicTurbulenceModel>::correctNut()
|
||||||
|
{
|
||||||
|
volScalarField k(this->k(fvc::grad(this->U_)));
|
||||||
|
|
||||||
|
this->nut_ = ck_*this->delta()*sqrt(k);
|
||||||
|
this->nut_.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
void Smagorinsky<BasicTurbulenceModel>::correct()
|
||||||
|
{
|
||||||
|
eddyViscosity<LESModel<BasicTurbulenceModel> >::correct();
|
||||||
|
correctNut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace LESModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,168 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::Smagorinsky
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpLESTurbulence
|
||||||
|
|
||||||
|
Description
|
||||||
|
The Smagorinsky Model.
|
||||||
|
|
||||||
|
Algebraic eddy viscosity SGS model founded on the assumption that
|
||||||
|
local equilibrium prevails.
|
||||||
|
Thus,
|
||||||
|
\verbatim
|
||||||
|
|
||||||
|
B = 2/3*k*I - 2*nuSgs*dev(D)
|
||||||
|
|
||||||
|
where
|
||||||
|
|
||||||
|
D = symm(grad(U));
|
||||||
|
k from D:B + ce*k^3/2/delta = 0
|
||||||
|
nuSgs = ck*sqrt(k)*delta
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
Smagorinsky.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Smagorinsky_H
|
||||||
|
#define Smagorinsky_H
|
||||||
|
|
||||||
|
#include "LESModel.H"
|
||||||
|
#include "eddyViscosity.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace LESModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class Smagorinsky Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class BasicTurbulenceModel>
|
||||||
|
class Smagorinsky
|
||||||
|
:
|
||||||
|
public eddyViscosity<LESModel<BasicTurbulenceModel> >
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
dimensionedScalar ck_;
|
||||||
|
dimensionedScalar ce_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update sub-grid scale fields
|
||||||
|
void updateSubGridScaleFields(const volTensorField& gradU);
|
||||||
|
|
||||||
|
// Disallow default bitwise copy construct and assignment
|
||||||
|
Smagorinsky(const Smagorinsky&);
|
||||||
|
Smagorinsky& operator=(const Smagorinsky&);
|
||||||
|
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
|
//- Return SGS kinetic energy
|
||||||
|
// calculated from the given velocity gradient
|
||||||
|
tmp<volScalarField> k(const tmp<volTensorField>& gradU) const;
|
||||||
|
|
||||||
|
virtual void correctNut();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||||
|
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||||
|
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||||
|
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("Smagorinsky");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
Smagorinsky
|
||||||
|
(
|
||||||
|
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 ~Smagorinsky()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return SGS kinetic energy
|
||||||
|
virtual tmp<volScalarField> k() const
|
||||||
|
{
|
||||||
|
return k(fvc::grad(this->U_));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return sub-grid disipation rate
|
||||||
|
virtual tmp<volScalarField> epsilon() const;
|
||||||
|
|
||||||
|
//- Correct Eddy-Viscosity and related properties
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Re-read model coefficients if they have changed
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace LESModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "Smagorinsky.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -1,5 +1,21 @@
|
|||||||
turbulenceModel.C
|
turbulenceModel.C
|
||||||
|
|
||||||
|
LESdelta = LES/LESdeltas
|
||||||
|
|
||||||
|
$(LESdelta)/LESdelta/LESdelta.C
|
||||||
|
$(LESdelta)/cubeRootVolDelta/cubeRootVolDelta.C
|
||||||
|
$(LESdelta)/PrandtlDelta/PrandtlDelta.C
|
||||||
|
$(LESdelta)/smoothDelta/smoothDelta.C
|
||||||
|
$(LESdelta)/maxDeltaxyz/maxDeltaxyz.C
|
||||||
|
|
||||||
|
LESfilters = LES/LESfilters
|
||||||
|
|
||||||
|
$(LESfilters)/LESfilter/LESfilter.C
|
||||||
|
$(LESfilters)/simpleFilter/simpleFilter.C
|
||||||
|
$(LESfilters)/laplaceFilter/laplaceFilter.C
|
||||||
|
$(LESfilters)/anisotropicFilter/anisotropicFilter.C
|
||||||
|
|
||||||
|
|
||||||
derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
|
derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
|
||||||
derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C
|
derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C
|
||||||
|
|
||||||
@ -44,6 +60,4 @@ RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLeng
|
|||||||
RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
|
RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
|
||||||
RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
|
RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
/* backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C */
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libturbulenceModels
|
LIB = $(FOAM_LIBBIN)/libturbulenceModels
|
||||||
@ -68,14 +68,39 @@ Foam::RASModel<BasicTurbulenceModel>::RASModel
|
|||||||
printCoeffs_(RASDict_.lookupOrDefault<Switch>("printCoeffs", false)),
|
printCoeffs_(RASDict_.lookupOrDefault<Switch>("printCoeffs", false)),
|
||||||
coeffDict_(RASDict_.subOrEmptyDict(type + "Coeffs")),
|
coeffDict_(RASDict_.subOrEmptyDict(type + "Coeffs")),
|
||||||
|
|
||||||
kMin_("kMin", sqr(dimVelocity), SMALL),
|
kMin_
|
||||||
epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
|
(
|
||||||
omegaMin_("omegaMin", dimless/dimTime, SMALL)
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
{
|
(
|
||||||
kMin_.readIfPresent(RASDict_);
|
"kMin",
|
||||||
epsilonMin_.readIfPresent(RASDict_);
|
RASDict_,
|
||||||
omegaMin_.readIfPresent(RASDict_);
|
SMALL,
|
||||||
|
sqr(dimVelocity)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
epsilonMin_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"epsilonMin",
|
||||||
|
RASDict_,
|
||||||
|
SMALL,
|
||||||
|
kMin_.dimensions()/dimTime
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
omegaMin_
|
||||||
|
(
|
||||||
|
dimensioned<scalar>::lookupOrAddToDict
|
||||||
|
(
|
||||||
|
"omegaMin",
|
||||||
|
RASDict_,
|
||||||
|
SMALL,
|
||||||
|
dimless/dimTime
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
// Force the construction of the mesh deltaCoeffs which may be needed
|
// Force the construction of the mesh deltaCoeffs which may be needed
|
||||||
// for the construction of the derived models and BCs
|
// for the construction of the derived models and BCs
|
||||||
this->mesh_.deltaCoeffs();
|
this->mesh_.deltaCoeffs();
|
||||||
@ -42,14 +42,6 @@ SourceFiles
|
|||||||
#define RASModel_H
|
#define RASModel_H
|
||||||
|
|
||||||
#include "TurbulenceModel.H"
|
#include "TurbulenceModel.H"
|
||||||
#include "volFields.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
#include "fvm.H"
|
|
||||||
#include "fvc.H"
|
|
||||||
#include "fvMatrices.H"
|
|
||||||
#include "IOdictionary.H"
|
|
||||||
#include "Switch.H"
|
|
||||||
#include "bound.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -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) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,7 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "kEpsilon.H"
|
#include "kEpsilon.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "bound.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ kEpsilon<BasicTurbulenceModel>::kEpsilon
|
|||||||
const word& type
|
const word& type
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
eddyViscosity<BasicTurbulenceModel>
|
eddyViscosity<RASModel<BasicTurbulenceModel> >
|
||||||
(
|
(
|
||||||
type,
|
type,
|
||||||
alpha,
|
alpha,
|
||||||
@ -156,7 +156,7 @@ kEpsilon<BasicTurbulenceModel>::kEpsilon
|
|||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
bool kEpsilon<BasicTurbulenceModel>::read()
|
bool kEpsilon<BasicTurbulenceModel>::read()
|
||||||
{
|
{
|
||||||
if (eddyViscosity<BasicTurbulenceModel>::read())
|
if (eddyViscosity<RASModel<BasicTurbulenceModel> >::read())
|
||||||
{
|
{
|
||||||
Cmu_.readIfPresent(this->coeffDict());
|
Cmu_.readIfPresent(this->coeffDict());
|
||||||
C1_.readIfPresent(this->coeffDict());
|
C1_.readIfPresent(this->coeffDict());
|
||||||
@ -229,7 +229,7 @@ void kEpsilon<BasicTurbulenceModel>::correct()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
eddyViscosity<BasicTurbulenceModel>::correct();
|
eddyViscosity<RASModel<BasicTurbulenceModel> >::correct();
|
||||||
|
|
||||||
volScalarField divU(fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U)));
|
volScalarField divU(fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U)));
|
||||||
|
|
||||||
@ -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) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -51,6 +51,7 @@ SourceFiles
|
|||||||
#ifndef kEpsilon_H
|
#ifndef kEpsilon_H
|
||||||
#define kEpsilon_H
|
#define kEpsilon_H
|
||||||
|
|
||||||
|
#include "RASModel.H"
|
||||||
#include "eddyViscosity.H"
|
#include "eddyViscosity.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -67,7 +68,7 @@ namespace RASModels
|
|||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
class kEpsilon
|
class kEpsilon
|
||||||
:
|
:
|
||||||
public eddyViscosity<BasicTurbulenceModel>
|
public eddyViscosity<RASModel<BasicTurbulenceModel> >
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -24,19 +24,13 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "eddyViscosity.H"
|
#include "eddyViscosity.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "fvc.H"
|
||||||
|
#include "fvm.H"
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace RASModels
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
eddyViscosity<BasicTurbulenceModel>::eddyViscosity
|
Foam::eddyViscosity<BasicTurbulenceModel>::eddyViscosity
|
||||||
(
|
(
|
||||||
const word& modelName,
|
const word& modelName,
|
||||||
const alphaField& alpha,
|
const alphaField& alpha,
|
||||||
@ -48,7 +42,7 @@ eddyViscosity<BasicTurbulenceModel>::eddyViscosity
|
|||||||
const word& propertiesName
|
const word& propertiesName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
RASModel<BasicTurbulenceModel>
|
BasicTurbulenceModel
|
||||||
(
|
(
|
||||||
modelName,
|
modelName,
|
||||||
alpha,
|
alpha,
|
||||||
@ -78,7 +72,8 @@ eddyViscosity<BasicTurbulenceModel>::eddyViscosity
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
tmp<volSymmTensorField> eddyViscosity<BasicTurbulenceModel>::R() const
|
Foam::tmp<Foam::volSymmTensorField>
|
||||||
|
Foam::eddyViscosity<BasicTurbulenceModel>::R() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tk(k());
|
tmp<volScalarField> tk(k());
|
||||||
|
|
||||||
@ -102,7 +97,8 @@ tmp<volSymmTensorField> eddyViscosity<BasicTurbulenceModel>::R() const
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
tmp<volSymmTensorField> eddyViscosity<BasicTurbulenceModel>::devRhoReff() const
|
Foam::tmp<Foam::volSymmTensorField>
|
||||||
|
Foam::eddyViscosity<BasicTurbulenceModel>::devRhoReff() const
|
||||||
{
|
{
|
||||||
return tmp<volSymmTensorField>
|
return tmp<volSymmTensorField>
|
||||||
(
|
(
|
||||||
@ -124,7 +120,8 @@ tmp<volSymmTensorField> eddyViscosity<BasicTurbulenceModel>::devRhoReff() const
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
tmp<fvVectorMatrix> eddyViscosity<BasicTurbulenceModel>::divDevRhoReff
|
Foam::tmp<Foam::fvVectorMatrix>
|
||||||
|
Foam::eddyViscosity<BasicTurbulenceModel>::divDevRhoReff
|
||||||
(
|
(
|
||||||
volVectorField& U
|
volVectorField& U
|
||||||
) const
|
) const
|
||||||
@ -138,22 +135,17 @@ tmp<fvVectorMatrix> eddyViscosity<BasicTurbulenceModel>::divDevRhoReff
|
|||||||
|
|
||||||
|
|
||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
bool eddyViscosity<BasicTurbulenceModel>::read()
|
bool Foam::eddyViscosity<BasicTurbulenceModel>::read()
|
||||||
{
|
{
|
||||||
return RASModel<BasicTurbulenceModel>::read();
|
return BasicTurbulenceModel::read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
void eddyViscosity<BasicTurbulenceModel>::correct()
|
void Foam::eddyViscosity<BasicTurbulenceModel>::correct()
|
||||||
{
|
{
|
||||||
RASModel<BasicTurbulenceModel>::correct();
|
BasicTurbulenceModel::correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace RASModels
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::RASModels::eddyViscosity
|
Foam::eddyViscosity
|
||||||
|
|
||||||
Group
|
Group
|
||||||
grpRASTurbulence
|
grpRASTurbulence
|
||||||
@ -38,14 +38,10 @@ SourceFiles
|
|||||||
#ifndef eddyViscosity_H
|
#ifndef eddyViscosity_H
|
||||||
#define eddyViscosity_H
|
#define eddyViscosity_H
|
||||||
|
|
||||||
#include "RASModel.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace RASModels
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class eddyViscosity Declaration
|
Class eddyViscosity Declaration
|
||||||
@ -54,7 +50,7 @@ namespace RASModels
|
|||||||
template<class BasicTurbulenceModel>
|
template<class BasicTurbulenceModel>
|
||||||
class eddyViscosity
|
class eddyViscosity
|
||||||
:
|
:
|
||||||
public RASModel<BasicTurbulenceModel>
|
public BasicTurbulenceModel
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -128,14 +124,13 @@ public:
|
|||||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||||
virtual void correct() = 0;
|
virtual void correct() = 0;
|
||||||
|
|
||||||
//- Read RASProperties dictionary
|
//- Re-read model coefficients if they have changed
|
||||||
virtual bool read() = 0;
|
virtual bool read() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace RASModels
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -24,5 +24,21 @@ RAS
|
|||||||
turbulence on;
|
turbulence on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LES
|
||||||
|
{
|
||||||
|
LESModel Smagorinsky;
|
||||||
|
|
||||||
|
turbulence on;
|
||||||
|
|
||||||
|
printCoeffs on;
|
||||||
|
|
||||||
|
delta cubeRootVol;
|
||||||
|
|
||||||
|
cubeRootVolCoeffs
|
||||||
|
{
|
||||||
|
deltaCoeff 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user