mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -64,6 +64,7 @@ wmake $makeType randomProcesses
|
||||
thermophysicalModels/Allwmake $*
|
||||
transportModels/Allwmake $*
|
||||
turbulenceModels/Allwmake $*
|
||||
TurbulenceModels/Allwmake $*
|
||||
wmake $makeType combustionModels
|
||||
regionModels/Allwmake $*
|
||||
lagrangian/Allwmake $*
|
||||
|
||||
12
src/TurbulenceModels/Allwmake
Executable file
12
src/TurbulenceModels/Allwmake
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
makeType=${1:-libso}
|
||||
set -x
|
||||
|
||||
wmake libso turbulenceModel
|
||||
wmake libso incompressible
|
||||
wmake libso compressible
|
||||
wmakeLnInclude phaseIncompressible
|
||||
wmakeLnInclude phaseCompressible
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "CompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::CompressibleTurbulenceModel<TransportModel>::
|
||||
CompressibleTurbulenceModel
|
||||
(
|
||||
const geometricOneField& alpha,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
transportModel
|
||||
>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::autoPtr<Foam::CompressibleTurbulenceModel<TransportModel> >
|
||||
Foam::CompressibleTurbulenceModel<TransportModel>::New
|
||||
(
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
return autoPtr<CompressibleTurbulenceModel>
|
||||
(
|
||||
static_cast<CompressibleTurbulenceModel*>(
|
||||
TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
transportModel
|
||||
>::New
|
||||
(
|
||||
geometricOneField(),
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
).ptr())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,157 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::CompressibleTurbulenceModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for single-phase compressible
|
||||
turbulence models.
|
||||
|
||||
SourceFiles
|
||||
CompressibleTurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CompressibleTurbulenceModel_H
|
||||
#define CompressibleTurbulenceModel_H
|
||||
|
||||
#include "TurbulenceModel.H"
|
||||
#include "compressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CompressibleTurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class TransportModel>
|
||||
class CompressibleTurbulenceModel
|
||||
:
|
||||
public TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef geometricOneField alphaField;
|
||||
typedef volScalarField rhoField;
|
||||
typedef TransportModel transportModel;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct
|
||||
CompressibleTurbulenceModel
|
||||
(
|
||||
const geometricOneField& alpha,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& trasport,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected turbulence model
|
||||
static autoPtr<CompressibleTurbulenceModel> New
|
||||
(
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& trasportModel,
|
||||
const word& propertiesName = turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~CompressibleTurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the laminar dynamic viscosity
|
||||
virtual tmp<volScalarField> mu() const
|
||||
{
|
||||
return this->transport_.mu();
|
||||
}
|
||||
|
||||
//- Return the laminar dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mu(const label patchi) const
|
||||
{
|
||||
return this->transport_.mu(patchi);
|
||||
}
|
||||
|
||||
//- Return the turbulence dynamic viscosity
|
||||
virtual tmp<volScalarField> mut() const
|
||||
{
|
||||
return this->rho_*this->nut();
|
||||
}
|
||||
|
||||
//- Return the turbulence dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mut(const label patchi) const
|
||||
{
|
||||
return this->rho_.boundaryField()[patchi]*this->nut(patchi);
|
||||
}
|
||||
|
||||
//- Return the effective dynamic viscosity
|
||||
virtual tmp<volScalarField> muEff() const
|
||||
{
|
||||
return mut() + mu();
|
||||
}
|
||||
|
||||
//- Return the effective dynamic viscosity on patch
|
||||
virtual tmp<scalarField> muEff(const label patchi) const
|
||||
{
|
||||
return mut(patchi) + mu(patchi);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CompressibleTurbulenceModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
4
src/TurbulenceModels/compressible/Make/files
Normal file
4
src/TurbulenceModels/compressible/Make/files
Normal file
@ -0,0 +1,4 @@
|
||||
compressibleTurbulenceModel.C
|
||||
compressibleTurbulenceModels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModels
|
||||
12
src/TurbulenceModels/compressible/Make/options
Normal file
12
src/TurbulenceModels/compressible/Make/options
Normal file
@ -0,0 +1,12 @@
|
||||
EXE_INC = \
|
||||
-I../turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "compressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(compressibleTurbulenceModel, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibleTurbulenceModel::compressibleTurbulenceModel
|
||||
(
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
turbulenceModel
|
||||
(
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
propertiesName
|
||||
),
|
||||
rho_(rho)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
117
src/TurbulenceModels/compressible/compressibleTurbulenceModel.H
Normal file
117
src/TurbulenceModels/compressible/compressibleTurbulenceModel.H
Normal file
@ -0,0 +1,117 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::compressibleTurbulenceModel
|
||||
|
||||
Description
|
||||
Abstract base class for turbulence models (RAS, LES and laminar).
|
||||
|
||||
SourceFiles
|
||||
compressibleTurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef compressibleTurbulenceModel_H
|
||||
#define compressibleTurbulenceModel_H
|
||||
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class compressibleTurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class compressibleTurbulenceModel
|
||||
:
|
||||
public turbulenceModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const volScalarField& rho_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
compressibleTurbulenceModel(const compressibleTurbulenceModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const compressibleTurbulenceModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressibleTurbulenceModel");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
compressibleTurbulenceModel
|
||||
(
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~compressibleTurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the effective stress tensor including the laminar stress
|
||||
virtual tmp<volSymmTensorField> devRhoReff() const = 0;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "CompressibleTurbulenceModel.H"
|
||||
#include "laminar.H"
|
||||
#include "RASModel.H"
|
||||
#include "kEpsilon.H"
|
||||
#include "fluidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
fluidThermo
|
||||
> baseCompressibleFluidThermoTurbulenceModel;
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
typedef CompressibleTurbulenceModel<fluidThermo>
|
||||
compressibleFluidThermoTurbulenceModel;
|
||||
|
||||
typedef laminar<compressibleFluidThermoTurbulenceModel> compressibleLaminar;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleLaminar, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
compressibleLaminar,
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
typedef RASModel<compressibleFluidThermoTurbulenceModel>
|
||||
compressibleRASModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleRASModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(compressibleRASModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
compressibleRASModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
namespace RASModels
|
||||
{
|
||||
typedef kEpsilon<compressibleFluidThermoTurbulenceModel>
|
||||
compressibleKEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleKEpsilon, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
compressibleRASModel,
|
||||
compressibleKEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "IncompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::IncompressibleTurbulenceModel<TransportModel>::
|
||||
IncompressibleTurbulenceModel
|
||||
(
|
||||
const geometricOneField& alpha,
|
||||
const geometricOneField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& transportModel,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transportModel,
|
||||
propertiesName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::autoPtr<Foam::IncompressibleTurbulenceModel<TransportModel> >
|
||||
Foam::IncompressibleTurbulenceModel<TransportModel>::New
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& transportModel,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
return autoPtr<IncompressibleTurbulenceModel>
|
||||
(
|
||||
static_cast<IncompressibleTurbulenceModel*>(
|
||||
TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>::New
|
||||
(
|
||||
geometricOneField(),
|
||||
geometricOneField(),
|
||||
U,
|
||||
phi,
|
||||
phi,
|
||||
transportModel,
|
||||
propertiesName
|
||||
).ptr())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::IncompressibleTurbulenceModel<TransportModel>::devReff() const
|
||||
{
|
||||
return devRhoReff();
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::IncompressibleTurbulenceModel<TransportModel>::divDevReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
{
|
||||
return divDevRhoReff(U);
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::IncompressibleTurbulenceModel<TransportModel>::
|
||||
devRhoReff() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"IncompressibleTurbulenceModel<TransportModel>::"
|
||||
"devRhoReff()"
|
||||
);
|
||||
|
||||
return devReff();
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::IncompressibleTurbulenceModel<TransportModel>::
|
||||
divDevRhoReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"IncompressibleTurbulenceModel<TransportModel>::"
|
||||
"divDevRhoReff(volVectorField& U)"
|
||||
);
|
||||
|
||||
return divDevReff(U);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,132 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::IncompressibleTurbulenceModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for single-phase incompressible
|
||||
turbulence models.
|
||||
|
||||
SourceFiles
|
||||
IncompressibleTurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IncompressibleTurbulenceModel_H
|
||||
#define IncompressibleTurbulenceModel_H
|
||||
|
||||
#include "TurbulenceModel.H"
|
||||
#include "incompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IncompressibleTurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class TransportModel>
|
||||
class IncompressibleTurbulenceModel
|
||||
:
|
||||
public TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef geometricOneField alphaField;
|
||||
typedef geometricOneField rhoField;
|
||||
typedef TransportModel transportModel;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct
|
||||
IncompressibleTurbulenceModel
|
||||
(
|
||||
const geometricOneField& alpha,
|
||||
const geometricOneField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& trasportModel,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected turbulence model
|
||||
static autoPtr<IncompressibleTurbulenceModel> New
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& trasportModel,
|
||||
const word& propertiesName = turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~IncompressibleTurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the effective stress tensor
|
||||
virtual tmp<volSymmTensorField> devReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
|
||||
|
||||
//- Return the effective stress tensor
|
||||
virtual tmp<volSymmTensorField> devRhoReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "IncompressibleTurbulenceModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
4
src/TurbulenceModels/incompressible/Make/files
Normal file
4
src/TurbulenceModels/incompressible/Make/files
Normal file
@ -0,0 +1,4 @@
|
||||
incompressibleTurbulenceModel.C
|
||||
incompressibleTurbulenceModels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libincompressibleTurbulenceModels
|
||||
10
src/TurbulenceModels/incompressible/Make/options
Normal file
10
src/TurbulenceModels/incompressible/Make/options
Normal file
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I../turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
@ -0,0 +1,99 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "incompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(incompressibleTurbulenceModel, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::incompressibleTurbulenceModel::incompressibleTurbulenceModel
|
||||
(
|
||||
const geometricOneField&,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
turbulenceModel
|
||||
(
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
propertiesName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::incompressibleTurbulenceModel::mu() const
|
||||
{
|
||||
return nu();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::incompressibleTurbulenceModel::mu(const label patchi) const
|
||||
{
|
||||
return nu(patchi);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::incompressibleTurbulenceModel::mut() const
|
||||
{
|
||||
return nut();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::incompressibleTurbulenceModel::mut(const label patchi) const
|
||||
{
|
||||
return nut(patchi);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::incompressibleTurbulenceModel::muEff() const
|
||||
{
|
||||
return nuEff();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::incompressibleTurbulenceModel::muEff(const label patchi) const
|
||||
{
|
||||
return nuEff(patchi);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::incompressibleTurbulenceModel
|
||||
|
||||
Description
|
||||
Abstract base class for turbulence models (RAS, LES and laminar).
|
||||
|
||||
SourceFiles
|
||||
incompressibleTurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef incompressibleTurbulenceModel_H
|
||||
#define incompressibleTurbulenceModel_H
|
||||
|
||||
#include "turbulenceModel.H"
|
||||
#include "geometricOneField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class incompressibleTurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class incompressibleTurbulenceModel
|
||||
:
|
||||
public turbulenceModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
geometricOneField rho_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
incompressibleTurbulenceModel(const incompressibleTurbulenceModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const incompressibleTurbulenceModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("incompressibleTurbulenceModel");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
incompressibleTurbulenceModel
|
||||
(
|
||||
const geometricOneField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~incompressibleTurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the laminar dynamic viscosity
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
|
||||
//- Return the laminar dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mu(const label patchi) const;
|
||||
|
||||
//- Return the turbulence dynamic viscosity
|
||||
virtual tmp<volScalarField> mut() const;
|
||||
|
||||
//- Return the turbulence dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mut(const label patchi) const;
|
||||
|
||||
//- Return the effective dynamic viscosity
|
||||
virtual tmp<volScalarField> muEff() const;
|
||||
|
||||
//- Return the effective dynamic viscosity on patch
|
||||
virtual tmp<scalarField> muEff(const label patchi) const;
|
||||
|
||||
//- Return the effective stress tensor including the laminar stress
|
||||
virtual tmp<volSymmTensorField> devReff() const = 0;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "IncompressibleTurbulenceModel.H"
|
||||
#include "laminar.H"
|
||||
#include "RASModel.H"
|
||||
#include "kEpsilon.H"
|
||||
#include "transportModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef TurbulenceModel
|
||||
<
|
||||
geometricOneField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
transportModel
|
||||
> baseIncompressibleTransportTurbulenceModel;
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
typedef IncompressibleTurbulenceModel
|
||||
<
|
||||
transportModel
|
||||
> incompressibleTransportTurbulenceModel;
|
||||
|
||||
typedef laminar<incompressibleTransportTurbulenceModel>
|
||||
incompressibleLaminar;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleLaminar,
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||
incompressibleRASModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleRASModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
namespace RASModels
|
||||
{
|
||||
typedef kEpsilon<incompressibleTransportTurbulenceModel>
|
||||
incompressibleKEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleKEpsilon, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleRASModel,
|
||||
incompressibleKEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "PhaseCompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::PhaseCompressibleTurbulenceModel<TransportModel>::
|
||||
PhaseCompressibleTurbulenceModel
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
TurbulenceModel
|
||||
<
|
||||
volScalarField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
transportModel
|
||||
>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::autoPtr<Foam::PhaseCompressibleTurbulenceModel<TransportModel> >
|
||||
Foam::PhaseCompressibleTurbulenceModel<TransportModel>::New
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
return autoPtr<PhaseCompressibleTurbulenceModel>
|
||||
(
|
||||
static_cast<PhaseCompressibleTurbulenceModel*>(
|
||||
TurbulenceModel
|
||||
<
|
||||
volScalarField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
transportModel
|
||||
>::New
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
).ptr())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,159 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::PhaseCompressibleTurbulenceModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for multiphase compressible
|
||||
turbulence models.
|
||||
|
||||
SourceFiles
|
||||
PhaseCompressibleTurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PhaseCompressibleTurbulenceModel_H
|
||||
#define PhaseCompressibleTurbulenceModel_H
|
||||
|
||||
#include "TurbulenceModel.H"
|
||||
#include "compressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PhaseCompressibleTurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class TransportModel>
|
||||
class PhaseCompressibleTurbulenceModel
|
||||
:
|
||||
public TurbulenceModel
|
||||
<
|
||||
volScalarField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef volScalarField alphaField;
|
||||
typedef volScalarField rhoField;
|
||||
typedef TransportModel transportModel;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct
|
||||
PhaseCompressibleTurbulenceModel
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& trasport,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected turbulence model
|
||||
static autoPtr<PhaseCompressibleTurbulenceModel> New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& trasportModel,
|
||||
const word& propertiesName = turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PhaseCompressibleTurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the laminar dynamic viscosity
|
||||
virtual tmp<volScalarField> mu() const
|
||||
{
|
||||
return this->transport_.mu();
|
||||
}
|
||||
|
||||
//- Return the laminar dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mu(const label patchi) const
|
||||
{
|
||||
return this->transport_.mu(patchi);
|
||||
}
|
||||
|
||||
//- Return the turbulence dynamic viscosity
|
||||
virtual tmp<volScalarField> mut() const
|
||||
{
|
||||
return this->rho_*this->nut();
|
||||
}
|
||||
|
||||
//- Return the turbulence dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mut(const label patchi) const
|
||||
{
|
||||
return this->rho_.boundaryField()[patchi]*this->nut(patchi);
|
||||
}
|
||||
|
||||
//- Return the effective dynamic viscosity
|
||||
virtual tmp<volScalarField> muEff() const
|
||||
{
|
||||
return mut() + mu();
|
||||
}
|
||||
|
||||
//- Return the effective dynamic viscosity on patch
|
||||
virtual tmp<scalarField> muEff(const label patchi) const
|
||||
{
|
||||
return mut(patchi) + mu(patchi);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "PhaseCompressibleTurbulenceModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "PhaseIncompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::
|
||||
PhaseIncompressibleTurbulenceModel
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const geometricOneField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& transportModel,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
TurbulenceModel
|
||||
<
|
||||
volScalarField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transportModel,
|
||||
propertiesName
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::autoPtr<Foam::PhaseIncompressibleTurbulenceModel<TransportModel> >
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::New
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& transportModel,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
return autoPtr<PhaseIncompressibleTurbulenceModel>
|
||||
(
|
||||
static_cast<PhaseIncompressibleTurbulenceModel*>(
|
||||
TurbulenceModel
|
||||
<
|
||||
volScalarField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>::New
|
||||
(
|
||||
alpha,
|
||||
geometricOneField(),
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transportModel,
|
||||
propertiesName
|
||||
).ptr())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::pPrime() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("pPrime", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("pPrimef", dimPressure, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::pPrimef() const
|
||||
{
|
||||
return tmp<surfaceScalarField>
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("pPrimef", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("pPrimef", dimPressure, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::devReff() const
|
||||
{
|
||||
return devRhoReff();
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::divDevReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
{
|
||||
return divDevRhoReff(U);
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::
|
||||
devRhoReff() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"PhaseIncompressibleTurbulenceModel<TransportModel>::"
|
||||
"devRhoReff()"
|
||||
);
|
||||
|
||||
return devReff();
|
||||
}
|
||||
|
||||
|
||||
template<class TransportModel>
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::
|
||||
divDevRhoReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"PhaseIncompressibleTurbulenceModel<TransportModel>::"
|
||||
"divDevRhoReff(volVectorField& U)"
|
||||
);
|
||||
|
||||
return divDevReff(U);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,142 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::PhaseIncompressibleTurbulenceModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for multiphase incompressible
|
||||
turbulence models.
|
||||
|
||||
SourceFiles
|
||||
PhaseIncompressibleTurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PhaseIncompressibleTurbulenceModel_H
|
||||
#define PhaseIncompressibleTurbulenceModel_H
|
||||
|
||||
#include "TurbulenceModel.H"
|
||||
#include "incompressibleTurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PhaseIncompressibleTurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class TransportModel>
|
||||
class PhaseIncompressibleTurbulenceModel
|
||||
:
|
||||
public TurbulenceModel
|
||||
<
|
||||
volScalarField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
TransportModel
|
||||
>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef volScalarField alphaField;
|
||||
typedef geometricOneField rhoField;
|
||||
typedef TransportModel transportModel;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct
|
||||
PhaseIncompressibleTurbulenceModel
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const geometricOneField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& trasportModel,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected turbulence model
|
||||
static autoPtr<PhaseIncompressibleTurbulenceModel> New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const TransportModel& trasportModel,
|
||||
const word& propertiesName = turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PhaseIncompressibleTurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the phase-pressure'
|
||||
// (derivative of phase-pressure w.r.t. phase-fraction)
|
||||
virtual tmp<volScalarField> pPrime() const;
|
||||
|
||||
//- Return the face-phase-pressure'
|
||||
// (derivative of phase-pressure w.r.t. phase-fraction)
|
||||
virtual tmp<surfaceScalarField> pPrimef() const;
|
||||
|
||||
//- Return the effective stress tensor
|
||||
virtual tmp<volSymmTensorField> devReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
|
||||
|
||||
//- Return the effective stress tensor
|
||||
virtual tmp<volSymmTensorField> devRhoReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "PhaseIncompressibleTurbulenceModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,265 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "LaheyKEpsilon.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "twoPhaseSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
LaheyKEpsilon<BasicTurbulenceModel>::LaheyKEpsilon
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName,
|
||||
const word& type
|
||||
)
|
||||
:
|
||||
kEpsilon<BasicTurbulenceModel>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName,
|
||||
type
|
||||
),
|
||||
|
||||
gasTurbulencePtr_(NULL),
|
||||
|
||||
alphaInversion_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"alphaInversion",
|
||||
this->coeffDict_,
|
||||
0.3
|
||||
)
|
||||
),
|
||||
|
||||
Cp_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"Cp",
|
||||
this->coeffDict_,
|
||||
0.25
|
||||
)
|
||||
),
|
||||
|
||||
Cmub_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"Cmub",
|
||||
this->coeffDict_,
|
||||
0.6
|
||||
)
|
||||
)
|
||||
{
|
||||
if (type == typeName)
|
||||
{
|
||||
correctNut();
|
||||
this->printCoeffs(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool LaheyKEpsilon<BasicTurbulenceModel>::read()
|
||||
{
|
||||
if (kEpsilon<BasicTurbulenceModel>::read())
|
||||
{
|
||||
alphaInversion_.readIfPresent(this->coeffDict());
|
||||
Cp_.readIfPresent(this->coeffDict());
|
||||
Cmub_.readIfPresent(this->coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
const PhaseIncompressibleTurbulenceModel
|
||||
<
|
||||
typename BasicTurbulenceModel::transportModel
|
||||
>&
|
||||
LaheyKEpsilon<BasicTurbulenceModel>::gasTurbulence() const
|
||||
{
|
||||
if (!gasTurbulencePtr_)
|
||||
{
|
||||
const volVectorField& U = this->U_;
|
||||
|
||||
const transportModel& liquid = this->transport();
|
||||
const twoPhaseSystem& fluid = liquid.fluid();
|
||||
const transportModel& gas = fluid.otherPhase(liquid);
|
||||
|
||||
gasTurbulencePtr_ =
|
||||
&U.db()
|
||||
.lookupObject<PhaseIncompressibleTurbulenceModel<transportModel> >
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
gas.name()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return *gasTurbulencePtr_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void LaheyKEpsilon<BasicTurbulenceModel>::correctNut()
|
||||
{
|
||||
const PhaseIncompressibleTurbulenceModel<transportModel>& gasTurbulence =
|
||||
this->gasTurbulence();
|
||||
|
||||
this->nut_ =
|
||||
this->Cmu_*sqr(this->k_)/this->epsilon_
|
||||
+ Cmub_*gasTurbulence.transport().d()*gasTurbulence.alpha()
|
||||
*(mag(this->U_ - gasTurbulence.U()));
|
||||
|
||||
this->nut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volScalarField> LaheyKEpsilon<BasicTurbulenceModel>::bubbleG() const
|
||||
{
|
||||
const PhaseIncompressibleTurbulenceModel<transportModel>& gasTurbulence =
|
||||
this->gasTurbulence();
|
||||
|
||||
const transportModel& liquid = this->transport();
|
||||
const twoPhaseSystem& fluid = liquid.fluid();
|
||||
const transportModel& gas = fluid.otherPhase(liquid);
|
||||
|
||||
volScalarField magUr(mag(this->U_ - gasTurbulence.U()));
|
||||
|
||||
tmp<volScalarField> bubbleG
|
||||
(
|
||||
Cp_
|
||||
*(
|
||||
pow3(magUr)
|
||||
+ pow(fluid.drag(gas).K(magUr)*gas.d()/liquid.rho(), 3.0/4.0)
|
||||
*pow(magUr, 9.0/4.0)
|
||||
)
|
||||
*gas
|
||||
/gas.d()
|
||||
);
|
||||
|
||||
return bubbleG;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volScalarField>
|
||||
LaheyKEpsilon<BasicTurbulenceModel>::phaseTransferCoeff() const
|
||||
{
|
||||
const volVectorField& U = this->U_;
|
||||
const alphaField& alpha = this->alpha_;
|
||||
const rhoField& rho = this->rho_;
|
||||
|
||||
const turbulenceModel& gasTurbulence = this->gasTurbulence();
|
||||
|
||||
return
|
||||
(
|
||||
max(alphaInversion_ - alpha, 0.0)
|
||||
*rho
|
||||
*min(gasTurbulence.epsilon()/gasTurbulence.k(), 1.0/U.time().deltaT())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvScalarMatrix> LaheyKEpsilon<BasicTurbulenceModel>::kSource() const
|
||||
{
|
||||
const alphaField& alpha = this->alpha_;
|
||||
const rhoField& rho = this->rho_;
|
||||
|
||||
const PhaseIncompressibleTurbulenceModel<transportModel>& gasTurbulence =
|
||||
this->gasTurbulence();
|
||||
|
||||
const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
|
||||
|
||||
return
|
||||
alpha*rho*bubbleG()
|
||||
+ phaseTransferCoeff*gasTurbulence.k()
|
||||
- fvm::Sp(phaseTransferCoeff, this->k_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvScalarMatrix> LaheyKEpsilon<BasicTurbulenceModel>::epsilonSource() const
|
||||
{
|
||||
const alphaField& alpha = this->alpha_;
|
||||
const rhoField& rho = this->rho_;
|
||||
|
||||
const PhaseIncompressibleTurbulenceModel<transportModel>& gasTurbulence =
|
||||
this->gasTurbulence();
|
||||
|
||||
const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
|
||||
|
||||
return
|
||||
alpha*rho*this->C2_*this->epsilon_*bubbleG()/this->k_
|
||||
+ phaseTransferCoeff*gasTurbulence.epsilon()
|
||||
- fvm::Sp(phaseTransferCoeff, this->epsilon_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void LaheyKEpsilon<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
kEpsilon<BasicTurbulenceModel>::correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::RASModels::LaheyKEpsilon
|
||||
|
||||
Group
|
||||
grpRASTurbulence
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
LaheyKEpsilon.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef LaheyKEpsilon_H
|
||||
#define LaheyKEpsilon_H
|
||||
|
||||
#include "kEpsilon.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class LaheyKEpsilon Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class LaheyKEpsilon
|
||||
:
|
||||
public kEpsilon<BasicTurbulenceModel>
|
||||
{
|
||||
// Private data
|
||||
|
||||
mutable const PhaseIncompressibleTurbulenceModel
|
||||
<
|
||||
typename BasicTurbulenceModel::transportModel
|
||||
> *gasTurbulencePtr_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Model coefficients
|
||||
|
||||
dimensionedScalar alphaInversion_;
|
||||
dimensionedScalar Cp_;
|
||||
dimensionedScalar Cmub_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
virtual void correctNut();
|
||||
tmp<volScalarField> bubbleG() const;
|
||||
tmp<volScalarField> phaseTransferCoeff() const;
|
||||
virtual tmp<fvScalarMatrix> kSource() const;
|
||||
virtual tmp<fvScalarMatrix> epsilonSource() const;
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("LaheyKEpsilon");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
LaheyKEpsilon
|
||||
(
|
||||
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 ~LaheyKEpsilon()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the turbulence model for the gas phase
|
||||
const PhaseIncompressibleTurbulenceModel<transportModel>&
|
||||
gasTurbulence() const;
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
virtual void correct();
|
||||
|
||||
//- Read RASProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "LaheyKEpsilon.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,280 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "continuousGasKEpsilon.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::continuousGasKEpsilon
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName,
|
||||
const word& type
|
||||
)
|
||||
:
|
||||
kEpsilon<BasicTurbulenceModel>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName,
|
||||
type
|
||||
),
|
||||
|
||||
liquidTurbulencePtr_(NULL),
|
||||
|
||||
nutEff_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("nutEff", U.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->nut_
|
||||
),
|
||||
|
||||
alphaInversion_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"alphaInversion",
|
||||
this->coeffDict_,
|
||||
0.7
|
||||
)
|
||||
)
|
||||
{
|
||||
if (type == typeName)
|
||||
{
|
||||
kEpsilon<BasicTurbulenceModel>::correctNut();
|
||||
this->printCoeffs(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool continuousGasKEpsilon<BasicTurbulenceModel>::read()
|
||||
{
|
||||
if (kEpsilon<BasicTurbulenceModel>::read())
|
||||
{
|
||||
alphaInversion_.readIfPresent(this->coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void continuousGasKEpsilon<BasicTurbulenceModel>::correctNut()
|
||||
{
|
||||
kEpsilon<BasicTurbulenceModel>::correctNut();
|
||||
|
||||
const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
|
||||
const transportModel& gas = this->transport();
|
||||
const twoPhaseSystem& fluid = gas.fluid();
|
||||
const transportModel& liquid = fluid.otherPhase(gas);
|
||||
|
||||
volScalarField thetal(liquidTurbulence.k()/liquidTurbulence.epsilon());
|
||||
volScalarField thetag((1.0/(18*liquid.nu()))*sqr(gas.d()));
|
||||
volScalarField expThetar(exp(min(thetal/thetag, 50.0)));
|
||||
volScalarField omega(sqr(expThetar - 1)/(sqr(expThetar) - 1));
|
||||
|
||||
nutEff_ = omega*liquidTurbulence.nut();
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
const turbulenceModel&
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::liquidTurbulence() const
|
||||
{
|
||||
if (!liquidTurbulencePtr_)
|
||||
{
|
||||
const volVectorField& U = this->U_;
|
||||
|
||||
const transportModel& gas = this->transport();
|
||||
const twoPhaseSystem& fluid = gas.fluid();
|
||||
const transportModel& liquid = fluid.otherPhase(gas);
|
||||
|
||||
liquidTurbulencePtr_ =
|
||||
&U.db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
liquid.name()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return *liquidTurbulencePtr_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<Foam::volScalarField>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::nuEff() const
|
||||
{
|
||||
volScalarField blend
|
||||
(
|
||||
max(min((this->alpha_ - 0.5)/(alphaInversion_ - 0.5), 1.0), 0.0)
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject::groupName("nuEff", this->U_.group()),
|
||||
blend*this->nut_
|
||||
+ (1.0 - blend)*rhoEff()*nutEff_/this->transport().rho()
|
||||
+ this->nu()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<Foam::volScalarField>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::rhoEff() const
|
||||
{
|
||||
const transportModel& gas = this->transport();
|
||||
const twoPhaseSystem& fluid = gas.fluid();
|
||||
const transportModel& liquid = fluid.otherPhase(gas);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject::groupName("rhoEff", this->U_.group()),
|
||||
gas.rho() + (fluid.Cvm() + 3.0/20.0)*liquid.rho()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volScalarField>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::phaseTransferCoeff() const
|
||||
{
|
||||
const volVectorField& U = this->U_;
|
||||
const alphaField& alpha = this->alpha_;
|
||||
const rhoField& rho = this->rho_;
|
||||
|
||||
const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
|
||||
|
||||
return
|
||||
(
|
||||
max(alphaInversion_ - alpha, 0.0)
|
||||
*rho
|
||||
*min
|
||||
(
|
||||
liquidTurbulence.epsilon()/liquidTurbulence.k(),
|
||||
1.0/U.time().deltaT()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvScalarMatrix>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::kSource() const
|
||||
{
|
||||
const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
|
||||
const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
|
||||
|
||||
return
|
||||
phaseTransferCoeff*liquidTurbulence.k()
|
||||
- fvm::Sp(phaseTransferCoeff, this->k_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvScalarMatrix>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::epsilonSource() const
|
||||
{
|
||||
const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
|
||||
const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
|
||||
|
||||
return
|
||||
phaseTransferCoeff*liquidTurbulence.epsilon()
|
||||
- fvm::Sp(phaseTransferCoeff, this->epsilon_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volSymmTensorField>
|
||||
continuousGasKEpsilon<BasicTurbulenceModel>::R() const
|
||||
{
|
||||
tmp<volScalarField> tk(this->k());
|
||||
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("R", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
((2.0/3.0)*I)*tk() - (nutEff_)*dev(twoSymm(fvc::grad(this->U_))),
|
||||
tk().boundaryField().types()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,148 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::RASModels::continuousGasKEpsilon
|
||||
|
||||
Group
|
||||
grpRASTurbulence
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
continuousGasKEpsilon.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef continuousGasKEpsilon_H
|
||||
#define continuousGasKEpsilon_H
|
||||
|
||||
#include "kEpsilon.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class continuousGasKEpsilon Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class continuousGasKEpsilon
|
||||
:
|
||||
public kEpsilon<BasicTurbulenceModel>
|
||||
{
|
||||
// Private data
|
||||
|
||||
mutable const turbulenceModel *liquidTurbulencePtr_;
|
||||
|
||||
volScalarField nutEff_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Model coefficients
|
||||
|
||||
dimensionedScalar alphaInversion_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
virtual void correctNut();
|
||||
tmp<volScalarField> phaseTransferCoeff() const;
|
||||
virtual tmp<fvScalarMatrix> kSource() const;
|
||||
virtual tmp<fvScalarMatrix> epsilonSource() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("continuousGasKEpsilon");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
continuousGasKEpsilon
|
||||
(
|
||||
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 ~continuousGasKEpsilon()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the turbulence model for the liquid phase
|
||||
const turbulenceModel& liquidTurbulence() const;
|
||||
|
||||
//- Return the effective viscosity
|
||||
virtual tmp<volScalarField> nuEff() const;
|
||||
|
||||
//- Return the effective density for the stress
|
||||
virtual tmp<volScalarField> rhoEff() const;
|
||||
|
||||
//- Return the Reynolds stress tensor
|
||||
virtual tmp<volSymmTensorField> R() const;
|
||||
|
||||
//- Read RASProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "continuousGasKEpsilon.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
49
src/TurbulenceModels/turbulenceModel/Make/files
Normal file
49
src/TurbulenceModels/turbulenceModel/Make/files
Normal file
@ -0,0 +1,49 @@
|
||||
turbulenceModel.C
|
||||
|
||||
derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
|
||||
derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C
|
||||
|
||||
/* Wall functions */
|
||||
wallFunctions = RAS/derivedFvPatchFields/wallFunctions
|
||||
|
||||
nutWallFunctions = $(wallFunctions)/nutWallFunctions
|
||||
$(nutWallFunctions)/nutWallFunction/nutWallFunctionFvPatchScalarField.C
|
||||
|
||||
$(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C
|
||||
$(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C
|
||||
$(nutWallFunctions)/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C
|
||||
$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C
|
||||
$(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C
|
||||
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
|
||||
$(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
|
||||
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
||||
$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C
|
||||
|
||||
omegaWallFunctions = $(wallFunctions)/omegaWallFunctions
|
||||
$(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
|
||||
|
||||
kqRWallFunctions = $(wallFunctions)/kqRWallFunctions
|
||||
$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C
|
||||
$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C
|
||||
|
||||
/*
|
||||
v2WallFunctions = $(wallFunctions)/v2WallFunctions
|
||||
$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C
|
||||
|
||||
fWallFunctions = $(wallFunctions)/fWallFunctions
|
||||
$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C
|
||||
*/
|
||||
|
||||
/* Patch fields */
|
||||
RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||
RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
|
||||
RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
|
||||
|
||||
/* backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C */
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libturbulenceModels
|
||||
7
src/TurbulenceModels/turbulenceModel/Make/options
Normal file
7
src/TurbulenceModels/turbulenceModel/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
184
src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.C
Normal file
184
src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.C
Normal file
@ -0,0 +1,184 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "RASModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void Foam::RASModel<BasicTurbulenceModel>::printCoeffs(const word& type)
|
||||
{
|
||||
if (printCoeffs_)
|
||||
{
|
||||
Info<< type << "Coeffs" << coeffDict_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::RASModel<BasicTurbulenceModel>::RASModel
|
||||
(
|
||||
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
|
||||
),
|
||||
|
||||
RASDict_(this->subOrEmptyDict("RAS")),
|
||||
turbulence_(RASDict_.lookup("turbulence")),
|
||||
printCoeffs_(RASDict_.lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(RASDict_.subOrEmptyDict(type + "Coeffs")),
|
||||
|
||||
kMin_("kMin", sqr(dimVelocity), SMALL),
|
||||
epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
|
||||
omegaMin_("omegaMin", dimless/dimTime, SMALL)
|
||||
{
|
||||
kMin_.readIfPresent(RASDict_);
|
||||
epsilonMin_.readIfPresent(RASDict_);
|
||||
omegaMin_.readIfPresent(RASDict_);
|
||||
|
||||
// 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::RASModel<BasicTurbulenceModel> >
|
||||
Foam::RASModel<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("RAS").lookup("RASModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting RAS turbulence model " << modelType << endl;
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"RASModel::New"
|
||||
"("
|
||||
"const volScalarField&, "
|
||||
"const volVectorField&, "
|
||||
"const surfaceScalarField&, "
|
||||
"transportModel&, "
|
||||
"const word&"
|
||||
")"
|
||||
) << "Unknown RASModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid RASModel types:" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<RASModel>
|
||||
(
|
||||
cstrIter()(alpha, rho, U, alphaPhi, phi, transport, propertiesName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void Foam::RASModel<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
BasicTurbulenceModel::correct();
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool Foam::RASModel<BasicTurbulenceModel>::read()
|
||||
{
|
||||
if (turbulenceModel::read())
|
||||
{
|
||||
RASDict_ <<= this->subDict("RAS");
|
||||
RASDict_.lookup("turbulence") >> turbulence_;
|
||||
|
||||
if (const dictionary* dictPtr = RASDict_.subDictPtr(type() + "Coeffs"))
|
||||
{
|
||||
coeffDict_ <<= *dictPtr;
|
||||
}
|
||||
|
||||
kMin_.readIfPresent(RASDict_);
|
||||
epsilonMin_.readIfPresent(RASDict_);
|
||||
omegaMin_.readIfPresent(RASDict_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
267
src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.H
Normal file
267
src/TurbulenceModels/turbulenceModel/RAS/RASModel/RASModel.H
Normal file
@ -0,0 +1,267 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::RASModels
|
||||
|
||||
Description
|
||||
Namespace for RAS turbulence models.
|
||||
|
||||
Class
|
||||
Foam::RASModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for RAS turbulence models
|
||||
|
||||
SourceFiles
|
||||
RASModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RASModel_H
|
||||
#define RASModel_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"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class RASModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class RASModel
|
||||
:
|
||||
public BasicTurbulenceModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- RAS coefficients dictionary
|
||||
dictionary RASDict_;
|
||||
|
||||
//- 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_;
|
||||
|
||||
//- Lower limit of epsilon
|
||||
dimensionedScalar epsilonMin_;
|
||||
|
||||
//- Lower limit for omega
|
||||
dimensionedScalar omegaMin_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Print model coefficients
|
||||
virtual void printCoeffs(const word& type);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
RASModel(const RASModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const RASModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("RAS");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
RASModel,
|
||||
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
|
||||
RASModel
|
||||
(
|
||||
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 RAS model
|
||||
static autoPtr<RASModel> 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 ~RASModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the lower allowable limit for k (default: SMALL)
|
||||
const dimensionedScalar& kMin() const
|
||||
{
|
||||
return kMin_;
|
||||
}
|
||||
|
||||
//- Return the lower allowable limit for epsilon (default: SMALL)
|
||||
const dimensionedScalar& epsilonMin() const
|
||||
{
|
||||
return epsilonMin_;
|
||||
}
|
||||
|
||||
//- Return the lower allowable limit for omega (default: SMALL)
|
||||
const dimensionedScalar& omegaMin() const
|
||||
{
|
||||
return omegaMin_;
|
||||
}
|
||||
|
||||
//- Allow kMin to be changed
|
||||
dimensionedScalar& kMin()
|
||||
{
|
||||
return kMin_;
|
||||
}
|
||||
|
||||
//- Allow epsilonMin to be changed
|
||||
dimensionedScalar& epsilonMin()
|
||||
{
|
||||
return epsilonMin_;
|
||||
}
|
||||
|
||||
//- Allow omegaMin to be changed
|
||||
dimensionedScalar& omegaMin()
|
||||
{
|
||||
return omegaMin_;
|
||||
}
|
||||
|
||||
//- Const access to the coefficients dictionary
|
||||
virtual const dictionary& coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
//- 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 RASProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "RASModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "atmBoundaryLayerInletEpsilonFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
z_(vector::zero),
|
||||
kappa_(0.41),
|
||||
Uref_(0),
|
||||
Href_(0),
|
||||
z0_(0),
|
||||
zGround_(0),
|
||||
Ustar_(0)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
z_(ptf.z_),
|
||||
kappa_(ptf.kappa_),
|
||||
Uref_(ptf.Uref_),
|
||||
Href_(ptf.Href_),
|
||||
z0_(ptf.z0_, mapper),
|
||||
zGround_(ptf.zGround_, mapper),
|
||||
Ustar_(ptf.Ustar_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
z_(dict.lookup("z")),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
Uref_(readScalar(dict.lookup("Uref"))),
|
||||
Href_(readScalar(dict.lookup("Href"))),
|
||||
z0_("z0", dict, p.size()),
|
||||
zGround_("zGround", dict, p.size()),
|
||||
Ustar_(p.size())
|
||||
{
|
||||
if (mag(z_) < SMALL)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"atmBoundaryLayerInletEpsilonFvPatchScalarField"
|
||||
"("
|
||||
"const fvPatch&, "
|
||||
"const DimensionedField<scalar, volMesh>&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
)
|
||||
<< "magnitude of z vector must be greater than zero"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll (Ustar_, i)
|
||||
{
|
||||
Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001)));
|
||||
}
|
||||
|
||||
z_ /= mag(z_);
|
||||
|
||||
const vectorField& c = patch().Cf();
|
||||
scalarField::operator=(pow3(Ustar_)/(kappa_*((c & z_) - zGround_ + z0_)));
|
||||
}
|
||||
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(blpsf, iF),
|
||||
z_(blpsf.z_),
|
||||
kappa_(blpsf.kappa_),
|
||||
Uref_(blpsf.Uref_),
|
||||
Href_(blpsf.Href_),
|
||||
z0_(blpsf.z0_),
|
||||
zGround_(blpsf.zGround_),
|
||||
Ustar_(blpsf.Ustar_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void atmBoundaryLayerInletEpsilonFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
z0_.autoMap(m);
|
||||
zGround_.autoMap(m);
|
||||
Ustar_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blptf =
|
||||
refCast<const atmBoundaryLayerInletEpsilonFvPatchScalarField>(ptf);
|
||||
|
||||
z0_.rmap(blptf.z0_, addr);
|
||||
zGround_.rmap(blptf.zGround_, addr);
|
||||
Ustar_.rmap(blptf.Ustar_, addr);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("z")
|
||||
<< z_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa")
|
||||
<< kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Uref")
|
||||
<< Uref_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Href")
|
||||
<< Href_ << token::END_STATEMENT << nl;
|
||||
z0_.writeEntry("z0", os);
|
||||
zGround_.writeEntry("zGround", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,249 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition specifies an inlet value for the turbulence
|
||||
dissipation, \f$\epsilon\f$ (\c epsilon), appropriate for atmospheric
|
||||
boundary layers (ABL), and designed to be used in conjunction with the
|
||||
\c ABLInletVelocity inlet velocity boundary condition.
|
||||
|
||||
\f[
|
||||
\epsilon = \frac{(U^*)^3}{K(z - z_g + z_0)}
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
U^* | frictional velocity
|
||||
K | Karman's constant
|
||||
z | vertical co-ordinate [m]
|
||||
z_0 | surface roughness length [m]
|
||||
z_g | minimum vlaue in z direction [m]
|
||||
\endvartable
|
||||
|
||||
and:
|
||||
|
||||
\f[
|
||||
U^* = K \frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
|
||||
\f]
|
||||
|
||||
where:
|
||||
\vartable
|
||||
U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s]
|
||||
Z_{ref} | reference height [m]
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
z | vertical co-ordinate [m] | yes |
|
||||
kappa | Karman's constanat | no | 0.41
|
||||
Uref | reference velocity [m/s] | yes |
|
||||
Href | reference height [m] | yes |
|
||||
z0 | surface roughness length [m] | yes |
|
||||
zGround | minimum z co-ordinate [m] | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type atmBoundaryLayerInletEpsilon;
|
||||
z 1.0;
|
||||
kappa 0.41;
|
||||
Uref 1.0;
|
||||
Href 0.0;
|
||||
z0 uniform 0.0;
|
||||
zGround uniform 0.0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Reference:
|
||||
D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model
|
||||
in commercial CFD software to model the neutral atmospheric boundary
|
||||
layer", Journal of Wind Engineering and Industrial Aerodynamics
|
||||
95(2007), pp 355-369.
|
||||
|
||||
SourceFiles
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef atmBoundaryLayerInletEpsilonFvPatchScalarField_H
|
||||
#define atmBoundaryLayerInletEpsilonFvPatchScalarField_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class atmBoundaryLayerInletEpsilonFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Direction of the z-coordinate
|
||||
vector z_;
|
||||
|
||||
//- Von Karman constant
|
||||
const scalar kappa_;
|
||||
|
||||
//- Reference velocity
|
||||
const scalar Uref_;
|
||||
|
||||
//- Reference height
|
||||
const scalar Href_;
|
||||
|
||||
//- Surface roughness length
|
||||
scalarField z0_;
|
||||
|
||||
//- Minimum co-ordinate value in z direction
|
||||
scalarField zGround_;
|
||||
|
||||
//- Frictional velocity
|
||||
scalarField Ustar_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("atmBoundaryLayerInletEpsilon");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// atmBoundaryLayerInletEpsilonFvPatchScalarField onto a new patch
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new atmBoundaryLayerInletEpsilonFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new atmBoundaryLayerInletEpsilonFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return max value
|
||||
const scalarField& Ustar() const
|
||||
{
|
||||
return Ustar_;
|
||||
}
|
||||
|
||||
//- Return z direction
|
||||
const vector& z() const
|
||||
{
|
||||
return z_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,223 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "atmBoundaryLayerInletVelocityFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
Ustar_(0),
|
||||
n_(pTraits<vector>::zero),
|
||||
z_(pTraits<vector>::zero),
|
||||
z0_(0),
|
||||
kappa_(0.41),
|
||||
Uref_(0),
|
||||
Href_(0),
|
||||
zGround_(0)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||
Ustar_(ptf.Ustar_, mapper),
|
||||
n_(ptf.n_),
|
||||
z_(ptf.z_),
|
||||
z0_(ptf.z0_, mapper),
|
||||
kappa_(ptf.kappa_),
|
||||
Uref_(ptf.Uref_),
|
||||
Href_(ptf.Href_),
|
||||
zGround_(ptf.zGround_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
Ustar_(p.size()),
|
||||
n_(dict.lookup("n")),
|
||||
z_(dict.lookup("z")),
|
||||
z0_("z0", dict, p.size()),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
Uref_(readScalar(dict.lookup("Uref"))),
|
||||
Href_(readScalar(dict.lookup("Href"))),
|
||||
zGround_("zGround", dict, p.size())
|
||||
{
|
||||
if (mag(n_) < SMALL || mag(z_) < SMALL)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"atmBoundaryLayerInletVelocityFvPatchVectorField"
|
||||
"("
|
||||
"const fvPatch&, "
|
||||
"const DimensionedField<vector, volMesh>&, "
|
||||
"onst dictionary&"
|
||||
")"
|
||||
)
|
||||
<< "magnitude of n or z must be greater than zero"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
n_ /= mag(n_);
|
||||
z_ /= mag(z_);
|
||||
|
||||
forAll (Ustar_, i)
|
||||
{
|
||||
Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001)));
|
||||
}
|
||||
|
||||
const vectorField& c = patch().Cf();
|
||||
const scalarField coord(c & z_);
|
||||
scalarField Un(coord.size());
|
||||
|
||||
forAll(coord, i)
|
||||
{
|
||||
if ((coord[i] - zGround_[i]) < Href_)
|
||||
{
|
||||
Un[i] =
|
||||
(Ustar_[i]/kappa_)
|
||||
* log((coord[i] - zGround_[i] + z0_[i])/max(z0_[i], 0.001));
|
||||
}
|
||||
else
|
||||
{
|
||||
Un[i] = Uref_;
|
||||
}
|
||||
}
|
||||
|
||||
vectorField::operator=(n_*Un);
|
||||
}
|
||||
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(blpvf, iF),
|
||||
Ustar_(blpvf.Ustar_),
|
||||
n_(blpvf.n_),
|
||||
z_(blpvf.z_),
|
||||
z0_(blpvf.z0_),
|
||||
kappa_(blpvf.kappa_),
|
||||
Uref_(blpvf.Uref_),
|
||||
Href_(blpvf.Href_),
|
||||
zGround_(blpvf.zGround_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void atmBoundaryLayerInletVelocityFvPatchVectorField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchVectorField::autoMap(m);
|
||||
z0_.autoMap(m);
|
||||
zGround_.autoMap(m);
|
||||
Ustar_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchVectorField::rmap(ptf, addr);
|
||||
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& blptf =
|
||||
refCast<const atmBoundaryLayerInletVelocityFvPatchVectorField>(ptf);
|
||||
|
||||
z0_.rmap(blptf.z0_, addr);
|
||||
zGround_.rmap(blptf.zGround_, addr);
|
||||
Ustar_.rmap(blptf.Ustar_, addr);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
z0_.writeEntry("z0", os) ;
|
||||
os.writeKeyword("n")
|
||||
<< n_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("z")
|
||||
<< z_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa")
|
||||
<< kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Uref")
|
||||
<< Uref_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Href")
|
||||
<< Href_ << token::END_STATEMENT << nl;
|
||||
zGround_.writeEntry("zGround", os) ;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,266 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
|
||||
Group
|
||||
grpRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition specifies a velocity inlet profile appropriate
|
||||
for atmospheric boundary layers (ABL). The profile is derived from the
|
||||
friction velocity, flow direction and the direction of the parabolic
|
||||
co-ordinate \c z.
|
||||
|
||||
\f[
|
||||
U = \frac{U^*}{K} ln\left(\frac{z - z_g + z_0}{z_0}\right)
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
U^* | frictional velocity
|
||||
K | Karman's constant
|
||||
z | vertical co-ordinate [m]
|
||||
z_0 | surface roughness length [m]
|
||||
z_g | minimum vlaue in z direction [m]
|
||||
\endvartable
|
||||
|
||||
and:
|
||||
|
||||
\f[
|
||||
U^* = K \frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
|
||||
\f]
|
||||
|
||||
where:
|
||||
\vartable
|
||||
U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s]
|
||||
Z_{ref} | reference height [m]
|
||||
\endvartable
|
||||
|
||||
Reference:
|
||||
D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model
|
||||
in commercial CFD software to model the neutral atmospheric boundary
|
||||
layer", Journal of Wind Engineering and Industrial Aerodynamics
|
||||
95(2007), pp 355-369.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
n | flow direction | yes |
|
||||
z | vertical co-ordinate [m] | yes |
|
||||
kappa | Karman's constanat | no | 0.41
|
||||
Uref | reference velocity [m/s] | yes |
|
||||
Href | reference height [m] | yes |
|
||||
z0 | surface roughness length [m] | yes |
|
||||
zGround | minimum z co-ordinate [m] | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type atmBoundaryLayerInletVelocity;
|
||||
n (0 1 0);
|
||||
z 1.0;
|
||||
kappa 0.41;
|
||||
Uref 1.0;
|
||||
Href 0.0;
|
||||
z0 uniform 0.0;
|
||||
zGround uniform 0.0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the
|
||||
k-epsilon model should be changed from 1.3 to 1.11 for consistency.
|
||||
The roughness height (Er) is given by Er = 20 z0 following the same
|
||||
reference.
|
||||
|
||||
SourceFiles
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef atmBoundaryLayerInletVelocityFvPatchVectorField_H
|
||||
#define atmBoundaryLayerInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class atmBoundaryLayerInletVelocityFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Frictional velocity
|
||||
scalarField Ustar_;
|
||||
|
||||
//- Flow direction
|
||||
vector n_;
|
||||
|
||||
//- Direction of the z-coordinate
|
||||
vector z_;
|
||||
|
||||
//- Surface roughness lenght
|
||||
scalarField z0_;
|
||||
|
||||
//- Von Karman constant
|
||||
const scalar kappa_;
|
||||
|
||||
//- Reference velocity
|
||||
const scalar Uref_;
|
||||
|
||||
//- Reference hight
|
||||
const scalar Href_;
|
||||
|
||||
//- Minimum corrdinate value in z direction
|
||||
scalarField zGround_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("atmBoundaryLayerInletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// atmBoundaryLayerInletVelocityFvPatchVectorField onto a new patch
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new atmBoundaryLayerInletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new atmBoundaryLayerInletVelocityFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return Ustar
|
||||
const scalarField& Ustar() const
|
||||
{
|
||||
return Ustar_;
|
||||
}
|
||||
|
||||
//- Return flow direction
|
||||
const vector& n() const
|
||||
{
|
||||
return n_;
|
||||
}
|
||||
|
||||
//- Return z direction
|
||||
const vector& z() const
|
||||
{
|
||||
return z_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchVectorField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-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/>.
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
\defgroup grpRASBoundaryConditions RAS boundary conditions
|
||||
@{
|
||||
\ingroup grpRASTurbulence
|
||||
This group contains RAS turbulence model boundary conditions
|
||||
@}
|
||||
|
||||
\defgroup grpWallFunctions RAS wall functions
|
||||
@{
|
||||
\ingroup grpRASBoundaryConditions
|
||||
This group contains RAS turbulence model wall functions
|
||||
@}
|
||||
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -0,0 +1,186 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "turbulentMixingLengthDissipationRateInletFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(0.0),
|
||||
phiName_("phi"),
|
||||
kName_("k")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(readScalar(dict.lookup("mixingLength"))),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k"))
|
||||
{
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Lookup Cmu corresponding to the turbulence model selected
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
const scalar Cmu =
|
||||
turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
|
||||
|
||||
const scalar Cmu75 = pow(Cmu, 0.75);
|
||||
|
||||
const fvPatchScalarField& kp =
|
||||
patch().lookupPatchField<volScalarField, scalar>(kName_);
|
||||
|
||||
const fvsPatchScalarField& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||
|
||||
this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_;
|
||||
this->valueFraction() = 1.0 - pos(phip);
|
||||
|
||||
inletOutletFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,202 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence dissipation, \f$\epsilon\f$
|
||||
(epsilon) inlet condition based on a specified mixing length. The patch
|
||||
values are calculated using:
|
||||
|
||||
\f[
|
||||
\epsilon_p = \frac{C_{\mu}^{0.75} k^{1.5}}{L}
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
\epsilon_p | patch epsilon values
|
||||
C_{\mu} | Model coefficient, set to 0.09
|
||||
k | turbulence kinetic energy
|
||||
L | length scale
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
mixingLength | Length scale [m] | yes |
|
||||
phi | flux field name | no | phi
|
||||
k | turbulence kinetic energy field name | no | k
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type turbulentMixingLengthDissipationRateInlet;
|
||||
mixingLength 0.005;
|
||||
value uniform 200; // placeholder
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
In the event of reverse flow, a zero-gradient condition is applied
|
||||
|
||||
SeeAlso
|
||||
Foam::inletOutletFvPatchField
|
||||
|
||||
SourceFiles
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulentMixingLengthDissipationRateInlet_H
|
||||
#define turbulentMixingLengthDissipationRateInlet_H
|
||||
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentMixingLengthDissipationRateInletFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
:
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the turbulent kinetic energy field
|
||||
word kName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("turbulentMixingLengthDissipationRateInlet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
// onto a new patch
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,182 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "turbulentMixingLengthFrequencyInletFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(0.0),
|
||||
phiName_("undefined-phi"),
|
||||
kName_("undefined-k")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(readScalar(dict.lookup("mixingLength"))),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k"))
|
||||
{
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Lookup Cmu corresponding to the turbulence model selected
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
const scalar Cmu =
|
||||
turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
|
||||
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
|
||||
const fvPatchScalarField& kp =
|
||||
patch().lookupPatchField<volScalarField, scalar>(kName_);
|
||||
|
||||
const fvsPatchScalarField& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||
|
||||
this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
|
||||
this->valueFraction() = 1.0 - pos(phip);
|
||||
|
||||
inletOutletFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,203 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence specific dissipation,
|
||||
\f$\omega\f$ (omega) inlet condition based on a specified mixing length.
|
||||
The patch values are calculated using:
|
||||
|
||||
\f[
|
||||
\omega_p = \frac{k^{0.5}}{C_{\mu}^{0.25} L}
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
\omega_p | patch omega values
|
||||
C_{\mu} | Model coefficient, set to 0.09
|
||||
k | turbulence kinetic energy
|
||||
L | length scale
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
mixingLength | Length scale [m] | yes |
|
||||
phi | flux field name | no | phi
|
||||
k | turbulence kinetic energy field name | no | k
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type turbulentMixingLengthFrequencyInlet;
|
||||
mixingLength 0.005;
|
||||
value uniform 200; // placeholder
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
In the event of reverse flow, a zero-gradient condition is applied
|
||||
|
||||
SeeAlso
|
||||
Foam::inletOutletFvPatchField
|
||||
|
||||
|
||||
SourceFiles
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulentMixingLengthFrequencyInletFvPatchScalarField_H
|
||||
#define turbulentMixingLengthFrequencyInletFvPatchScalarField_H
|
||||
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentMixingLengthFrequencyInletFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
:
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the turbulent kinetic energy field
|
||||
word kName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("turbulentMixingLengthFrequencyInlet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
// onto a new patch
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthFrequencyInletFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthFrequencyInletFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
const turbulentMixingLengthFrequencyInletFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,189 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-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 "epsilonLowReWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
)
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(max(E*ypl, 1))/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
void epsilonLowReWallFunctionFvPatchScalarField::calculate
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
const List<scalar>& cornerWeights,
|
||||
const fvPatch& patch,
|
||||
scalarField& G,
|
||||
scalarField& epsilon
|
||||
)
|
||||
{
|
||||
const label patchi = patch.index();
|
||||
|
||||
const scalarField& y = turbulence.y()[patchi];
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
const scalar Cmu75 = pow(Cmu_, 0.75);
|
||||
|
||||
const tmp<volScalarField> tk = turbulence.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const tmp<scalarField> tnutw = turbulence.nut(patchi);
|
||||
const scalarField& nutw = tnutw();
|
||||
|
||||
const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchi];
|
||||
|
||||
const scalarField magGradUw(mag(Uw.snGrad()));
|
||||
|
||||
// Set epsilon and G
|
||||
forAll(nutw, faceI)
|
||||
{
|
||||
label cellI = patch.faceCells()[faceI];
|
||||
|
||||
scalar yPlus = Cmu25*sqrt(k[cellI])*y[faceI]/nuw[faceI];
|
||||
|
||||
scalar w = cornerWeights[faceI];
|
||||
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
epsilon[cellI] = w*Cmu75*pow(k[cellI], 1.5)/(kappa_*y[faceI]);
|
||||
}
|
||||
else
|
||||
{
|
||||
epsilon[cellI] = w*2.0*k[cellI]*nuw[faceI]/sqr(y[faceI]);
|
||||
}
|
||||
|
||||
G[cellI] =
|
||||
w
|
||||
*(nutw[faceI] + nuw[faceI])
|
||||
*magGradUw[faceI]
|
||||
*Cmu25*sqrt(k[cellI])
|
||||
/(kappa_*y[faceI]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
epsilonLowReWallFunctionFvPatchScalarField::
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
epsilonWallFunctionFvPatchScalarField(p, iF),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{}
|
||||
|
||||
|
||||
epsilonLowReWallFunctionFvPatchScalarField::
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonLowReWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{}
|
||||
|
||||
|
||||
epsilonLowReWallFunctionFvPatchScalarField::
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
epsilonWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{}
|
||||
|
||||
|
||||
epsilonLowReWallFunctionFvPatchScalarField::
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf
|
||||
)
|
||||
:
|
||||
epsilonWallFunctionFvPatchScalarField(ewfpsf),
|
||||
yPlusLam_(ewfpsf.yPlusLam_)
|
||||
{}
|
||||
|
||||
|
||||
epsilonLowReWallFunctionFvPatchScalarField::
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
epsilonWallFunctionFvPatchScalarField(ewfpsf, iF),
|
||||
yPlusLam_(ewfpsf.yPlusLam_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,191 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-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::epsilonLowReWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence dissipation wall function
|
||||
condition for low- and high-Reynolds number turbulent flow cases.
|
||||
|
||||
The condition can be applied to wall boundaries, whereby it inserts near
|
||||
wall epsilon values directly into the epsilon equation to act as a
|
||||
constraint.
|
||||
|
||||
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||
switch-over y+ value derived from kappa and E.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Cmu | model coefficient | no | 0.09
|
||||
kappa | Von Karman constant | no | 0.41
|
||||
E | model coefficient | no | 9.8
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type epsilonLowReWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::epsilonWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
epsilonLowReWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef epsilonLowReWallFunctionFvPatchScalarField_H
|
||||
#define epsilonLowReWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "epsilonWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class epsilonLowReWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class epsilonLowReWallFunctionFvPatchScalarField
|
||||
:
|
||||
public epsilonWallFunctionFvPatchScalarField
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
|
||||
//- Calculate the epsilon and G
|
||||
virtual void calculate
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
const List<scalar>& cornerWeights,
|
||||
const fvPatch& patch,
|
||||
scalarField& G,
|
||||
scalarField& epsilon
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("epsilonLowReWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// epsilonLowReWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonLowReWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonLowReWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new epsilonLowReWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
epsilonLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonLowReWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new epsilonLowReWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
//- Destructor
|
||||
virtual ~epsilonLowReWallFunctionFvPatchScalarField()
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,590 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "epsilonWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "volFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("epsilonWallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::setMaster()
|
||||
{
|
||||
if (master_ != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const volScalarField& epsilon =
|
||||
static_cast<const volScalarField&>(this->dimensionedInternalField());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField();
|
||||
|
||||
label master = -1;
|
||||
forAll(bf, patchi)
|
||||
{
|
||||
if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi]))
|
||||
{
|
||||
epsilonWallFunctionFvPatchScalarField& epf = epsilonPatch(patchi);
|
||||
|
||||
if (master == -1)
|
||||
{
|
||||
master = patchi;
|
||||
}
|
||||
|
||||
epf.master() = master;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::createAveragingWeights()
|
||||
{
|
||||
if (initialised_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const volScalarField& epsilon =
|
||||
static_cast<const volScalarField&>(this->dimensionedInternalField());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField();
|
||||
|
||||
const fvMesh& mesh = epsilon.mesh();
|
||||
|
||||
volScalarField weights
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"weights",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // do not register
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimless, 0.0)
|
||||
);
|
||||
|
||||
DynamicList<label> epsilonPatches(bf.size());
|
||||
forAll(bf, patchi)
|
||||
{
|
||||
if (isA<epsilonWallFunctionFvPatchScalarField>(bf[patchi]))
|
||||
{
|
||||
epsilonPatches.append(patchi);
|
||||
|
||||
const labelUList& faceCells = bf[patchi].patch().faceCells();
|
||||
forAll(faceCells, i)
|
||||
{
|
||||
weights[faceCells[i]]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cornerWeights_.setSize(bf.size());
|
||||
forAll(epsilonPatches, i)
|
||||
{
|
||||
label patchi = epsilonPatches[i];
|
||||
const fvPatchScalarField& wf = weights.boundaryField()[patchi];
|
||||
cornerWeights_[patchi] = 1.0/wf.patchInternalField();
|
||||
}
|
||||
|
||||
G_.setSize(dimensionedInternalField().size(), 0.0);
|
||||
epsilon_.setSize(dimensionedInternalField().size(), 0.0);
|
||||
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField&
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonPatch(const label patchi)
|
||||
{
|
||||
const volScalarField& epsilon =
|
||||
static_cast<const volScalarField&>(this->dimensionedInternalField());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField();
|
||||
|
||||
const epsilonWallFunctionFvPatchScalarField& epf =
|
||||
refCast<const epsilonWallFunctionFvPatchScalarField>(bf[patchi]);
|
||||
|
||||
return const_cast<epsilonWallFunctionFvPatchScalarField&>(epf);
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::calculateTurbulenceFields
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
scalarField& G0,
|
||||
scalarField& epsilon0
|
||||
)
|
||||
{
|
||||
// accumulate all of the G and epsilon contributions
|
||||
forAll(cornerWeights_, patchi)
|
||||
{
|
||||
if (!cornerWeights_[patchi].empty())
|
||||
{
|
||||
epsilonWallFunctionFvPatchScalarField& epf = epsilonPatch(patchi);
|
||||
|
||||
const List<scalar>& w = cornerWeights_[patchi];
|
||||
|
||||
epf.calculate(turbulence, w, epf.patch(), G0, epsilon0);
|
||||
}
|
||||
}
|
||||
|
||||
// apply zero-gradient condition for epsilon
|
||||
forAll(cornerWeights_, patchi)
|
||||
{
|
||||
if (!cornerWeights_[patchi].empty())
|
||||
{
|
||||
epsilonWallFunctionFvPatchScalarField& epf = epsilonPatch(patchi);
|
||||
|
||||
epf == scalarField(epsilon0, epf.patch().faceCells());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::calculate
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
const List<scalar>& cornerWeights,
|
||||
const fvPatch& patch,
|
||||
scalarField& G,
|
||||
scalarField& epsilon
|
||||
)
|
||||
{
|
||||
const label patchi = patch.index();
|
||||
|
||||
const scalarField& y = turbulence.y()[patchi];
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
const scalar Cmu75 = pow(Cmu_, 0.75);
|
||||
|
||||
const tmp<volScalarField> tk = turbulence.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const tmp<scalarField> tnutw = turbulence.nut(patchi);
|
||||
const scalarField& nutw = tnutw();
|
||||
|
||||
const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchi];
|
||||
|
||||
const scalarField magGradUw(mag(Uw.snGrad()));
|
||||
|
||||
// Set epsilon and G
|
||||
forAll(nutw, facei)
|
||||
{
|
||||
label celli = patch.faceCells()[facei];
|
||||
|
||||
scalar w = cornerWeights[facei];
|
||||
|
||||
epsilon[celli] += w*Cmu75*pow(k[celli], 1.5)/(kappa_*y[facei]);
|
||||
|
||||
G[celli] +=
|
||||
w
|
||||
*(nutw[facei] + nuw[facei])
|
||||
*magGradUw[facei]
|
||||
*Cmu25*sqrt(k[celli])
|
||||
/(kappa_*y[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
G_(),
|
||||
epsilon_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
G_(),
|
||||
epsilon_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
G_(),
|
||||
epsilon_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
|
||||
// apply zero-gradient condition on start-up
|
||||
this->operator==(patchInternalField());
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField& ewfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ewfpsf),
|
||||
Cmu_(ewfpsf.Cmu_),
|
||||
kappa_(ewfpsf.kappa_),
|
||||
E_(ewfpsf.E_),
|
||||
G_(),
|
||||
epsilon_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField& ewfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ewfpsf, iF),
|
||||
Cmu_(ewfpsf.Cmu_),
|
||||
kappa_(ewfpsf.kappa_),
|
||||
E_(ewfpsf.E_),
|
||||
G_(),
|
||||
epsilon_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalarField& epsilonWallFunctionFvPatchScalarField::G(bool init)
|
||||
{
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
G_ = 0.0;
|
||||
}
|
||||
|
||||
return G_;
|
||||
}
|
||||
|
||||
return epsilonPatch(master_).G();
|
||||
}
|
||||
|
||||
|
||||
scalarField& epsilonWallFunctionFvPatchScalarField::epsilon(bool init)
|
||||
{
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
epsilon_ = 0.0;
|
||||
}
|
||||
|
||||
return epsilon_;
|
||||
}
|
||||
|
||||
return epsilonPatch(master_).epsilon(init);
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
setMaster();
|
||||
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
createAveragingWeights();
|
||||
calculateTurbulenceFields(turbModel, G(true), epsilon(true));
|
||||
}
|
||||
|
||||
const scalarField& G0 = this->G();
|
||||
const scalarField& epsilon0 = this->epsilon();
|
||||
|
||||
typedef DimensionedField<scalar, volMesh> FieldType;
|
||||
|
||||
FieldType& G =
|
||||
const_cast<FieldType&>
|
||||
(
|
||||
db().lookupObject<FieldType>(turbModel.GName())
|
||||
);
|
||||
|
||||
FieldType& epsilon = const_cast<FieldType&>(dimensionedInternalField());
|
||||
|
||||
forAll(*this, facei)
|
||||
{
|
||||
label celli = patch().faceCells()[facei];
|
||||
|
||||
G[celli] = G0[celli];
|
||||
epsilon[celli] = epsilon0[celli];
|
||||
}
|
||||
|
||||
fvPatchField<scalar>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::updateCoeffs
|
||||
(
|
||||
const scalarField& weights
|
||||
)
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
setMaster();
|
||||
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
createAveragingWeights();
|
||||
calculateTurbulenceFields(turbModel, G(true), epsilon(true));
|
||||
}
|
||||
|
||||
const scalarField& G0 = this->G();
|
||||
const scalarField& epsilon0 = this->epsilon();
|
||||
|
||||
typedef DimensionedField<scalar, volMesh> FieldType;
|
||||
|
||||
FieldType& G =
|
||||
const_cast<FieldType&>
|
||||
(
|
||||
db().lookupObject<FieldType>(turbModel.GName())
|
||||
);
|
||||
|
||||
FieldType& epsilon = const_cast<FieldType&>(dimensionedInternalField());
|
||||
|
||||
scalarField& epsilonf = *this;
|
||||
|
||||
// only set the values if the weights are < 1 - tolerance
|
||||
forAll(weights, facei)
|
||||
{
|
||||
scalar w = weights[facei];
|
||||
|
||||
if (w < 1.0 - 1e-6)
|
||||
{
|
||||
label celli = patch().faceCells()[facei];
|
||||
|
||||
G[celli] = w*G[celli] + (1.0 - w)*G0[celli];
|
||||
epsilon[celli] = w*epsilon[celli] + (1.0 - w)*epsilon0[celli];
|
||||
epsilonf[facei] = epsilon[celli];
|
||||
}
|
||||
}
|
||||
|
||||
fvPatchField<scalar>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::manipulateMatrix
|
||||
(
|
||||
fvMatrix<scalar>& matrix
|
||||
)
|
||||
{
|
||||
if (manipulatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
matrix.setValues(patch().faceCells(), patchInternalField());
|
||||
|
||||
fvPatchField<scalar>::manipulateMatrix(matrix);
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::manipulateMatrix
|
||||
(
|
||||
fvMatrix<scalar>& matrix,
|
||||
const Field<scalar>& weights
|
||||
)
|
||||
{
|
||||
if (manipulatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// filter weights so that we only apply the constraint where the
|
||||
// weight > SMALL
|
||||
DynamicList<label> constraintCells(weights.size());
|
||||
DynamicList<scalar> constraintEpsilon(weights.size());
|
||||
const labelUList& faceCells = patch().faceCells();
|
||||
|
||||
const DimensionedField<scalar, volMesh>& epsilon
|
||||
= dimensionedInternalField();
|
||||
|
||||
label nConstrainedCells = 0;
|
||||
|
||||
|
||||
forAll(weights, facei)
|
||||
{
|
||||
// only set the values if the weights are < 1 - tolerance
|
||||
if (weights[facei] < (1.0 - 1e-6))
|
||||
{
|
||||
nConstrainedCells++;
|
||||
|
||||
label celli = faceCells[facei];
|
||||
|
||||
constraintCells.append(celli);
|
||||
constraintEpsilon.append(epsilon[celli]);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Patch: " << patch().name()
|
||||
<< ": number of constrained cells = " << nConstrainedCells
|
||||
<< " out of " << patch().size()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
matrix.setValues
|
||||
(
|
||||
constraintCells,
|
||||
scalarField(constraintEpsilon.xfer())
|
||||
);
|
||||
|
||||
fvPatchField<scalar>::manipulateMatrix(matrix);
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,285 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::epsilonWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence dissipation wall function
|
||||
condition for high Reynolds number, turbulent flow cases.
|
||||
|
||||
The condition can be applied to wall boundaries, whereby it
|
||||
- calculates \c epsilon and \c G
|
||||
- inserts near wall epsilon values directly into the epsilon equation
|
||||
to act as a constraint
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
epsilon | turblence dissipation field
|
||||
G | turblence generation field
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Cmu | model coefficient | no | 0.09
|
||||
kappa | Von Karman constant | no | 0.41
|
||||
E | model coefficient | no | 9.8
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::fixedInternalValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
epsilonWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef epsilonWallFunctionFvPatchScalarField_H
|
||||
#define epsilonWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class turbulenceModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class epsilonWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class epsilonWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchField<scalar>
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Local copy of turbulence G field
|
||||
scalarField G_;
|
||||
|
||||
//- Local copy of turbulence epsilon field
|
||||
scalarField epsilon_;
|
||||
|
||||
//- Initialised flag
|
||||
bool initialised_;
|
||||
|
||||
//- Master patch ID
|
||||
label master_;
|
||||
|
||||
//- List of averaging corner weights
|
||||
List<List<scalar> > cornerWeights_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
//- Set the master patch - master is responsible for updating all
|
||||
// wall function patches
|
||||
virtual void setMaster();
|
||||
|
||||
//- Create the averaging weights for cells which are bounded by
|
||||
// multiple wall function faces
|
||||
virtual void createAveragingWeights();
|
||||
|
||||
//- Helper function to return non-const access to an epsilon patch
|
||||
virtual epsilonWallFunctionFvPatchScalarField& epsilonPatch
|
||||
(
|
||||
const label patchi
|
||||
);
|
||||
|
||||
//- Main driver to calculate the turbulence fields
|
||||
virtual void calculateTurbulenceFields
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
scalarField& G0,
|
||||
scalarField& epsilon0
|
||||
);
|
||||
|
||||
//- Calculate the epsilon and G
|
||||
virtual void calculate
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
const List<scalar>& cornerWeights,
|
||||
const fvPatch& patch,
|
||||
scalarField& G,
|
||||
scalarField& epsilon
|
||||
);
|
||||
|
||||
//- Return non-const access to the master patch ID
|
||||
virtual label& master()
|
||||
{
|
||||
return master_;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("epsilonWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// epsilonWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new epsilonWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new epsilonWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
//- Destructor
|
||||
virtual ~epsilonWallFunctionFvPatchScalarField()
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return non-const access to the master's G field
|
||||
scalarField& G(bool init = false);
|
||||
|
||||
//- Return non-const access to the master's epsilon field
|
||||
scalarField& epsilon(bool init = false);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs(const scalarField& weights);
|
||||
|
||||
//- Manipulate matrix
|
||||
virtual void manipulateMatrix(fvMatrix<scalar>& matrix);
|
||||
|
||||
//- Manipulate matrix with given weights
|
||||
virtual void manipulateMatrix
|
||||
(
|
||||
fvMatrix<scalar>& matrix,
|
||||
const scalarField& weights
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,259 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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 "fWallFunctionFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "v2f.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void fWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("fWallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar fWallFunctionFvPatchScalarField::yPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
)
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(max(E*ypl, 1))/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fWallFunctionFvPatchScalarField& v2wfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(v2wfpsf),
|
||||
Cmu_(v2wfpsf.Cmu_),
|
||||
kappa_(v2wfpsf.kappa_),
|
||||
E_(v2wfpsf.E_),
|
||||
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fWallFunctionFvPatchScalarField& v2wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(v2wfpsf, iF),
|
||||
Cmu_(v2wfpsf.Cmu_),
|
||||
kappa_(v2wfpsf.kappa_),
|
||||
E_(v2wfpsf.E_),
|
||||
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void fWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const v2f& v2fModel = refCast<const v2f>(turbulence);
|
||||
|
||||
const scalarField& y = v2fModel.y()[patchi];
|
||||
|
||||
const tmp<volScalarField> tk = v2fModel.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const tmp<volScalarField> tepsilon = v2fModel.epsilon();
|
||||
const volScalarField& epsilon = tepsilon();
|
||||
|
||||
const tmp<volScalarField> tv2 = v2fModel.v2();
|
||||
const volScalarField& v2 = tv2();
|
||||
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
scalarField& f = *this;
|
||||
|
||||
// Set f wall values
|
||||
forAll(f, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar uTau = Cmu25*sqrt(k[faceCellI]);
|
||||
|
||||
scalar yPlus = uTau*y[faceI]/nuw[faceI];
|
||||
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
scalar N = 6.0;
|
||||
scalar v2c = v2[faceCellI];
|
||||
scalar epsc = epsilon[faceCellI];
|
||||
scalar kc = k[faceCellI];
|
||||
|
||||
f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL);
|
||||
f[faceI] /= sqr(uTau) + ROOTVSMALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
f[faceI] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||
|
||||
// TODO: perform averaging for cells sharing more than one boundary face
|
||||
}
|
||||
|
||||
|
||||
void fWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
void fWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
fWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,203 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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::RASModels::fWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence damping function, f, wall
|
||||
function condition for low- and high Reynolds number, turbulent flow cases
|
||||
|
||||
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||
switch-over y+ value derived from kappa and E.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Cmu | model coefficient | no | 0.09
|
||||
kappa | Von Karman constant | no | 0.41
|
||||
E | model coefficient | no | 9.8
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type fWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::fixedValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
fWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fWallFunctionFvPatchScalarField_H
|
||||
#define fWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchField<scalar>
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given fWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate(const Pstream::commsTypes);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,256 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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 "kLowReWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void kLowReWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("kLowReWallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
scalar kLowReWallFunctionFvPatchScalarField::yPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
)
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(max(E*ypl, 1))/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
Ceps2_(1.9),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const kLowReWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
Ceps2_(ptf.Ceps2_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", 1.9)),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const kLowReWallFunctionFvPatchScalarField& kwfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(kwfpsf),
|
||||
Cmu_(kwfpsf.Cmu_),
|
||||
kappa_(kwfpsf.kappa_),
|
||||
E_(kwfpsf.E_),
|
||||
Ceps2_(kwfpsf.Ceps2_),
|
||||
yPlusLam_(kwfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const kLowReWallFunctionFvPatchScalarField& kwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(kwfpsf, iF),
|
||||
Cmu_(kwfpsf.Cmu_),
|
||||
kappa_(kwfpsf.kappa_),
|
||||
E_(kwfpsf.E_),
|
||||
Ceps2_(kwfpsf.Ceps2_),
|
||||
yPlusLam_(kwfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbulence.y()[patchi];
|
||||
|
||||
const tmp<volScalarField> tk = turbulence.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
scalarField& kw = *this;
|
||||
|
||||
// Set k wall values
|
||||
forAll(kw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar uTau = Cmu25*sqrt(k[faceCellI]);
|
||||
|
||||
scalar yPlus = uTau*y[faceI]/nuw[faceI];
|
||||
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
scalar Ck = -0.416;
|
||||
scalar Bk = 8.366;
|
||||
kw[faceI] = Ck/kappa_*log(yPlus) + Bk;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar C = 11.0;
|
||||
scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C));
|
||||
kw[faceI] = 2400.0/sqr(Ceps2_)*Cf;
|
||||
}
|
||||
|
||||
kw[faceI] *= sqr(uTau);
|
||||
}
|
||||
|
||||
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||
|
||||
// TODO: perform averaging for cells sharing more than one boundary face
|
||||
}
|
||||
|
||||
|
||||
void kLowReWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Ceps2") << Ceps2_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
kLowReWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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::kLowReWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence kinetic energy wall function
|
||||
condition for low- and high-Reynolds number turbulent flow cases.
|
||||
|
||||
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||
switch-over y+ value derived from kappa and E.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Cmu | model coefficient | no | 0.09
|
||||
kappa | Von Karman constant | no | 0.41
|
||||
E | model coefficient | no | 9.8
|
||||
Ceps2 | model coefficient | no | 1.9
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type kLowReWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::fixedValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
kLowReWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef kLowReWallFunctionFvPatchScalarField_H
|
||||
#define kLowReWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class kLowReWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class kLowReWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchField<scalar>
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Ceps2 coefficient
|
||||
scalar Ceps2_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("kLowReWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given kLowReWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const kLowReWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const kLowReWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new kLowReWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
kLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const kLowReWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new kLowReWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate(const Pstream::commsTypes);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "kqRWallFunctionFvPatchField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void kqRWallFunctionFvPatchField<Type>::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(this->patch()))
|
||||
{
|
||||
FatalErrorIn("kqRWallFunctionFvPatchField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << this->patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << this->patch().type()
|
||||
<< nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
kqRWallFunctionFvPatchField<Type>::kqRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(p, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kqRWallFunctionFvPatchField<Type>::kqRWallFunctionFvPatchField
|
||||
(
|
||||
const kqRWallFunctionFvPatchField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(ptf, p, iF, mapper)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kqRWallFunctionFvPatchField<Type>::kqRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(p, iF, dict)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kqRWallFunctionFvPatchField<Type>::kqRWallFunctionFvPatchField
|
||||
(
|
||||
const kqRWallFunctionFvPatchField& tkqrwfpf
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(tkqrwfpf)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kqRWallFunctionFvPatchField<Type>::kqRWallFunctionFvPatchField
|
||||
(
|
||||
const kqRWallFunctionFvPatchField& tkqrwfpf,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(tkqrwfpf, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void kqRWallFunctionFvPatchField<Type>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
zeroGradientFvPatchField<Type>::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
zeroGradientFvPatchField<Type>::write(os);
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,182 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::kqRWallFunctionFvPatchField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a suitable condition for turbulence
|
||||
\c k, \c q, and \c R fields for the case of high Reynolds number flow using
|
||||
wall functions.
|
||||
|
||||
It is a simple wrapper around the zero-gradient condition.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type kqRWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::zeroGradientFvPatchField
|
||||
|
||||
SourceFiles
|
||||
kqRWallFunctionFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef kqRWallFunctionFvPatchField_H
|
||||
#define kqRWallFunctionFvPatchField_H
|
||||
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class kqRWallFunctionFvPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class kqRWallFunctionFvPatchField
|
||||
:
|
||||
public zeroGradientFvPatchField<Type>
|
||||
{
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("kqRWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
kqRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
kqRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// kqRWallFunctionFvPatchField
|
||||
// onto a new patch
|
||||
kqRWallFunctionFvPatchField
|
||||
(
|
||||
const kqRWallFunctionFvPatchField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
kqRWallFunctionFvPatchField
|
||||
(
|
||||
const kqRWallFunctionFvPatchField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<Type> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new kqRWallFunctionFvPatchField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
kqRWallFunctionFvPatchField
|
||||
(
|
||||
const kqRWallFunctionFvPatchField&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new kqRWallFunctionFvPatchField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "kqRWallFunctionFvPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "kqRWallFunctionFvPatchFields.H"
|
||||
#include "fvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePatchFields(kqRWallFunction);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef kqRWallFunctionFvPatchFields_H
|
||||
#define kqRWallFunctionFvPatchFields_H
|
||||
|
||||
#include "kqRWallFunctionFvPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeFieldTypedefs(kqRWallFunction);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutLowReWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
return tmp<scalarField>(new scalarField(patch().size(), 0.0));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutLowReWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(nlrwfpsf)
|
||||
{}
|
||||
|
||||
|
||||
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(nlrwfpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
|
||||
return y*sqrt(nuw*mag(Uw.snGrad()))/nuw;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutLowReWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,163 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutLowReWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
for use with low Reynolds number models. It sets \c nut to zero, and
|
||||
provides an access function to calculate y+.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutLowReWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutLowReWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutLowReWallFunctionFvPatchScalarField_H
|
||||
#define nutLowReWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutLowReWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutLowReWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutLowReWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutLowReWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutLowReWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutLowReWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutLowReWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutLowReWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutLowReWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutLowReWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,319 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutURoughWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
// The flow velocity at the adjacent cell centre
|
||||
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
|
||||
|
||||
tmp<scalarField> tyPlus = calcYPlus(magUp);
|
||||
scalarField& yPlus = tyPlus();
|
||||
|
||||
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& nutw = tnutw();
|
||||
|
||||
forAll(yPlus, facei)
|
||||
{
|
||||
if (yPlus[facei] > yPlusLam_)
|
||||
{
|
||||
const scalar Re = magUp[facei]*y[facei]/nuw[facei] + ROOTVSMALL;
|
||||
nutw[facei] = nuw[facei]*(sqr(yPlus[facei])/Re - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return tnutw;
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
|
||||
(
|
||||
const scalarField& magUp
|
||||
) const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
|
||||
scalarField& yPlus = tyPlus();
|
||||
|
||||
if (roughnessHeight_ > 0.0)
|
||||
{
|
||||
// Rough Walls
|
||||
const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_;
|
||||
static const scalar c_2 = 2.25/(90 - 2.25);
|
||||
static const scalar c_3 = 2.0*atan(1.0)/log(90/2.25);
|
||||
static const scalar c_4 = c_3*log(2.25);
|
||||
|
||||
//if (KsPlusBasedOnYPlus_)
|
||||
{
|
||||
// If KsPlus is based on YPlus the extra term added to the law
|
||||
// of the wall will depend on yPlus
|
||||
forAll(yPlus, facei)
|
||||
{
|
||||
const scalar magUpara = magUp[facei];
|
||||
const scalar Re = magUpara*y[facei]/nuw[facei];
|
||||
const scalar kappaRe = kappa_*Re;
|
||||
|
||||
scalar yp = yPlusLam_;
|
||||
const scalar ryPlusLam = 1.0/yp;
|
||||
|
||||
int iter = 0;
|
||||
scalar yPlusLast = 0.0;
|
||||
scalar dKsPlusdYPlus = roughnessHeight_/y[facei];
|
||||
|
||||
// Additional tuning parameter - nominally = 1
|
||||
dKsPlusdYPlus *= roughnessFactor_;
|
||||
|
||||
do
|
||||
{
|
||||
yPlusLast = yp;
|
||||
|
||||
// The non-dimensional roughness height
|
||||
scalar KsPlus = yp*dKsPlusdYPlus;
|
||||
|
||||
// The extra term in the law-of-the-wall
|
||||
scalar G = 0.0;
|
||||
|
||||
scalar yPlusGPrime = 0.0;
|
||||
|
||||
if (KsPlus >= 90)
|
||||
{
|
||||
const scalar t_1 = 1 + roughnessConstant_*KsPlus;
|
||||
G = log(t_1);
|
||||
yPlusGPrime = roughnessConstant_*KsPlus/t_1;
|
||||
}
|
||||
else if (KsPlus > 2.25)
|
||||
{
|
||||
const scalar t_1 = c_1*KsPlus - c_2;
|
||||
const scalar t_2 = c_3*log(KsPlus) - c_4;
|
||||
const scalar sint_2 = sin(t_2);
|
||||
const scalar logt_1 = log(t_1);
|
||||
G = logt_1*sint_2;
|
||||
yPlusGPrime =
|
||||
(c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*cos(t_2));
|
||||
}
|
||||
|
||||
scalar denom = 1.0 + log(E_*yp) - G - yPlusGPrime;
|
||||
if (mag(denom) > VSMALL)
|
||||
{
|
||||
yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
|
||||
}
|
||||
} while
|
||||
(
|
||||
mag(ryPlusLam*(yp - yPlusLast)) > 0.0001
|
||||
&& ++iter < 10
|
||||
&& yp > VSMALL
|
||||
);
|
||||
|
||||
yPlus[facei] = max(0.0, yp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Smooth Walls
|
||||
forAll(yPlus, facei)
|
||||
{
|
||||
const scalar magUpara = magUp[facei];
|
||||
const scalar Re = magUpara*y[facei]/nuw[facei];
|
||||
const scalar kappaRe = kappa_*Re;
|
||||
|
||||
scalar yp = yPlusLam_;
|
||||
const scalar ryPlusLam = 1.0/yp;
|
||||
|
||||
int iter = 0;
|
||||
scalar yPlusLast = 0.0;
|
||||
|
||||
do
|
||||
{
|
||||
yPlusLast = yp;
|
||||
yp = (kappaRe + yp)/(1.0 + log(E_*yp));
|
||||
|
||||
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.0001 && ++iter < 10);
|
||||
|
||||
yPlus[facei] = max(0.0, yp);
|
||||
}
|
||||
}
|
||||
|
||||
return tyPlus;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF),
|
||||
roughnessHeight_(pTraits<scalar>::zero),
|
||||
roughnessConstant_(pTraits<scalar>::zero),
|
||||
roughnessFactor_(pTraits<scalar>::zero)
|
||||
{}
|
||||
|
||||
|
||||
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutURoughWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
roughnessHeight_(ptf.roughnessHeight_),
|
||||
roughnessConstant_(ptf.roughnessConstant_),
|
||||
roughnessFactor_(ptf.roughnessFactor_)
|
||||
{}
|
||||
|
||||
|
||||
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
|
||||
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
|
||||
roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
|
||||
{}
|
||||
|
||||
|
||||
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutURoughWallFunctionFvPatchScalarField& rwfpsf
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(rwfpsf),
|
||||
roughnessHeight_(rwfpsf.roughnessHeight_),
|
||||
roughnessConstant_(rwfpsf.roughnessConstant_),
|
||||
roughnessFactor_(rwfpsf.roughnessFactor_)
|
||||
{}
|
||||
|
||||
|
||||
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutURoughWallFunctionFvPatchScalarField& rwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(rwfpsf, iF),
|
||||
roughnessHeight_(rwfpsf.roughnessHeight_),
|
||||
roughnessConstant_(rwfpsf.roughnessConstant_),
|
||||
roughnessFactor_(rwfpsf.roughnessFactor_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw);
|
||||
|
||||
return calcYPlus(magUp());
|
||||
}
|
||||
|
||||
|
||||
void nutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
os.writeKeyword("roughnessHeight")
|
||||
<< roughnessHeight_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("roughnessConstant")
|
||||
<< roughnessConstant_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("roughnessFactor")
|
||||
<< roughnessFactor_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutURoughWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,238 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutURoughWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions for rough walls, based on velocity.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
roughnessHeight | roughness height | yes |
|
||||
roughnessConstant | roughness constanr | yes |
|
||||
roughnessFactor | scaling factor | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutURoughWallFunction;
|
||||
roughnessHeight 1e-5;
|
||||
roughnessConstant 0.5;
|
||||
roughnessFactor 1;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutURoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutURoughWallFunctionFvPatchScalarField_H
|
||||
#define nutURoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutURoughWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutURoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
// Roughness model parameters
|
||||
|
||||
//- Height
|
||||
scalar roughnessHeight_;
|
||||
|
||||
//- Constant
|
||||
scalar roughnessConstant_;
|
||||
|
||||
//- Scale factor
|
||||
scalar roughnessFactor_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate yPLus
|
||||
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutURoughWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutURoughWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutURoughWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutURoughWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutURoughWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutURoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutURoughWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutURoughWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the roughness height
|
||||
scalar roughnessHeight() const
|
||||
{
|
||||
return roughnessHeight_;
|
||||
}
|
||||
|
||||
//- Return reference to the roughness height to allow adjustment
|
||||
scalar& roughnessHeight()
|
||||
{
|
||||
return roughnessHeight_;
|
||||
}
|
||||
|
||||
|
||||
//- Return the roughness constant scale
|
||||
scalar roughnessConstant() const
|
||||
{
|
||||
return roughnessConstant_;
|
||||
}
|
||||
|
||||
//- Return reference to the roughness constant to allow adjustment
|
||||
scalar& roughnessConstant()
|
||||
{
|
||||
return roughnessConstant_;
|
||||
}
|
||||
|
||||
//- Return the roughness scale factor
|
||||
scalar roughnessFactor() const
|
||||
{
|
||||
return roughnessFactor_;
|
||||
}
|
||||
|
||||
//- Return reference to the roughness scale factor to allow
|
||||
// adjustment
|
||||
scalar& roughnessFactor()
|
||||
{
|
||||
return roughnessFactor_;
|
||||
}
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,232 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutUSpaldingWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const scalarField magGradU(mag(Uw.snGrad()));
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
return max
|
||||
(
|
||||
scalar(0),
|
||||
sqr(calcUTau(magGradU))/(magGradU + ROOTVSMALL) - nuw
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
|
||||
(
|
||||
const scalarField& magGradU
|
||||
) const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
|
||||
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalarField& nutw = *this;
|
||||
|
||||
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
|
||||
scalarField& uTau = tuTau();
|
||||
|
||||
forAll(uTau, faceI)
|
||||
{
|
||||
scalar ut = sqrt((nutw[faceI] + nuw[faceI])*magGradU[faceI]);
|
||||
|
||||
if (ut > ROOTVSMALL)
|
||||
{
|
||||
int iter = 0;
|
||||
scalar err = GREAT;
|
||||
|
||||
do
|
||||
{
|
||||
scalar kUu = min(kappa_*magUp[faceI]/ut, 50);
|
||||
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
|
||||
|
||||
scalar f =
|
||||
- ut*y[faceI]/nuw[faceI]
|
||||
+ magUp[faceI]/ut
|
||||
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
|
||||
|
||||
scalar df =
|
||||
y[faceI]/nuw[faceI]
|
||||
+ magUp[faceI]/sqr(ut)
|
||||
+ 1/E_*kUu*fkUu/ut;
|
||||
|
||||
scalar uTauNew = ut + f/df;
|
||||
err = mag((ut - uTauNew)/ut);
|
||||
ut = uTauNew;
|
||||
|
||||
} while (ut > ROOTVSMALL && err > 0.01 && ++iter < 10);
|
||||
|
||||
uTau[faceI] = max(0.0, ut);
|
||||
}
|
||||
}
|
||||
|
||||
return tuTau;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutUSpaldingWallFunctionFvPatchScalarField::
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
nutUSpaldingWallFunctionFvPatchScalarField::
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUSpaldingWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
nutUSpaldingWallFunctionFvPatchScalarField::
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
nutUSpaldingWallFunctionFvPatchScalarField::
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUSpaldingWallFunctionFvPatchScalarField& wfpsf
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(wfpsf)
|
||||
{}
|
||||
|
||||
|
||||
nutUSpaldingWallFunctionFvPatchScalarField::
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUSpaldingWallFunctionFvPatchScalarField& wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(wfpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
return y*calcUTau(mag(Uw.snGrad()))/nuw;
|
||||
}
|
||||
|
||||
|
||||
void nutUSpaldingWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,187 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutUSpaldingWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions for rough walls, based on velocity, using
|
||||
Spalding's law to give a continuous nut profile to the wall (y+ = 0)
|
||||
|
||||
\f[
|
||||
y^+ = u^+ + \frac{1}{E} \left[exp(\kappa u^+) - 1 - \kappa u^+\,
|
||||
- 0.5 (\kappa u^+)^2 - \frac{1}{6} (\kappa u^+)^3\right]
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
y^+ | non-dimensional position
|
||||
u^+ | non-dimensional velocity
|
||||
\kappa | Von Karman constant
|
||||
\endvartable
|
||||
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutUSpaldingWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutUSpaldingWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutUSpaldingWallFunctionFvPatchScalarField_H
|
||||
#define nutUSpaldingWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutUSpaldingWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutUSpaldingWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
//- Calculate the friction velocity
|
||||
virtual tmp<scalarField> calcUTau(const scalarField& magGradU) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutUSpaldingWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutUSpaldingWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUSpaldingWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUSpaldingWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutUSpaldingWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutUSpaldingWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUSpaldingWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutUSpaldingWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,225 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutUTabulatedWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
|
||||
const scalarField magGradU(mag(Uw.snGrad()));
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
return
|
||||
max
|
||||
(
|
||||
scalar(0),
|
||||
sqr(magUp/(calcUPlus(magUp*y/nuw) + ROOTVSMALL))
|
||||
/(magGradU + ROOTVSMALL)
|
||||
- nuw
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcUPlus
|
||||
(
|
||||
const scalarField& Rey
|
||||
) const
|
||||
{
|
||||
tmp<scalarField> tuPlus(new scalarField(patch().size(), 0.0));
|
||||
scalarField& uPlus = tuPlus();
|
||||
|
||||
forAll(uPlus, faceI)
|
||||
{
|
||||
uPlus[faceI] = uPlusTable_.interpolateLog10(Rey[faceI]);
|
||||
}
|
||||
|
||||
return tuPlus;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutUTabulatedWallFunctionFvPatchScalarField::
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF),
|
||||
uPlusTableName_("undefined-uPlusTableName"),
|
||||
uPlusTable_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
uPlusTableName_,
|
||||
patch().boundaryMesh().mesh().time().constant(),
|
||||
patch().boundaryMesh().mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
false
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
nutUTabulatedWallFunctionFvPatchScalarField::
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUTabulatedWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
uPlusTableName_(ptf.uPlusTableName_),
|
||||
uPlusTable_(ptf.uPlusTable_)
|
||||
{}
|
||||
|
||||
|
||||
nutUTabulatedWallFunctionFvPatchScalarField::
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
uPlusTableName_(dict.lookup("uPlusTable")),
|
||||
uPlusTable_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
uPlusTableName_,
|
||||
patch().boundaryMesh().mesh().time().constant(),
|
||||
patch().boundaryMesh().mesh(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
true
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
nutUTabulatedWallFunctionFvPatchScalarField::
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUTabulatedWallFunctionFvPatchScalarField& wfpsf
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(wfpsf),
|
||||
uPlusTableName_(wfpsf.uPlusTableName_),
|
||||
uPlusTable_(wfpsf.uPlusTable_)
|
||||
{}
|
||||
|
||||
|
||||
nutUTabulatedWallFunctionFvPatchScalarField::
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUTabulatedWallFunctionFvPatchScalarField& wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(wfpsf, iF),
|
||||
uPlusTableName_(wfpsf.uPlusTableName_),
|
||||
uPlusTable_(wfpsf.uPlusTable_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
const scalarField Rey(magUp*y/nuw);
|
||||
|
||||
return Rey/(calcUPlus(Rey) + ROOTVSMALL);
|
||||
}
|
||||
|
||||
|
||||
void nutUTabulatedWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("uPlusTable") << uPlusTableName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,195 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutUTabulatedWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions. As input, the user specifies a look-up table
|
||||
of U+ as a function of near-wall Reynolds number. The table should be
|
||||
located in the $FOAM_CASE/constant folder.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
uPlusTable | U+ as a function of Re table name | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutTabulatedWallFunction;
|
||||
uPlusTable myUPlusTable;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The tables are not registered since the same table object may be used for
|
||||
more than one patch.
|
||||
|
||||
SeeAlso
|
||||
Foam::nutWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutUTabulatedWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutUTabulatedWallFunctionFvPatchScalarField_H
|
||||
#define nutUTabulatedWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
#include "uniformInterpolationTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutUTabulatedWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutUTabulatedWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of u+ table
|
||||
word uPlusTableName_;
|
||||
|
||||
//- U+ table
|
||||
uniformInterpolationTable<scalar> uPlusTable_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
//- Calculate wall u+ from table
|
||||
virtual tmp<scalarField> calcUPlus(const scalarField& Rey) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutTabulatedWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutUTabulatedWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUTabulatedWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUTabulatedWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutUTabulatedWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutUTabulatedWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUTabulatedWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutUTabulatedWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,215 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutUWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
tmp<scalarField> tyPlus = calcYPlus(magUp);
|
||||
scalarField& yPlus = tyPlus();
|
||||
|
||||
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& nutw = tnutw();
|
||||
|
||||
forAll(yPlus, facei)
|
||||
{
|
||||
if (yPlus[facei] > yPlusLam_)
|
||||
{
|
||||
nutw[facei] =
|
||||
nuw[facei]*(yPlus[facei]*kappa_/log(E_*yPlus[facei]) - 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
return tnutw;
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
|
||||
(
|
||||
const scalarField& magUp
|
||||
) const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
|
||||
scalarField& yPlus = tyPlus();
|
||||
|
||||
forAll(yPlus, facei)
|
||||
{
|
||||
scalar kappaRe = kappa_*magUp[facei]*y[facei]/nuw[facei];
|
||||
|
||||
scalar yp = yPlusLam_;
|
||||
scalar ryPlusLam = 1.0/yp;
|
||||
|
||||
int iter = 0;
|
||||
scalar yPlusLast = 0.0;
|
||||
|
||||
do
|
||||
{
|
||||
yPlusLast = yp;
|
||||
yp = (kappaRe + yp)/(1.0 + log(E_*yp));
|
||||
|
||||
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.01 && ++iter < 10 );
|
||||
|
||||
yPlus[facei] = max(0.0, yp);
|
||||
}
|
||||
|
||||
return tyPlus;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUWallFunctionFvPatchScalarField& sawfpsf
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(sawfpsf)
|
||||
{}
|
||||
|
||||
|
||||
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUWallFunctionFvPatchScalarField& sawfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(sawfpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
|
||||
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
|
||||
|
||||
return calcYPlus(magUp);
|
||||
}
|
||||
|
||||
|
||||
void nutUWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutUWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutUWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions, based on velocity.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutUWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutUWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutUWallFunctionFvPatchScalarField_H
|
||||
#define nutUWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutUWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutUWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate yPLus
|
||||
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutUWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutUWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutUWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutUWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutUWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutUWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / 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 "nutWallFunctionFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void nutWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("nutWallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutWallFunctionFvPatchScalarField& wfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(wfpsf),
|
||||
Cmu_(wfpsf.Cmu_),
|
||||
kappa_(wfpsf.kappa_),
|
||||
E_(wfpsf.E_),
|
||||
yPlusLam_(wfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutWallFunctionFvPatchScalarField& wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(wfpsf, iF),
|
||||
Cmu_(wfpsf.Cmu_),
|
||||
kappa_(wfpsf.kappa_),
|
||||
E_(wfpsf.E_),
|
||||
yPlusLam_(wfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalar nutWallFunctionFvPatchScalarField::yPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
)
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(max(E*ypl, 1))/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
void nutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
operator==(calcNut());
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,178 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions, based on turbulence kinetic energy.
|
||||
- replicates OpenFOAM v1.5 (and earlier) behaviour
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::fixedValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
nutWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutWallFunctionFvPatchScalarField_H
|
||||
#define nutWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const = 0;
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
static scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const = 0;
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutkAtmRoughWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbulence.y()[patchi];
|
||||
const tmp<volScalarField> tk = turbulence.k();
|
||||
const volScalarField& k = tk();
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
tmp<scalarField> tnutw(new scalarField(*this));
|
||||
scalarField& nutw = tnutw();
|
||||
|
||||
forAll(nutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar uStar = Cmu25*sqrt(k[faceCellI]);
|
||||
scalar yPlus = uStar*y[faceI]/nuw[faceI];
|
||||
|
||||
scalar Edash = (y[faceI] + z0_[faceI])/z0_[faceI];
|
||||
|
||||
nutw[faceI] =
|
||||
nuw[faceI]*(yPlus*kappa_/log(max(Edash, 1+1e-4)) - 1);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "yPlus = " << yPlus
|
||||
<< ", Edash = " << Edash
|
||||
<< ", nutw = " << nutw[faceI]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
return tnutw;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField::
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(p, iF),
|
||||
z0_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField::
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
z0_(ptf.z0_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField::
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
z0_("z0", dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField::
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField& rwfpsf
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(rwfpsf),
|
||||
z0_(rwfpsf.z0_)
|
||||
{}
|
||||
|
||||
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField::
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField& rwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(rwfpsf, iF),
|
||||
z0_(rwfpsf.z0_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void nutkAtmRoughWallFunctionFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
nutkWallFunctionFvPatchScalarField::autoMap(m);
|
||||
z0_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void nutkAtmRoughWallFunctionFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
nutkWallFunctionFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField& nrwfpsf =
|
||||
refCast<const nutkAtmRoughWallFunctionFvPatchScalarField>(ptf);
|
||||
|
||||
z0_.rmap(nrwfpsf.z0_, addr);
|
||||
}
|
||||
|
||||
|
||||
void nutkAtmRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
z0_.writeEntry("z0", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,214 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity for
|
||||
atmospheric velocity profiles. It is desinged to be used in conjunction
|
||||
with the atmBoundaryLayerInletVelocity boundary condition. The values
|
||||
are calculated using:
|
||||
|
||||
\f[
|
||||
U = frac{U_f}{K} ln(\frac{z + z_0}{z_0})
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
U_f | frictional velocity
|
||||
K | Von Karman's constant
|
||||
z_0 | surface roughness length
|
||||
z | vertical co-ordinate
|
||||
\endvartable
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
z0 | surface roughness length| yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutkAtmRoughWallFunction;
|
||||
z0 uniform 0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutkWallFunctionFvPatchField
|
||||
|
||||
SourceFiles
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutkAtmRoughWallFunctionFvPatchScalarField_H
|
||||
#define nutkAtmRoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutkWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutkAtmRoughWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutkWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Surface roughness length
|
||||
scalarField z0_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutkAtmRoughWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutkAtmRoughWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutkAtmRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkAtmRoughWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutkAtmRoughWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Acces functions
|
||||
|
||||
// Return z0
|
||||
scalarField& z0()
|
||||
{
|
||||
return z0_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,243 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "nutkRoughWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
scalar nutkRoughWallFunctionFvPatchScalarField::fnRough
|
||||
(
|
||||
const scalar KsPlus,
|
||||
const scalar Cs
|
||||
) const
|
||||
{
|
||||
// Return fn based on non-dimensional roughness height
|
||||
|
||||
if (KsPlus < 90.0)
|
||||
{
|
||||
return pow
|
||||
(
|
||||
(KsPlus - 2.25)/87.75 + Cs*KsPlus,
|
||||
sin(0.4258*(log(KsPlus) - 0.811))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (1.0 + Cs*KsPlus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const tmp<volScalarField> tk = turbModel.k();
|
||||
const volScalarField& k = tk();
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
tmp<scalarField> tnutw(new scalarField(*this));
|
||||
scalarField& nutw = tnutw();
|
||||
|
||||
forAll(nutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar uStar = Cmu25*sqrt(k[faceCellI]);
|
||||
scalar yPlus = uStar*y[faceI]/nuw[faceI];
|
||||
scalar KsPlus = uStar*Ks_[faceI]/nuw[faceI];
|
||||
|
||||
scalar Edash = E_;
|
||||
if (KsPlus > 2.25)
|
||||
{
|
||||
Edash /= fnRough(KsPlus, Cs_[faceI]);
|
||||
}
|
||||
|
||||
scalar limitingNutw = max(nutw[faceI], nuw[faceI]);
|
||||
|
||||
// To avoid oscillations limit the change in the wall viscosity
|
||||
// which is particularly important if it temporarily becomes zero
|
||||
nutw[faceI] =
|
||||
max
|
||||
(
|
||||
min
|
||||
(
|
||||
nuw[faceI]
|
||||
*(yPlus*kappa_/log(max(Edash*yPlus, 1+1e-4)) - 1),
|
||||
2*limitingNutw
|
||||
), 0.5*limitingNutw
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "yPlus = " << yPlus
|
||||
<< ", KsPlus = " << KsPlus
|
||||
<< ", Edash = " << Edash
|
||||
<< ", nutw = " << nutw[faceI]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
return tnutw;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(p, iF),
|
||||
Ks_(p.size(), 0.0),
|
||||
Cs_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkRoughWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
|
||||
Ks_(ptf.Ks_, mapper),
|
||||
Cs_(ptf.Cs_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
Ks_("Ks", dict, p.size()),
|
||||
Cs_("Cs", dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(rwfpsf),
|
||||
Ks_(rwfpsf.Ks_),
|
||||
Cs_(rwfpsf.Cs_)
|
||||
{}
|
||||
|
||||
|
||||
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(rwfpsf, iF),
|
||||
Ks_(rwfpsf.Ks_),
|
||||
Cs_(rwfpsf.Cs_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void nutkRoughWallFunctionFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
nutkWallFunctionFvPatchScalarField::autoMap(m);
|
||||
Ks_.autoMap(m);
|
||||
Cs_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void nutkRoughWallFunctionFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
nutkWallFunctionFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const nutkRoughWallFunctionFvPatchScalarField& nrwfpsf =
|
||||
refCast<const nutkRoughWallFunctionFvPatchScalarField>(ptf);
|
||||
|
||||
Ks_.rmap(nrwfpsf.Ks_, addr);
|
||||
Cs_.rmap(nrwfpsf.Cs_, addr);
|
||||
}
|
||||
|
||||
|
||||
void nutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
Cs_.writeEntry("Cs", os);
|
||||
Ks_.writeEntry("Ks", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutkRoughWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,218 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutkRoughWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions for rough walls, based on turbulence kinetic
|
||||
energy. The condition manipulates the E parameter to account for roughness
|
||||
effects.
|
||||
|
||||
Parameter ranges
|
||||
- roughness height = sand-grain roughness (0 for smooth walls)
|
||||
- roughness constant = 0.5-1.0
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Ks | sand-grain roughness height | yes |
|
||||
Cs | roughness constant | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutkRoughWallFunction;
|
||||
Ks uniform 0;
|
||||
Cs uniform 0.5;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutkRoughWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutkRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutkRoughWallFunctionFvPatchScalarField_H
|
||||
#define nutkRoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutkWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutkRoughWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutkRoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutkWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Roughness height
|
||||
scalarField Ks_;
|
||||
|
||||
//- Roughness constant
|
||||
scalarField Cs_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Compute the roughness function
|
||||
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const;
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutkRoughWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutkRoughWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkRoughWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkRoughWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutkRoughWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutkRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkRoughWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutkRoughWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Acces functions
|
||||
|
||||
// Return Ks
|
||||
scalarField& Ks()
|
||||
{
|
||||
return Ks_;
|
||||
}
|
||||
|
||||
// Return Cs
|
||||
scalarField& Cs()
|
||||
{
|
||||
return Cs_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / 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 "nutkWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
const tmp<volScalarField> tk = turbModel.k();
|
||||
const volScalarField& k = tk();
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
|
||||
scalarField& nutw = tnutw();
|
||||
|
||||
forAll(nutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
|
||||
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
nutw[faceI] = nuw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
return tnutw;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkWallFunctionFvPatchScalarField& wfpsf
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(wfpsf)
|
||||
{}
|
||||
|
||||
|
||||
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkWallFunctionFvPatchScalarField& wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
nutWallFunctionFvPatchScalarField(wfpsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
const scalarField& y = turbModel.y()[patchi];
|
||||
|
||||
const tmp<volScalarField> tk = turbModel.k();
|
||||
const volScalarField& k = tk();
|
||||
tmp<scalarField> kwc = k.boundaryField()[patchi].patchInternalField();
|
||||
const tmp<scalarField> tnuw = turbModel.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
return pow025(Cmu_)*y*sqrt(kwc)/nuw;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
nutkWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,163 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::nutkWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulent kinematic viscosity condition
|
||||
when using wall functions, based on turbulence kinetic energy.
|
||||
- replicates OpenFOAM v1.5 (and earlier) behaviour
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type nutkWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::nutWallFunctionFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
nutkWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nutkWallFunctionFvPatchScalarField_H
|
||||
#define nutkWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "nutWallFunctionFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutkWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutkWallFunctionFvPatchScalarField
|
||||
:
|
||||
public nutWallFunctionFvPatchScalarField
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Calculate the turbulence viscosity
|
||||
virtual tmp<scalarField> calcNut() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nutkWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// nutkWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutkWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nutkWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nutkWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new nutkWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Calculate and return the yPlus at the boundary
|
||||
virtual tmp<scalarField> yPlus() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,606 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "omegaWallFunctionFvPatchScalarField.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "volFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "nutkWallFunctionFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("omegaWallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::setMaster()
|
||||
{
|
||||
if (master_ != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const volScalarField& omega =
|
||||
static_cast<const volScalarField&>(this->dimensionedInternalField());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& bf = omega.boundaryField();
|
||||
|
||||
label master = -1;
|
||||
forAll(bf, patchi)
|
||||
{
|
||||
if (isA<omegaWallFunctionFvPatchScalarField>(bf[patchi]))
|
||||
{
|
||||
omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchi);
|
||||
|
||||
if (master == -1)
|
||||
{
|
||||
master = patchi;
|
||||
}
|
||||
|
||||
epf.master() = master;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::createAveragingWeights()
|
||||
{
|
||||
if (initialised_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const volScalarField& omega =
|
||||
static_cast<const volScalarField&>(this->dimensionedInternalField());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& bf = omega.boundaryField();
|
||||
|
||||
const fvMesh& mesh = omega.mesh();
|
||||
|
||||
volScalarField weights
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"weights",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // do not register
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimless, 0.0)
|
||||
);
|
||||
|
||||
DynamicList<label> omegaPatches(bf.size());
|
||||
forAll(bf, patchi)
|
||||
{
|
||||
if (isA<omegaWallFunctionFvPatchScalarField>(bf[patchi]))
|
||||
{
|
||||
omegaPatches.append(patchi);
|
||||
|
||||
const labelUList& faceCells = bf[patchi].patch().faceCells();
|
||||
forAll(faceCells, i)
|
||||
{
|
||||
label cellI = faceCells[i];
|
||||
weights[cellI]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cornerWeights_.setSize(bf.size());
|
||||
forAll(omegaPatches, i)
|
||||
{
|
||||
label patchi = omegaPatches[i];
|
||||
const fvPatchScalarField& wf = weights.boundaryField()[patchi];
|
||||
cornerWeights_[patchi] = 1.0/wf.patchInternalField();
|
||||
}
|
||||
|
||||
G_.setSize(dimensionedInternalField().size(), 0.0);
|
||||
omega_.setSize(dimensionedInternalField().size(), 0.0);
|
||||
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField&
|
||||
omegaWallFunctionFvPatchScalarField::omegaPatch(const label patchi)
|
||||
{
|
||||
const volScalarField& omega =
|
||||
static_cast<const volScalarField&>(this->dimensionedInternalField());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& bf = omega.boundaryField();
|
||||
|
||||
const omegaWallFunctionFvPatchScalarField& epf =
|
||||
refCast<const omegaWallFunctionFvPatchScalarField>(bf[patchi]);
|
||||
|
||||
return const_cast<omegaWallFunctionFvPatchScalarField&>(epf);
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
scalarField& G0,
|
||||
scalarField& omega0
|
||||
)
|
||||
{
|
||||
// accumulate all of the G and omega contributions
|
||||
forAll(cornerWeights_, patchi)
|
||||
{
|
||||
if (!cornerWeights_[patchi].empty())
|
||||
{
|
||||
omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchi);
|
||||
|
||||
const List<scalar>& w = cornerWeights_[patchi];
|
||||
|
||||
epf.calculate(turbulence, w, epf.patch(), G0, omega0);
|
||||
}
|
||||
}
|
||||
|
||||
// apply zero-gradient condition for omega
|
||||
forAll(cornerWeights_, patchi)
|
||||
{
|
||||
if (!cornerWeights_[patchi].empty())
|
||||
{
|
||||
omegaWallFunctionFvPatchScalarField& epf = omegaPatch(patchi);
|
||||
|
||||
epf == scalarField(omega0, epf.patch().faceCells());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::calculate
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
const List<scalar>& cornerWeights,
|
||||
const fvPatch& patch,
|
||||
scalarField& G,
|
||||
scalarField& omega
|
||||
)
|
||||
{
|
||||
const label patchi = patch.index();
|
||||
|
||||
const scalarField& y = turbulence.y()[patchi];
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
const tmp<volScalarField> tk = turbulence.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const tmp<scalarField> tnutw = turbulence.nut(patchi);
|
||||
const scalarField& nutw = tnutw();
|
||||
|
||||
const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchi];
|
||||
|
||||
const scalarField magGradUw(mag(Uw.snGrad()));
|
||||
|
||||
// Set omega and G
|
||||
forAll(nutw, faceI)
|
||||
{
|
||||
label cellI = patch.faceCells()[faceI];
|
||||
|
||||
scalar w = cornerWeights[faceI];
|
||||
|
||||
scalar omegaVis = 6.0*nuw[faceI]/(beta1_*sqr(y[faceI]));
|
||||
|
||||
scalar omegaLog = sqrt(k[cellI])/(Cmu25*kappa_*y[faceI]);
|
||||
|
||||
omega[cellI] += w*sqrt(sqr(omegaVis) + sqr(omegaLog));
|
||||
|
||||
G[cellI] +=
|
||||
w
|
||||
*(nutw[faceI] + nuw[faceI])
|
||||
*magGradUw[faceI]
|
||||
*Cmu25*sqrt(k[cellI])
|
||||
/(kappa_*y[faceI]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
beta1_(0.075),
|
||||
yPlusLam_(nutkWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)),
|
||||
G_(),
|
||||
omega_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
beta1_(ptf.beta1_),
|
||||
yPlusLam_(ptf.yPlusLam_),
|
||||
G_(),
|
||||
omega_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)),
|
||||
yPlusLam_(nutkWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_)),
|
||||
G_(),
|
||||
omega_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
|
||||
// apply zero-gradient condition on start-up
|
||||
this->operator==(patchInternalField());
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField& owfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(owfpsf),
|
||||
Cmu_(owfpsf.Cmu_),
|
||||
kappa_(owfpsf.kappa_),
|
||||
E_(owfpsf.E_),
|
||||
beta1_(owfpsf.beta1_),
|
||||
yPlusLam_(owfpsf.yPlusLam_),
|
||||
G_(),
|
||||
omega_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField& owfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(owfpsf, iF),
|
||||
Cmu_(owfpsf.Cmu_),
|
||||
kappa_(owfpsf.kappa_),
|
||||
E_(owfpsf.E_),
|
||||
beta1_(owfpsf.beta1_),
|
||||
yPlusLam_(owfpsf.yPlusLam_),
|
||||
G_(),
|
||||
omega_(),
|
||||
initialised_(false),
|
||||
master_(-1),
|
||||
cornerWeights_()
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalarField& omegaWallFunctionFvPatchScalarField::G(bool init)
|
||||
{
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
G_ = 0.0;
|
||||
}
|
||||
|
||||
return G_;
|
||||
}
|
||||
|
||||
return omegaPatch(master_).G();
|
||||
}
|
||||
|
||||
|
||||
scalarField& omegaWallFunctionFvPatchScalarField::omega(bool init)
|
||||
{
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
omega_ = 0.0;
|
||||
}
|
||||
|
||||
return omega_;
|
||||
}
|
||||
|
||||
return omegaPatch(master_).omega(init);
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
setMaster();
|
||||
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
createAveragingWeights();
|
||||
calculateTurbulenceFields(turbulence, G(true), omega(true));
|
||||
}
|
||||
|
||||
const scalarField& G0 = this->G();
|
||||
const scalarField& omega0 = this->omega();
|
||||
|
||||
typedef DimensionedField<scalar, volMesh> FieldType;
|
||||
|
||||
FieldType& G =
|
||||
const_cast<FieldType&>
|
||||
(
|
||||
db().lookupObject<FieldType>(turbulence.GName())
|
||||
);
|
||||
|
||||
FieldType& omega = const_cast<FieldType&>(dimensionedInternalField());
|
||||
|
||||
forAll(*this, faceI)
|
||||
{
|
||||
label cellI = patch().faceCells()[faceI];
|
||||
|
||||
G[cellI] = G0[cellI];
|
||||
omega[cellI] = omega0[cellI];
|
||||
}
|
||||
|
||||
fvPatchField<scalar>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::updateCoeffs
|
||||
(
|
||||
const scalarField& weights
|
||||
)
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
setMaster();
|
||||
|
||||
if (patch().index() == master_)
|
||||
{
|
||||
createAveragingWeights();
|
||||
calculateTurbulenceFields(turbulence, G(true), omega(true));
|
||||
}
|
||||
|
||||
const scalarField& G0 = this->G();
|
||||
const scalarField& omega0 = this->omega();
|
||||
|
||||
typedef DimensionedField<scalar, volMesh> FieldType;
|
||||
|
||||
FieldType& G =
|
||||
const_cast<FieldType&>
|
||||
(
|
||||
db().lookupObject<FieldType>(turbulence.GName())
|
||||
);
|
||||
|
||||
FieldType& omega = const_cast<FieldType&>(dimensionedInternalField());
|
||||
|
||||
scalarField& omegaf = *this;
|
||||
|
||||
// only set the values if the weights are < 1 - tolerance
|
||||
forAll(weights, faceI)
|
||||
{
|
||||
scalar w = weights[faceI];
|
||||
|
||||
if (w < 1.0 - 1e-6)
|
||||
{
|
||||
label cellI = patch().faceCells()[faceI];
|
||||
|
||||
G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI];
|
||||
omega[cellI] = w*omega[cellI] + (1.0 - w)*omega0[cellI];
|
||||
omegaf[faceI] = omega[cellI];
|
||||
}
|
||||
}
|
||||
|
||||
fvPatchField<scalar>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::manipulateMatrix
|
||||
(
|
||||
fvMatrix<scalar>& matrix
|
||||
)
|
||||
{
|
||||
if (manipulatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
matrix.setValues(patch().faceCells(), patchInternalField());
|
||||
|
||||
fvPatchField<scalar>::manipulateMatrix(matrix);
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::manipulateMatrix
|
||||
(
|
||||
fvMatrix<scalar>& matrix,
|
||||
const Field<scalar>& weights
|
||||
)
|
||||
{
|
||||
if (manipulatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// filter weights so that we only apply the constraint where the
|
||||
// weight > SMALL
|
||||
DynamicList<label> constraintCells(weights.size());
|
||||
DynamicList<scalar> constraintomega(weights.size());
|
||||
const labelUList& faceCells = patch().faceCells();
|
||||
|
||||
const DimensionedField<scalar, volMesh>& omega
|
||||
= dimensionedInternalField();
|
||||
|
||||
label nConstrainedCells = 0;
|
||||
|
||||
|
||||
forAll(weights, faceI)
|
||||
{
|
||||
// only set the values if the weights are < 1 - tolerance
|
||||
if (weights[faceI] < (1.0 - 1e-6))
|
||||
{
|
||||
nConstrainedCells++;
|
||||
|
||||
label cellI = faceCells[faceI];
|
||||
|
||||
constraintCells.append(cellI);
|
||||
constraintomega.append(omega[cellI]);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Patch: " << patch().name()
|
||||
<< ": number of constrained cells = " << nConstrainedCells
|
||||
<< " out of " << patch().size()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
matrix.setValues
|
||||
(
|
||||
constraintCells,
|
||||
scalarField(constraintomega.xfer())
|
||||
);
|
||||
|
||||
fvPatchField<scalar>::manipulateMatrix(matrix);
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::write(os);
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,292 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::omegaWallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a wall function constraint on turbulnce
|
||||
specific dissipation, omega. The values are computed using:
|
||||
|
||||
\f[
|
||||
\omega = sqrt(\omega_{vis}^2 + \omega_{log}^2)
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
\omega_{vis} | omega in viscous region
|
||||
\omega_{log} | omega in logarithmic region
|
||||
\endvartable
|
||||
|
||||
Model described by Eq.(15) of:
|
||||
\verbatim
|
||||
Menter, F., Esch, T.
|
||||
"Elements of Industrial Heat Transfer Prediction"
|
||||
16th Brazilian Congress of Mechanical Engineering (COBEM),
|
||||
Nov. 2001
|
||||
\endverbatim
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Cmu | model coefficient | no | 0.09
|
||||
kappa | Von Karman constant | no | 0.41
|
||||
E | model coefficient | no | 9.8
|
||||
beta1 | model coefficient | no | 0.075
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type omegaWallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
omegaWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef omegaWallFunctionFvPatchScalarField_H
|
||||
#define omegaWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class turbulenceModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class omegaWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class omegaWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchField<scalar>
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- beta1 coefficient
|
||||
scalar beta1_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
//- Local copy of turbulence G field
|
||||
scalarField G_;
|
||||
|
||||
//- Local copy of turbulence omega field
|
||||
scalarField omega_;
|
||||
|
||||
//- Initialised flag
|
||||
bool initialised_;
|
||||
|
||||
//- Master patch ID
|
||||
label master_;
|
||||
|
||||
//- List of averaging corner weights
|
||||
List<List<scalar> > cornerWeights_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
//- Set the master patch - master is responsible for updating all
|
||||
// wall function patches
|
||||
virtual void setMaster();
|
||||
|
||||
//- Create the averaging weights for cells which are bounded by
|
||||
// multiple wall function faces
|
||||
virtual void createAveragingWeights();
|
||||
|
||||
//- Helper function to return non-const access to an omega patch
|
||||
virtual omegaWallFunctionFvPatchScalarField& omegaPatch
|
||||
(
|
||||
const label patchi
|
||||
);
|
||||
|
||||
//- Main driver to calculate the turbulence fields
|
||||
virtual void calculateTurbulenceFields
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
scalarField& G0,
|
||||
scalarField& omega0
|
||||
);
|
||||
|
||||
//- Calculate the omega and G
|
||||
virtual void calculate
|
||||
(
|
||||
const turbulenceModel& turbulence,
|
||||
const List<scalar>& cornerWeights,
|
||||
const fvPatch& patch,
|
||||
scalarField& G,
|
||||
scalarField& omega
|
||||
);
|
||||
|
||||
//- Return non-const access to the master patch ID
|
||||
virtual label& master()
|
||||
{
|
||||
return master_;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("omegaWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// omegaWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new omegaWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new omegaWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return non-const access to the master's G field
|
||||
scalarField& G(bool init = false);
|
||||
|
||||
//- Return non-const access to the master's omega field
|
||||
scalarField& omega(bool init = false);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs(const scalarField& weights);
|
||||
|
||||
//- Manipulate matrix
|
||||
virtual void manipulateMatrix(fvMatrix<scalar>& matrix);
|
||||
|
||||
//- Manipulate matrix with given weights
|
||||
virtual void manipulateMatrix
|
||||
(
|
||||
fvMatrix<scalar>& matrix,
|
||||
const scalarField& weights
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,249 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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 "v2WallFunctionFvPatchScalarField.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void v2WallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << patch().type() << nl << endl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar v2WallFunctionFvPatchScalarField::yPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
)
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(max(E*ypl, 1))/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const v2WallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const v2WallFunctionFvPatchScalarField& v2wfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(v2wfpsf),
|
||||
Cmu_(v2wfpsf.Cmu_),
|
||||
kappa_(v2wfpsf.kappa_),
|
||||
E_(v2wfpsf.E_),
|
||||
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const v2WallFunctionFvPatchScalarField& v2wfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(v2wfpsf, iF),
|
||||
Cmu_(v2wfpsf.Cmu_),
|
||||
kappa_(v2wfpsf.kappa_),
|
||||
E_(v2wfpsf.E_),
|
||||
yPlusLam_(v2wfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void v2WallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchi = patch().index();
|
||||
|
||||
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
const scalarField& y = turbulence.y()[patchi];
|
||||
|
||||
const tmp<volScalarField> tk = turbulence.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const tmp<scalarField> tnuw = turbulence.nu(patchi);
|
||||
const scalarField& nuw = tnuw();
|
||||
|
||||
const scalar Cmu25 = pow025(Cmu_);
|
||||
|
||||
scalarField& v2 = *this;
|
||||
|
||||
// Set v2 wall values
|
||||
forAll(v2, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar uTau = Cmu25*sqrt(k[faceCellI]);
|
||||
|
||||
scalar yPlus = uTau*y[faceI]/nuw[faceI];
|
||||
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
scalar Cv2 = 0.193;
|
||||
scalar Bv2 = -0.94;
|
||||
v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar Cv2 = 0.193;
|
||||
v2[faceI] = Cv2*pow4(yPlus);
|
||||
}
|
||||
|
||||
v2[faceI] *= sqr(uTau);
|
||||
}
|
||||
|
||||
fixedValueFvPatchField<scalar>::updateCoeffs();
|
||||
|
||||
// TODO: perform averaging for cells sharing more than one boundary face
|
||||
}
|
||||
|
||||
|
||||
void v2WallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
void v2WallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
v2WallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,205 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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::RASModels::v2WallFunctionFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpWallFunctions
|
||||
|
||||
Description
|
||||
This boundary condition provides a turbulence stress normal to streamlines
|
||||
wall function condition for low- and high-Reynolds number, turbulent flow
|
||||
cases.
|
||||
|
||||
The model operates in two modes, based on the computed laminar-to-turbulent
|
||||
switch-over y+ value derived from kappa and E.
|
||||
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Cmu | model coefficient | no | 0.09
|
||||
kappa | Von Karman constant | no | 0.41
|
||||
E | model coefficient | no | 9.8
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type v2WallFunction;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::fixedValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
v2WallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef v2WallFunctionFvPatchScalarField_H
|
||||
#define v2WallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class v2WallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class v2WallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchField<scalar>
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
//- Von Karman constant
|
||||
scalar kappa_;
|
||||
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Check the type of the patch
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("v2WallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given v2WallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const v2WallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const v2WallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new v2WallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
v2WallFunctionFvPatchScalarField
|
||||
(
|
||||
const v2WallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new v2WallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate(const Pstream::commsTypes);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,159 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "eddyViscosity.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
eddyViscosity<BasicTurbulenceModel>::eddyViscosity
|
||||
(
|
||||
const word& modelName,
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
RASModel<BasicTurbulenceModel>
|
||||
(
|
||||
modelName,
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
),
|
||||
|
||||
nut_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("nut", U.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volSymmTensorField> eddyViscosity<BasicTurbulenceModel>::R() const
|
||||
{
|
||||
tmp<volScalarField> tk(k());
|
||||
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("R", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
((2.0/3.0)*I)*tk() - (nut_)*dev(twoSymm(fvc::grad(this->U_))),
|
||||
tk().boundaryField().types()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volSymmTensorField> eddyViscosity<BasicTurbulenceModel>::devRhoReff() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("devRhoReff", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
(-(this->alpha_*this->rho_*this->nuEff()))
|
||||
*dev(twoSymm(fvc::grad(this->U_)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvVectorMatrix> eddyViscosity<BasicTurbulenceModel>::divDevRhoReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
- fvm::laplacian(this->alpha_*this->rho_*this->nuEff(), U)
|
||||
- fvc::div((this->alpha_*this->rho_*this->nuEff())*dev2(T(fvc::grad(U))))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool eddyViscosity<BasicTurbulenceModel>::read()
|
||||
{
|
||||
return RASModel<BasicTurbulenceModel>::read();
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void eddyViscosity<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
RASModel<BasicTurbulenceModel>::correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::RASModels::eddyViscosity
|
||||
|
||||
Group
|
||||
grpRASTurbulence
|
||||
|
||||
Description
|
||||
Eddy viscosity turbulence model base class
|
||||
|
||||
SourceFiles
|
||||
eddyViscosity.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef eddyViscosity_H
|
||||
#define eddyViscosity_H
|
||||
|
||||
#include "RASModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class eddyViscosity Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class eddyViscosity
|
||||
:
|
||||
public RASModel<BasicTurbulenceModel>
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Fields
|
||||
|
||||
volScalarField nut_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
virtual void correctNut() = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
eddyViscosity
|
||||
(
|
||||
const word& modelName,
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~eddyViscosity()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the turbulence viscosity
|
||||
virtual tmp<volScalarField> nut() const
|
||||
{
|
||||
return nut_;
|
||||
}
|
||||
|
||||
//- Return the turbulence viscosity on patch
|
||||
virtual tmp<scalarField> nut(const label patchi) const
|
||||
{
|
||||
return nut_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Return the turbulence kinetic energy
|
||||
virtual tmp<volScalarField> k() const = 0;
|
||||
|
||||
//- Return the Reynolds stress tensor
|
||||
virtual tmp<volSymmTensorField> R() const;
|
||||
|
||||
//- Return the effective stress tensor
|
||||
virtual tmp<volSymmTensorField> devRhoReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Read RASProperties dictionary
|
||||
virtual bool read() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "eddyViscosity.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
293
src/TurbulenceModels/turbulenceModel/RAS/kEpsilon/kEpsilon.C
Normal file
293
src/TurbulenceModels/turbulenceModel/RAS/kEpsilon/kEpsilon.C
Normal file
@ -0,0 +1,293 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "kEpsilon.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
kEpsilon<BasicTurbulenceModel>::kEpsilon
|
||||
(
|
||||
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<BasicTurbulenceModel>
|
||||
(
|
||||
type,
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
),
|
||||
|
||||
Cmu_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"Cmu",
|
||||
this->coeffDict_,
|
||||
0.09
|
||||
)
|
||||
),
|
||||
C1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"C1",
|
||||
this->coeffDict_,
|
||||
1.44
|
||||
)
|
||||
),
|
||||
C2_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"C2",
|
||||
this->coeffDict_,
|
||||
1.92
|
||||
)
|
||||
),
|
||||
C3_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"C3",
|
||||
this->coeffDict_,
|
||||
0
|
||||
)
|
||||
),
|
||||
sigmak_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"sigmak",
|
||||
this->coeffDict_,
|
||||
1.0
|
||||
)
|
||||
),
|
||||
sigmaEps_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"sigmaEps",
|
||||
this->coeffDict_,
|
||||
1.3
|
||||
)
|
||||
),
|
||||
|
||||
k_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("k", U.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh_
|
||||
),
|
||||
epsilon_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("epsilon", U.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh_
|
||||
)
|
||||
{
|
||||
bound(k_, this->kMin_);
|
||||
bound(epsilon_, this->epsilonMin_);
|
||||
|
||||
if (type == typeName)
|
||||
{
|
||||
correctNut();
|
||||
this->printCoeffs(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool kEpsilon<BasicTurbulenceModel>::read()
|
||||
{
|
||||
if (eddyViscosity<BasicTurbulenceModel>::read())
|
||||
{
|
||||
Cmu_.readIfPresent(this->coeffDict());
|
||||
C1_.readIfPresent(this->coeffDict());
|
||||
C2_.readIfPresent(this->coeffDict());
|
||||
C3_.readIfPresent(this->coeffDict());
|
||||
sigmak_.readIfPresent(this->coeffDict());
|
||||
sigmaEps_.readIfPresent(this->coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void kEpsilon<BasicTurbulenceModel>::correctNut()
|
||||
{
|
||||
this->nut_ = Cmu_*sqr(k_)/epsilon_;
|
||||
this->nut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvScalarMatrix> kEpsilon<BasicTurbulenceModel>::kSource() const
|
||||
{
|
||||
return tmp<fvScalarMatrix>
|
||||
(
|
||||
new fvScalarMatrix
|
||||
(
|
||||
k_,
|
||||
dimVolume*this->rho_.dimensions()*k_.dimensions()
|
||||
/dimTime
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<fvScalarMatrix> kEpsilon<BasicTurbulenceModel>::epsilonSource() const
|
||||
{
|
||||
return tmp<fvScalarMatrix>
|
||||
(
|
||||
new fvScalarMatrix
|
||||
(
|
||||
epsilon_,
|
||||
dimVolume*this->rho_.dimensions()*epsilon_.dimensions()
|
||||
/dimTime
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void kEpsilon<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
// Local references
|
||||
const alphaField& alpha = this->alpha_;
|
||||
const rhoField& rho = this->rho_;
|
||||
const surfaceScalarField& alphaPhi = this->alphaPhi_;
|
||||
const surfaceScalarField& phi = this->phi_;
|
||||
const volVectorField& U = this->U_;
|
||||
volScalarField& nut = this->nut_;
|
||||
|
||||
if (!this->turbulence_)
|
||||
{
|
||||
correctNut();
|
||||
return;
|
||||
}
|
||||
|
||||
eddyViscosity<BasicTurbulenceModel>::correct();
|
||||
|
||||
volScalarField divU(fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U)));
|
||||
|
||||
tmp<volTensorField> tgradU = fvc::grad(U);
|
||||
volScalarField G(this->GName(), nut*(tgradU() && dev(twoSymm(tgradU()))));
|
||||
tgradU.clear();
|
||||
|
||||
// Update epsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
(
|
||||
fvm::ddt(alpha, rho, epsilon_)
|
||||
+ fvm::div(alphaPhi, epsilon_)
|
||||
- fvm::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaPhi), epsilon_)
|
||||
- fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
|
||||
==
|
||||
C1_*alpha*rho*G*epsilon_/k_
|
||||
- fvm::SuSp(((2.0/3.0)*C1_ + C3_)*alpha*rho*divU, epsilon_)
|
||||
- fvm::Sp(C2_*alpha*rho*epsilon_/k_, epsilon_)
|
||||
+ epsilonSource()
|
||||
);
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, this->epsilonMin_);
|
||||
|
||||
|
||||
// Turbulent kinetic energy equation
|
||||
|
||||
tmp<fvScalarMatrix> kEqn
|
||||
(
|
||||
fvm::ddt(alpha, rho, k_)
|
||||
+ fvm::div(alphaPhi, k_)
|
||||
- fvm::Sp(fvc::ddt(alpha, rho) + fvc::div(alphaPhi), k_)
|
||||
- fvm::laplacian(alpha*rho*DkEff(), k_)
|
||||
==
|
||||
alpha*rho*G
|
||||
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_)
|
||||
- fvm::Sp(alpha*rho*epsilon_/k_, k_)
|
||||
+ kSource()
|
||||
);
|
||||
|
||||
kEqn().relax();
|
||||
solve(kEqn);
|
||||
bound(k_, this->kMin_);
|
||||
|
||||
correctNut();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
194
src/TurbulenceModels/turbulenceModel/RAS/kEpsilon/kEpsilon.H
Normal file
194
src/TurbulenceModels/turbulenceModel/RAS/kEpsilon/kEpsilon.H
Normal file
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::RASModels::kEpsilon
|
||||
|
||||
Group
|
||||
grpRASTurbulence
|
||||
|
||||
Description
|
||||
Standard k-epsilon turbulence model
|
||||
|
||||
The default model coefficients correspond to the following:
|
||||
\verbatim
|
||||
kEpsilonCoeffs
|
||||
{
|
||||
Cmu 0.09;
|
||||
C1 1.44;
|
||||
C2 1.92;
|
||||
C3 -0.33;
|
||||
sigmak 1.0;
|
||||
sigmaEps 1.3;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
kEpsilon.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef kEpsilon_H
|
||||
#define kEpsilon_H
|
||||
|
||||
#include "eddyViscosity.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class kEpsilon Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class kEpsilon
|
||||
:
|
||||
public eddyViscosity<BasicTurbulenceModel>
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Model coefficients
|
||||
|
||||
dimensionedScalar Cmu_;
|
||||
dimensionedScalar C1_;
|
||||
dimensionedScalar C2_;
|
||||
dimensionedScalar C3_;
|
||||
dimensionedScalar sigmak_;
|
||||
dimensionedScalar sigmaEps_;
|
||||
|
||||
// Fields
|
||||
|
||||
volScalarField k_;
|
||||
volScalarField epsilon_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
virtual void correctNut();
|
||||
virtual tmp<fvScalarMatrix> kSource() const;
|
||||
virtual tmp<fvScalarMatrix> epsilonSource() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("kEpsilon");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
kEpsilon
|
||||
(
|
||||
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 ~kEpsilon()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the effective diffusivity for k
|
||||
tmp<volScalarField> DkEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
"DkEff",
|
||||
(this->nut_/sigmak_ + this->nu())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Return the effective diffusivity for epsilon
|
||||
tmp<volScalarField> DepsilonEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
"DepsilonEff",
|
||||
(this->nut_/sigmaEps_ + this->nu())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Return the turbulence kinetic energy
|
||||
virtual tmp<volScalarField> k() const
|
||||
{
|
||||
return k_;
|
||||
}
|
||||
|
||||
//- Return the turbulence kinetic energy dissipation rate
|
||||
virtual tmp<volScalarField> epsilon() const
|
||||
{
|
||||
return epsilon_;
|
||||
}
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
virtual void correct();
|
||||
|
||||
//- Re-read model coefficients if they have changed
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "kEpsilon.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "TurbulenceModel.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template
|
||||
<
|
||||
class Alpha,
|
||||
class Rho,
|
||||
class BasicTurbulenceModel,
|
||||
class TransportModel
|
||||
>
|
||||
Foam::TurbulenceModel<Alpha, Rho, BasicTurbulenceModel, TransportModel>::
|
||||
TurbulenceModel
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
BasicTurbulenceModel
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
propertiesName
|
||||
),
|
||||
alpha_(alpha),
|
||||
transport_(transport)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template
|
||||
<
|
||||
class Alpha,
|
||||
class Rho,
|
||||
class BasicTurbulenceModel,
|
||||
class TransportModel
|
||||
>
|
||||
Foam::autoPtr
|
||||
<
|
||||
Foam::TurbulenceModel<Alpha, Rho, BasicTurbulenceModel, TransportModel>
|
||||
>
|
||||
Foam::TurbulenceModel<Alpha, Rho, BasicTurbulenceModel, TransportModel>::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
|
||||
)
|
||||
).lookup("simulationType")
|
||||
);
|
||||
|
||||
Info<< "Selecting turbulence model type " << modelType << endl;
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"TurbulenceModel::New"
|
||||
"(const alphaField&, const rhoField&, "
|
||||
"const volVectorField&, const surfaceScalarField&, "
|
||||
"transportModel&, const word&)"
|
||||
) << "Unknown TurbulenceModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid TurbulenceModel types:" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<TurbulenceModel>
|
||||
(
|
||||
cstrIter()(alpha, rho, U, alphaPhi, phi, transport, propertiesName)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,188 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::TurbulenceModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for turbulence models
|
||||
|
||||
SourceFiles
|
||||
TurbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef TurbulenceModel_H
|
||||
#define TurbulenceModel_H
|
||||
|
||||
#include "turbulenceModel.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class TurbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template
|
||||
<
|
||||
class Alpha,
|
||||
class Rho,
|
||||
class BasicTurbulenceModel,
|
||||
class TransportModel
|
||||
>
|
||||
class TurbulenceModel
|
||||
:
|
||||
public BasicTurbulenceModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef Alpha alphaField;
|
||||
typedef Rho rhoField;
|
||||
typedef TransportModel transportModel;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const alphaField& alpha_;
|
||||
const transportModel& transport_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
TurbulenceModel(const TurbulenceModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const TurbulenceModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeNewSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
TurbulenceModel,
|
||||
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
|
||||
TurbulenceModel
|
||||
(
|
||||
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 turbulence model
|
||||
static autoPtr<TurbulenceModel> 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 ~TurbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Access function to phase fraction
|
||||
const alphaField& alpha() const
|
||||
{
|
||||
return alpha_;
|
||||
}
|
||||
|
||||
//- Access function to incompressible transport model
|
||||
const transportModel& transport() const
|
||||
{
|
||||
return transport_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity
|
||||
tmp<volScalarField> nu() const
|
||||
{
|
||||
return transport_.nu();
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity on patchi
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return transport_.nu(patchi);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "TurbulenceModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,157 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "fixedShearStressFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
tau0_(vector::zero)
|
||||
{}
|
||||
|
||||
|
||||
Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
tau0_(dict.lookupOrDefault<vector>("tau", vector::zero))
|
||||
{
|
||||
fvPatchField<vector>::operator=(patchInternalField());
|
||||
}
|
||||
|
||||
|
||||
Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fixedShearStressFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
tau0_(ptf.tau0_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fixedShearStressFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
tau0_(ptf.tau0_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fixedShearStressFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, iF),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
tau0_(ptf.tau0_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fixedShearStressFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
scalarField nuEff(turbModel.nuEff()()[patch().index()]);
|
||||
|
||||
const vectorField Uc(patchInternalField());
|
||||
|
||||
vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL);
|
||||
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
|
||||
operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc)));
|
||||
|
||||
fixedValueFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::fixedShearStressFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fixedValueFvPatchVectorField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("tau") << tau0_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
fixedShearStressFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::fixedShearStressFvPatchVectorField
|
||||
|
||||
Group
|
||||
grpWallBoundaryConditions
|
||||
|
||||
Description
|
||||
Set a constant shear stress as tau0 = -nuEff dU/dn.
|
||||
|
||||
SourceFiles
|
||||
fixedShearStressFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fixedShearStressFvPatchVectorField_H
|
||||
#define fixedShearStressFvPatchVectorField_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fixedShearStressFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fixedShearStressFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of flux field (default = phi)
|
||||
const word phiName_;
|
||||
|
||||
//- Name of density field (default = rho)
|
||||
const word rhoName_;
|
||||
|
||||
//- Constant shear stress
|
||||
const vector tau0_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fixedShearStress");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fixedShearStressFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fixedShearStressFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new fixedShearStressFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedShearStressFvPatchVectorField
|
||||
(
|
||||
const fixedShearStressFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new fixedShearStressFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,177 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "porousBafflePressureFvPatchField.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedJumpFvPatchField<scalar>(p, iF),
|
||||
D_(0),
|
||||
I_(0),
|
||||
length_(0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
||||
(
|
||||
const porousBafflePressureFvPatchField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
D_(ptf.D_),
|
||||
I_(ptf.I_),
|
||||
length_(ptf.length_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedJumpFvPatchField<scalar>(p, iF),
|
||||
D_(readScalar(dict.lookup("D"))),
|
||||
I_(readScalar(dict.lookup("I"))),
|
||||
length_(readScalar(dict.lookup("length")))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
Field<scalar>("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
||||
(
|
||||
const porousBafflePressureFvPatchField& ptf
|
||||
)
|
||||
:
|
||||
cyclicLduInterfaceField(),
|
||||
fixedJumpFvPatchField<scalar>(ptf),
|
||||
D_(ptf.D_),
|
||||
I_(ptf.I_),
|
||||
length_(ptf.length_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
||||
(
|
||||
const porousBafflePressureFvPatchField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedJumpFvPatchField<scalar>(ptf, iF),
|
||||
D_(ptf.D_),
|
||||
I_(ptf.I_),
|
||||
length_(ptf.length_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::porousBafflePressureFvPatchField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>("phi");
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
scalarField Un(phip/patch().magSf());
|
||||
|
||||
scalarField magUn(mag(Un));
|
||||
|
||||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
turbulenceModel::propertiesName,
|
||||
dimensionedInternalField().group()
|
||||
)
|
||||
);
|
||||
|
||||
jump_ =
|
||||
-sign(Un)
|
||||
*(
|
||||
I_*turbModel.nuEff(patch().index())
|
||||
+ D_*0.5*magUn
|
||||
)*magUn*length_;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar avePressureJump = gAverage(jump_);
|
||||
scalar aveVelocity = gAverage(mag(Un));
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< " Average pressure drop :" << avePressureJump
|
||||
<< " Average velocity :" << aveVelocity
|
||||
<< endl;
|
||||
}
|
||||
|
||||
fixedJumpFvPatchField<scalar>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::porousBafflePressureFvPatchField::write(Ostream& os) const
|
||||
{
|
||||
fixedJumpFvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("I") << I_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
porousBafflePressureFvPatchField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::porousBafflePressureFvPatchField
|
||||
|
||||
Group
|
||||
grpCoupledBoundaryConditions
|
||||
|
||||
Description
|
||||
This boundary condition provides a jump condition, using the \cyclic
|
||||
condition as a base.
|
||||
|
||||
The porous baffle introduces a pressure jump defined by:
|
||||
|
||||
\f[
|
||||
\Delta p = -(I \mu U + 0.5 D \rho |U|^2 )L
|
||||
\f]
|
||||
|
||||
where
|
||||
|
||||
\vartable
|
||||
p | pressure [Pa]
|
||||
\rho | density [kg/m3]
|
||||
\mu | viscosity [Pa s]
|
||||
I | inertial coefficient
|
||||
D | Darcy coefficient
|
||||
L | porous media length in the flow direction
|
||||
\endvartable
|
||||
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
patchType | underlying patch type should be \c cyclic| yes |
|
||||
D | Darcy coefficient | yes |
|
||||
I | inertial coefficient | yes |
|
||||
L | porous media length in the flow direction | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type porousBafflePressure;
|
||||
patchType cyclic;
|
||||
jump uniform 0;
|
||||
D 1000000;
|
||||
I 0.001;
|
||||
L 0.1;
|
||||
value uniform 0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
The underlying \c patchType should be set to \c cyclic
|
||||
|
||||
SourceFiles
|
||||
porousBafflePressureFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef porousBafflePressureFvPatchField_H
|
||||
#define porousBafflePressureFvPatchField_H
|
||||
|
||||
#include "fixedJumpFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class porousBafflePressureFvPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class porousBafflePressureFvPatchField
|
||||
:
|
||||
public fixedJumpFvPatchField<scalar>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Darcy pressure loss coefficient
|
||||
scalar D_;
|
||||
|
||||
//- Inertia pressure lost coefficient
|
||||
scalar I_;
|
||||
|
||||
//- Porous media length
|
||||
scalar length_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("porousBafflePressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
porousBafflePressureFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
porousBafflePressureFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given porousBafflePressureFvPatchField
|
||||
// onto a new patch
|
||||
porousBafflePressureFvPatchField
|
||||
(
|
||||
const porousBafflePressureFvPatchField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
porousBafflePressureFvPatchField
|
||||
(
|
||||
const porousBafflePressureFvPatchField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<scalar> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<scalar> >
|
||||
(
|
||||
new porousBafflePressureFvPatchField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
porousBafflePressureFvPatchField
|
||||
(
|
||||
const porousBafflePressureFvPatchField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<scalar> > clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<scalar> >
|
||||
(
|
||||
new porousBafflePressureFvPatchField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef porousBafflePressureFvPatchFieldsFwd_H
|
||||
#define porousBafflePressureFvPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class porousBafflePressureFvPatchField;
|
||||
|
||||
makePatchTypeFieldTypedefs(porousBafflePressure);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
286
src/TurbulenceModels/turbulenceModel/laminar/laminar.C
Normal file
286
src/TurbulenceModels/turbulenceModel/laminar/laminar.C
Normal file
@ -0,0 +1,286 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "laminar.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvmLaplacian.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::laminar<BasicTurbulenceModel>::laminar
|
||||
(
|
||||
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
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::autoPtr<Foam::laminar<BasicTurbulenceModel> >
|
||||
Foam::laminar<BasicTurbulenceModel>::New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
return autoPtr<laminar>
|
||||
(
|
||||
new laminar
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
const Foam::dictionary&
|
||||
Foam::laminar<BasicTurbulenceModel>::coeffDict() const
|
||||
{
|
||||
return dictionary::null;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nut() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("nut", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("nut", dimViscosity, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nut
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField(this->mesh_.boundary()[patchi].size(), 0.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nuEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField("nuEff", this->nu())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nuEff
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return this->nu(patchi);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::k() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("k", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("k", sqr(this->U_.dimensions()), 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<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
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar
|
||||
(
|
||||
"epsilon", sqr(this->U_.dimensions())/dimTime, 0.0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::laminar<BasicTurbulenceModel>::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("R", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedSymmTensor
|
||||
(
|
||||
"R", sqr(this->U_.dimensions()), symmTensor::zero
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::laminar<BasicTurbulenceModel>::devRhoReff() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("devRhoReff", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
-(this->alpha_*this->rho_*nuEff())*dev(twoSymm(fvc::grad(this->U_)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::laminar<BasicTurbulenceModel>::divDevRhoReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
- fvm::laplacian(this->alpha_*this->rho_*nuEff(), U)
|
||||
- fvc::div(this->alpha_*this->rho_*nuEff()*dev2(T(fvc::grad(U))))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void Foam::laminar<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
BasicTurbulenceModel::correct();
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool Foam::laminar<BasicTurbulenceModel>::read()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
156
src/TurbulenceModels/turbulenceModel/laminar/laminar.H
Normal file
156
src/TurbulenceModels/turbulenceModel/laminar/laminar.H
Normal file
@ -0,0 +1,156 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::laminar
|
||||
|
||||
Description
|
||||
Turbulence model for laminar flow.
|
||||
|
||||
SourceFiles
|
||||
laminar.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef laminar_H
|
||||
#define laminar_H
|
||||
|
||||
#include "TurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------* \
|
||||
Class laminar Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class laminar
|
||||
:
|
||||
public BasicTurbulenceModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("laminar");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
laminar
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName = turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected turbulence model
|
||||
static autoPtr<laminar> 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 ~laminar()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Const access to the coefficients dictionary
|
||||
virtual const dictionary& coeffDict() const;
|
||||
|
||||
//- Return the turbulence viscosity, i.e. 0 for laminar flow
|
||||
virtual tmp<volScalarField> nut() const;
|
||||
|
||||
//- Return the turbulence viscosity on patch
|
||||
virtual tmp<scalarField> nut(const label patchi) const;
|
||||
|
||||
//- Return the effective viscosity, i.e. the laminar viscosity
|
||||
virtual tmp<volScalarField> nuEff() const;
|
||||
|
||||
//- Return the effective viscosity on patch
|
||||
virtual tmp<scalarField> nuEff(const label patchi) const;
|
||||
|
||||
//- Return the turbulence kinetic energy, i.e. 0 for laminar flow
|
||||
virtual tmp<volScalarField> k() const;
|
||||
|
||||
//- Return the turbulence kinetic energy dissipation rate,
|
||||
// i.e. 0 for laminar flow
|
||||
virtual tmp<volScalarField> epsilon() const;
|
||||
|
||||
//- Return the Reynolds stress tensor, i.e. 0 for laminar flow
|
||||
virtual tmp<volSymmTensorField> R() const;
|
||||
|
||||
//- Return the effective stress tensor, i.e. the laminar stress
|
||||
virtual tmp<volSymmTensorField> devRhoReff() const;
|
||||
|
||||
//- Return the source term for the momentum equation
|
||||
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
virtual void correct();
|
||||
|
||||
//- Read turbulenceProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "laminar.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
90
src/TurbulenceModels/turbulenceModel/turbulenceModel.C
Normal file
90
src/TurbulenceModels/turbulenceModel/turbulenceModel.C
Normal file
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "turbulenceModel.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(turbulenceModel, 0);
|
||||
}
|
||||
|
||||
const Foam::word Foam::turbulenceModel::propertiesName("turbulenceProperties");
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::turbulenceModel::turbulenceModel
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(propertiesName, U.group()),
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
|
||||
runTime_(U.time()),
|
||||
mesh_(U.mesh()),
|
||||
|
||||
U_(U),
|
||||
alphaPhi_(alphaPhi),
|
||||
phi_(phi),
|
||||
y_(mesh_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::turbulenceModel::read()
|
||||
{
|
||||
return regIOobject::read();
|
||||
}
|
||||
|
||||
|
||||
void Foam::turbulenceModel::correct()
|
||||
{
|
||||
if (mesh_.changing())
|
||||
{
|
||||
y_.correct();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
227
src/TurbulenceModels/turbulenceModel/turbulenceModel.H
Normal file
227
src/TurbulenceModels/turbulenceModel/turbulenceModel.H
Normal file
@ -0,0 +1,227 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::turbulenceModel
|
||||
|
||||
Description
|
||||
Abstract base class for turbulence models (RAS, LES and laminar).
|
||||
|
||||
SourceFiles
|
||||
turbulenceModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulenceModel_H
|
||||
#define turbulenceModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "nearWallDist.H"
|
||||
#include "geometricOneField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulenceModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulenceModel
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const Time& runTime_;
|
||||
const fvMesh& mesh_;
|
||||
|
||||
const volVectorField& U_;
|
||||
const surfaceScalarField& alphaPhi_;
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
//- Near wall distance boundary field
|
||||
nearWallDist y_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
turbulenceModel(const turbulenceModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const turbulenceModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("turbulenceModel");
|
||||
|
||||
//- Default name of the turbulence properties dictionary
|
||||
static const word propertiesName;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
turbulenceModel
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~turbulenceModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const Time& time() const
|
||||
{
|
||||
return runTime_;
|
||||
}
|
||||
|
||||
const fvMesh& mesh() const
|
||||
{
|
||||
return mesh_;
|
||||
}
|
||||
|
||||
//- Const access to the coefficients dictionary
|
||||
virtual const dictionary& coeffDict() const = 0;
|
||||
|
||||
//- Helper function to return the nam eof the turbulence G field
|
||||
inline word GName() const
|
||||
{
|
||||
return word(type() + ":G");
|
||||
}
|
||||
|
||||
//- Access function to velocity field
|
||||
inline const volVectorField& U() const
|
||||
{
|
||||
return U_;
|
||||
}
|
||||
|
||||
//- Access function to phase flux field
|
||||
inline const surfaceScalarField& alphaPhi() const
|
||||
{
|
||||
return alphaPhi_;
|
||||
}
|
||||
|
||||
//- Access function to flux field
|
||||
inline const surfaceScalarField& phi() const
|
||||
{
|
||||
return phi_;
|
||||
}
|
||||
|
||||
//- Return the near wall distances
|
||||
const nearWallDist& y() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity
|
||||
virtual tmp<volScalarField> nu() const = 0;
|
||||
|
||||
//- Return the laminar viscosity on patch
|
||||
virtual tmp<scalarField> nu(const label patchi) const = 0;
|
||||
|
||||
//- Return the turbulence viscosity
|
||||
virtual tmp<volScalarField> nut() const = 0;
|
||||
|
||||
//- Return the turbulence viscosity on patch
|
||||
virtual tmp<scalarField> nut(const label patchi) const = 0;
|
||||
|
||||
//- Return the effective viscosity
|
||||
virtual tmp<volScalarField> nuEff() const = 0;
|
||||
|
||||
//- Return the effective viscosity on patch
|
||||
virtual tmp<scalarField> nuEff(const label patchi) const = 0;
|
||||
|
||||
//- Return the laminar dynamic viscosity
|
||||
virtual tmp<volScalarField> mu() const = 0;
|
||||
|
||||
//- Return the laminar dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mu(const label patchi) const = 0;
|
||||
|
||||
//- Return the turbulence dynamic viscosity
|
||||
virtual tmp<volScalarField> mut() const = 0;
|
||||
|
||||
//- Return the turbulence dynamic viscosity on patch
|
||||
virtual tmp<scalarField> mut(const label patchi) const = 0;
|
||||
|
||||
//- Return the effective dynamic viscosity
|
||||
virtual tmp<volScalarField> muEff() const = 0;
|
||||
|
||||
//- Return the effective dynamic viscosity on patch
|
||||
virtual tmp<scalarField> muEff(const label patchi) const = 0;
|
||||
|
||||
//- Return the turbulence kinetic energy
|
||||
virtual tmp<volScalarField> k() const = 0;
|
||||
|
||||
//- Return the turbulence kinetic energy dissipation rate
|
||||
virtual tmp<volScalarField> epsilon() const = 0;
|
||||
|
||||
//- Return the Reynolds stress tensor
|
||||
virtual tmp<volSymmTensorField> R() const = 0;
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Read LESProperties or RASProperties dictionary
|
||||
virtual bool read() = 0;
|
||||
|
||||
//- Default dummy write function
|
||||
virtual bool writeData(Ostream&) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
31
src/TurbulenceModels/turbulenceModel/turbulenceModelDoc.H
Normal file
31
src/TurbulenceModels/turbulenceModel/turbulenceModelDoc.H
Normal file
@ -0,0 +1,31 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 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/>.
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
\defgroup grpIcoTurbulence Incompressible turbulence
|
||||
@{
|
||||
This group contains incompressible turbulence models.
|
||||
@}
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
Reference in New Issue
Block a user