Updated the whole of OpenFOAM to use the new templated TurbulenceModels library

The old separate incompressible and compressible libraries have been removed.

Most of the commonly used RANS and LES models have been upgraded to the
new framework but there are a few missing which will be added over the
next few days, in particular the realizable k-epsilon model.  Some of
the less common incompressible RANS models have been introduced into the
new library instantiated for incompressible flow only.  If they prove to
be generally useful they can be templated for compressible and
multiphase application.

The Spalart-Allmaras DDES and IDDES models have been thoroughly
debugged, removing serious errors concerning the use of S rather than
Omega.

The compressible instances of the models have been augmented by a simple
backward-compatible eddyDiffusivity model for thermal transport based on
alphat and alphaEff.  This will be replaced with a separate run-time
selectable thermal transport model framework in a few weeks.

For simplicity and ease of maintenance and further development the
turbulent transport and wall modeling is based on nut/nuEff rather than
mut/muEff for compressible models so that all forms of turbulence models
can use the same wall-functions and other BCs.

All turbulence model selection made in the constant/turbulenceProperties
dictionary with RAS and LES as sub-dictionaries rather than in separate
files which added huge complexity for multiphase.

All tutorials have been updated so study the changes and update your own
cases by comparison with similar cases provided.

Sorry for the inconvenience in the break in backward-compatibility but
this update to the turbulence modeling is an essential step in the
future of OpenFOAM to allow more models to be added and maintained for a
wider range of cases and physics.  Over the next weeks and months more
turbulence models will be added of single and multiphase flow, more
additional sub-models and further development and testing of existing
models.  I hope this brings benefits to all OpenFOAM users.

Henry G. Weller
This commit is contained in:
Henry
2015-01-21 19:21:39 +00:00
parent 2d4d5e93ce
commit 2aec249647
1102 changed files with 9087 additions and 54729 deletions

View File

@ -61,7 +61,6 @@ wmake $targetType randomProcesses
transportModels/Allwmake $targetType $*
thermophysicalModels/Allwmake $targetType $*
turbulenceModels/Allwmake $targetType $*
TurbulenceModels/Allwmake $targetType $*
wmake $targetType combustionModels
regionModels/Allwmake $targetType $*

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,7 @@ template<class TransportModel>
Foam::CompressibleTurbulenceModel<TransportModel>::
CompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,6 +72,7 @@ public:
//- Construct
CompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,

View File

@ -1,4 +1,19 @@
compressibleTurbulenceModel.C
compressibleTurbulenceModels.C
turbulentFluidThermoModels/turbulentFluidThermoModels.C
BCs = turbulentFluidThermoModels/derivedFvPatchFields
$(BCs)/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C
$(BCs)/temperatureCoupledBase/temperatureCoupledBase.C
$(BCs)/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
$(BCs)/thermalBaffle1D/thermalBaffle1DFvPatchScalarFields.C
$(BCs)/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
$(BCs)/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
$(BCs)/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
$(BCs)/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C
$(BCs)/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C
$(BCs)/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C
turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C
turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModels

View File

@ -4,11 +4,15 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lfluidThermophysicalModels \
-lsolidThermo \
-lsolidSpecie \
-lturbulenceModels \
-lspecie

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "SpecificCompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicCompressibleTurbulenceModel>
Foam::SpecificCompressibleTurbulenceModel
<
BasicCompressibleTurbulenceModel
>::SpecificCompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
BasicCompressibleTurbulenceModel
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class BasicCompressibleTurbulenceModel>
Foam::autoPtr
<
Foam::SpecificCompressibleTurbulenceModel
<
BasicCompressibleTurbulenceModel
>
>
Foam::SpecificCompressibleTurbulenceModel
<
BasicCompressibleTurbulenceModel
>::New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
{
return autoPtr<SpecificCompressibleTurbulenceModel>
(
static_cast<SpecificCompressibleTurbulenceModel*>(
BasicCompressibleTurbulenceModel::New
(
geometricOneField(),
rho,
U,
phi,
phi,
transport,
propertiesName
).ptr())
);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,93 +22,89 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::DESModel
Group
grpCmpDESTurbulence
Foam::SpecificCompressibleTurbulenceModel
Description
Extension of LES models to provide an interface for Detached Eddy
Simulation turbulence models
SeeAlso
Foam::LESModel
Templated abstract base class for specific (RAS/LES) compressible
turbulence models
SourceFiles
DESModel.C
SpecificCompressibleTurbulenceModel.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleDESModel_H
#define compressibleDESModel_H
#ifndef SpecificCompressibleTurbulenceModel_H
#define SpecificCompressibleTurbulenceModel_H
// note: use full(er) path so that derived utilities can bring in
// incompressible and compressible variants
#include "compressible/LES/LESModel/LESModel.H"
#include "CompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class DESModel Declaration
Class SpecificCompressibleTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
class DESModel
template<class BasicCompressibleTurbulenceModel>
class SpecificCompressibleTurbulenceModel
:
public LESModel
public BasicCompressibleTurbulenceModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
DESModel(const DESModel&);
//- Disallow default bitwise assignment
DESModel& operator=(const DESModel&);
public:
typedef typename BasicCompressibleTurbulenceModel::transportModel
transportModel;
// Constructors
//- Construct from components
DESModel
SpecificCompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const fluidThermo& thermoPhysicalModel,
const word& turbulenceModelName
const transportModel& transport,
const word& propertiesName
);
//- Destructor
virtual ~DESModel()
virtual ~SpecificCompressibleTurbulenceModel()
{}
// Public Member Functions
// Selectors
//- Return the LES field indicator
virtual tmp<volScalarField> LESRegion() const = 0;
//- Return a reference to the selected RAS model
static autoPtr<SpecificCompressibleTurbulenceModel> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SpecificCompressibleTurbulenceModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -98,6 +98,12 @@ public:
// Member functions
//- Return the density field
const volScalarField& rho() const
{
return rho_;
}
//- Return the volumetric flux field
virtual tmp<surfaceScalarField> phi() const;

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "eddyDiffusivity.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class BasicTurbulenceModel>
void Foam::eddyDiffusivity<BasicTurbulenceModel>::correctAlphat()
{
alphat_ = this->rho_*this->nut()/Prt_;
alphat_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
Foam::eddyDiffusivity<BasicTurbulenceModel>::eddyDiffusivity
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
BasicTurbulenceModel
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
// Prt_
// (
// dimensioned<scalar>::lookupOrAddToDict
// (
// "Prt",
// this->coeffDict_,
// 1.0
// )
// ),
Prt_("Prt", dimless, 1.0),
alphat_
(
IOobject
(
"alphat",
this->runTime_.timeName(),
this->mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
this->mesh_
)
{}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
Foam::autoPtr<Foam::eddyDiffusivity<BasicTurbulenceModel> >
Foam::eddyDiffusivity<BasicTurbulenceModel>::New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
{
return autoPtr<eddyDiffusivity>
(
static_cast<eddyDiffusivity*>(
BasicTurbulenceModel::New
(
rho,
U,
phi,
transport,
propertiesName
).ptr())
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool Foam::eddyDiffusivity<BasicTurbulenceModel>::read()
{
if (BasicTurbulenceModel::read())
{
Prt_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}
template<class BasicTurbulenceModel>
void Foam::eddyDiffusivity<BasicTurbulenceModel>::correct()
{
BasicTurbulenceModel::correct();
correctAlphat();
}
// ************************************************************************* //

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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::eddyDiffusivity
Description
Templated abstract base class for single-phase compressible
turbulence models.
SourceFiles
eddyDiffusivity.C
\*---------------------------------------------------------------------------*/
#ifndef eddyDiffusivity_H
#define eddyDiffusivity_H
#include "CompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class eddyDiffusivity Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class eddyDiffusivity
:
public BasicTurbulenceModel
{
protected:
// Protected data
// Model coefficients
dimensionedScalar Prt_;
// Fields
volScalarField alphat_;
// Protected Member Functions
virtual void correctAlphat();
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
// Constructors
//- Construct
eddyDiffusivity
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& trasport,
const word& propertiesName
);
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<eddyDiffusivity> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& trasportModel,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~eddyDiffusivity()
{}
// Member Functions
//- Re-read model coefficients if they have changed
virtual bool read();
//- Return the turbulent thermal diffusivity for enthalpy [kg/m/s]
virtual tmp<volScalarField> alphat() const
{
return alphat_;
}
//- Return the turbulent thermal diffusivity for enthalpy for a patch
// [kg/m/s]
virtual tmp<scalarField> alphat(const label patchi) const
{
return alphat()().boundaryField()[patchi];
}
//- Return the effective turbulent thermal diffusivity for temperature
// [J/m/s/K]
virtual tmp<volScalarField> kappaEff() const
{
return this->transport_.kappaEff(alphat());
}
//- Return the effective turbulent thermal diffusivity for temperature
// [J/m/s/K]
virtual tmp<scalarField> kappaEff(const label patchi) const
{
return this->transport_.kappaEff(alphat(patchi), patchi);
}
//- Return the effective turbulent thermal diffusivity for enthalpy
// [kg/m/s]
virtual tmp<volScalarField> alphaEff() const
{
return this->transport_.alphaEff(alphat());
}
//- Return the effective turbulent thermal diffusivity for enthalpy
// for a patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const
{
return this->transport_.alphaEff(alphat(patchi), patchi);
}
//- Correct the turbulent thermal diffusivity for enthalpy
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "eddyDiffusivity.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "thermalDiffusivity.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class TransportModel>
Foam::thermalDiffusivity<TransportModel>::thermalDiffusivity
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
CompressibleTurbulenceModel<TransportModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
)
{}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
template<class TransportModel>
Foam::autoPtr<Foam::thermalDiffusivity<TransportModel> >
Foam::thermalDiffusivity<TransportModel>::New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
{
return autoPtr<thermalDiffusivity>
(
static_cast<thermalDiffusivity*>(
CompressibleTurbulenceModel<transportModel>::New
(
rho,
U,
phi,
transport,
propertiesName
).ptr())
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volScalarField>
Foam::thermalDiffusivity<BasicTurbulenceModel>::alphat() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
IOobject::groupName("alphat", this->U_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar("alphat", dimDensity*dimViscosity, 0.0)
)
);
}
template<class BasicTurbulenceModel>
Foam::tmp<Foam::scalarField>
Foam::thermalDiffusivity<BasicTurbulenceModel>::alphat
(
const label patchi
) const
{
return tmp<scalarField>
(
new scalarField(this->mesh_.boundary()[patchi].size(), 0.0)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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::thermalDiffusivity
Description
Templated abstract base class for single-phase compressible
turbulence models.
SourceFiles
thermalDiffusivity.C
\*---------------------------------------------------------------------------*/
#ifndef thermalDiffusivity_H
#define thermalDiffusivity_H
#include "CompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class thermalDiffusivity Declaration
\*---------------------------------------------------------------------------*/
template<class TransportModel>
class thermalDiffusivity
:
public CompressibleTurbulenceModel<TransportModel>
{
public:
typedef geometricOneField alphaField;
typedef volScalarField rhoField;
typedef TransportModel transportModel;
// Constructors
//- Construct
thermalDiffusivity
(
const word& type,
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& trasport,
const word& propertiesName
);
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<thermalDiffusivity> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& trasportModel,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~thermalDiffusivity()
{}
// Member Functions
//- Return the thermal diffusivity for temperature [J/m/s/K]
virtual tmp<volScalarField> kappa() const
{
return this->transport_.kappa();
}
//- Return the laminar thermal diffusivity for temperature on patch
// [J/m/s/K]
virtual tmp<scalarField> kappa(const label patchi) const
{
return this->transport_.kappa(patchi);
}
//- Return the laminar thermal diffusivity for enthalpy [kg/m/s]
virtual tmp<volScalarField> alpha() const
{
return this->transport_.alpha();
}
//- Return the laminar thermal diffusivity for enthalpy on patch
// [kg/m/s]
virtual tmp<scalarField> alpha(const label patchi) const
{
return this->transport_.alpha(patchi);
}
//- Return the turbulent thermal diffusivity for enthalpy [kg/m/s]
virtual tmp<volScalarField> alphat() const;
//- Return the turbulent thermal diffusivity for enthalpy for a patch
// [kg/m/s]
virtual tmp<scalarField> alphat(const label patchi) const;
//- Return the effective turbulent thermal diffusivity for temperature
// [J/m/s/K]
virtual tmp<volScalarField> kappaEff() const
{
return kappa();
}
//- Return the effective turbulent thermal diffusivity for temperature
// [J/m/s/K]
virtual tmp<scalarField> kappaEff(const label patchi) const
{
return kappa(patchi);
}
//- Return the effective turbulent thermal diffusivity for enthalpy
// [kg/m/s]
virtual tmp<volScalarField> alphaEff() const
{
return alpha();
}
//- Return the effective turbulent thermal diffusivity for enthalpy
// for a patch [kg/m/s]
virtual tmp<scalarField> alphaEff(const label patchi) const
{
return alpha(patchi);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "thermalDiffusivity.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,5 +27,5 @@ License
@{
This group contains compressible turbulence models.
@}
\*---------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "convectiveHeatTransferFvPatchScalarField.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
#include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H"
@ -110,16 +110,26 @@ void convectiveHeatTransferFvPatchScalarField::updateCoeffs()
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
(
IOobject::groupName
(
turbulenceModel::propertiesName,
dimensionedInternalField().group()
)
);
const scalarField alphaEffw(turbModel.alphaEff(patchi));
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const tmp<scalarField> tmuw = turbModel.mu(patchi);
const scalarField& muw = tmuw();
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const vectorField& Uc = turbModel.U();
const vectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField& Tw = turbModel.thermo().T().boundaryField()[patchi];
const scalarField& pw = turbModel.thermo().p().boundaryField()[patchi];
const scalarField Cpw(turbModel.thermo().Cp(pw, Tw, patchi));
const scalarField& Tw = turbModel.transport().T().boundaryField()[patchi];
const scalarField& pw = turbModel.transport().p().boundaryField()[patchi];
const scalarField Cpw(turbModel.transport().Cp(pw, Tw, patchi));
const scalarField kappaw(Cpw*alphaEffw);
const scalarField Pr(muw*Cpw/kappaw);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,11 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "externalCoupledTemperatureMixedFvPatchScalarField.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "OFstream.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -127,7 +127,16 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::transferData
scalarField qDot(this->patch().size(), 0.0);
typedef compressible::turbulenceModel cmpTurbModelType;
static word turbName("turbulenceModel");
static word turbName
(
IOobject::groupName
(
turbulenceModel::propertiesName,
dimensionedInternalField().group()
)
);
static word thermoName("thermophysicalProperties");
if (db().foundObject<cmpTurbModelType>(turbName))
@ -135,7 +144,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::transferData
const cmpTurbModelType& turbModel =
db().lookupObject<cmpTurbModelType>(turbName);
const basicThermo& thermo = turbModel.thermo();
const basicThermo& thermo = turbModel.transport();
const fvPatchScalarField& hep = thermo.he().boundaryField()[patchI];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,7 +27,7 @@ License
#include "volFields.H"
#include "fluidThermo.H"
#include "solidThermo.H"
#include "turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
@ -111,10 +111,15 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
{
typedef compressible::turbulenceModel turbulenceModel;
if (mesh.foundObject<turbulenceModel>("turbulenceModel"))
word turbName(turbulenceModel::propertiesName);
if
(
mesh.foundObject<turbulenceModel>(turbName)
)
{
const turbulenceModel& turbModel =
mesh.lookupObject<turbulenceModel>("turbulenceModel");
mesh.lookupObject<turbulenceModel>(turbName);
return turbModel.kappaEff(patchI);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,7 @@ License
#include "volFields.H"
#include "surfaceFields.H"
#include "mappedPatchBase.H"
#include "turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -356,7 +356,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
const compressible::turbulenceModel& turbModel =
db().template lookupObject<compressible::turbulenceModel>
(
"turbulenceModel"
turbulenceModel::propertiesName
);
// local properties
@ -383,7 +383,7 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
// nrb properties
scalarField nbrTp =
turbModel.thermo().T().boundaryField()[nbrPatchi];
turbModel.transport().T().boundaryField()[nbrPatchi];
mapDist.distribute(nbrTp);
// solid properties

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,8 +29,7 @@ License
#include "volFields.H"
#include "surfaceFields.H"
#include "IOobjectList.H"
#include "turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
@ -154,16 +153,22 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const compressible::turbulenceModel& turbulence =
db().lookupObject<compressible::turbulenceModel>
(
"turbulenceModel"
const LESModel<eddyDiffusivity<compressible::turbulenceModel> >& turbModel =
db().lookupObject
<
LESModel<eddyDiffusivity<compressible::turbulenceModel> >
> (
IOobject::groupName
(
turbulenceModel::propertiesName,
dimensionedInternalField().group()
)
);
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const scalarField alphap(turbulence.alphaEff(patchI));
const scalarField alphap(turbModel.alphaEff(patchI));
refValue() = massFluxFraction_;
refGrad() = 0.0;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -199,16 +199,27 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
// Retrieve turbulence properties from model
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
(
IOobject::groupName
(
turbulenceModel::propertiesName,
dimensionedInternalField().group()
)
);
const scalar Cmu25 = pow025(Cmu_);
const scalarField& y = turbModel.y()[patchi];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const tmp<scalarField> tmuw = turbModel.mu(patchi);
const scalarField& muw = tmuw();
const tmp<scalarField> talphaw = turbModel.alpha(patchi);
const scalarField& alphaw = talphaw();
const scalarField& alphaw = turbModel.alpha().boundaryField()[patchi];
scalarField& alphatw = *this;
const tmp<volScalarField> tk = turbModel.k();
@ -220,12 +231,12 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const fvPatchScalarField& hew =
turbModel.thermo().he().boundaryField()[patchi];
turbModel.transport().he().boundaryField()[patchi];
// Heat flux [W/m2] - lagging alphatw
const scalarField qDot
(
turbModel.thermo().alphaEff(alphatw, patchi)*hew.snGrad()
turbModel.transport().alphaEff(alphatw, patchi)*hew.snGrad()
);
// Populate boundary values

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -44,7 +44,8 @@ alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
mutName_("mut"),
rhoName_("rho"),
nutName_("nut"),
Prt_(0.85)
{}
@ -58,7 +59,8 @@ alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
mutName_(ptf.mutName_),
rhoName_(ptf.rhoName_),
nutName_(ptf.nutName_),
Prt_(ptf.Prt_)
{}
@ -71,7 +73,8 @@ alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict),
mutName_(dict.lookupOrDefault<word>("mut", "mut")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
nutName_(dict.lookupOrDefault<word>("nut", "nut")),
Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85))
{}
@ -82,7 +85,8 @@ alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(awfpsf),
mutName_(awfpsf.mutName_),
rhoName_(awfpsf.rhoName_),
nutName_(awfpsf.nutName_),
Prt_(awfpsf.Prt_)
{}
@ -94,7 +98,8 @@ alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(awfpsf, iF),
mutName_(awfpsf.mutName_),
rhoName_(awfpsf.rhoName_),
nutName_(awfpsf.nutName_),
Prt_(awfpsf.Prt_)
{}
@ -108,10 +113,13 @@ void alphatWallFunctionFvPatchScalarField::updateCoeffs()
return;
}
const scalarField& mutw =
patch().lookupPatchField<volScalarField, scalar>(mutName_);
const scalarField& rhow =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(mutw/Prt_);
const scalarField& nutw =
patch().lookupPatchField<volScalarField, scalar>(nutName_);
operator==(rhow*nutw/Prt_);
fixedValueFvPatchScalarField::updateCoeffs();
}
@ -120,7 +128,8 @@ void alphatWallFunctionFvPatchScalarField::updateCoeffs()
void alphatWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "mut", "mut", mutName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,7 +50,7 @@ Description
\table
Property | Description | Required | Default value
mut | turbulence viscosity field name | no | mut
nut | turbulence viscosity field name | no | nut
Prt | turbulent Prandtl number | no | 0.85
\endtable
@ -59,7 +59,7 @@ Description
myPatch
{
type alphatWallFunction;
mut mut;
nut nut;
Prt 0.85;
value uniform 0; // optional value entry
}
@ -95,8 +95,11 @@ class alphatWallFunctionFvPatchScalarField
{
// Private data
//- Name of turbulent viscosity field (default = mut)
word mutName_;
//- Name of density field (default = rho)
word rhoName_;
//- Name of turbulent viscosity field (default = nut)
word nutName_;
//- Turbulent Prandtl number (default = 0.85)
scalar Prt_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,7 @@ License
#include "wallHeatTransferFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "turbulenceModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -151,7 +151,11 @@ void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs()
const compressible::turbulenceModel& turbModel =
db().lookupObject<compressible::turbulenceModel>
(
"turbulenceModel"
IOobject::groupName
(
turbulenceModel::propertiesName,
dimensionedInternalField().group()
)
);
const label patchi = patch().index();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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/>.
\*---------------------------------------------------------------------------*/
#define makeBaseTurbulenceModel(Alpha, Rho, baseModel, BaseModel, Transport) \
\
namespace Foam \
{ \
typedef TurbulenceModel \
< \
Alpha, \
Rho, \
baseModel, \
Transport \
> Transport##baseModel; \
\
defineTemplateRunTimeSelectionTable \
( \
Transport##baseModel, \
dictionary \
); \
\
typedef BaseModel<Transport> Transport##BaseModel; \
\
\
typedef laminar<Transport##BaseModel> Laminar##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \
\
addToRunTimeSelectionTable \
( \
Transport##baseModel, \
Laminar##Transport##BaseModel, \
dictionary \
); \
\
\
typedef RASModel<eddyDiffusivity<Transport##BaseModel> > \
RAS##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(RAS##Transport##BaseModel, 0); \
\
defineTemplateRunTimeSelectionTable \
(RAS##Transport##BaseModel, dictionary); \
\
addToRunTimeSelectionTable \
( \
Transport##baseModel, \
RAS##Transport##BaseModel, \
dictionary \
); \
\
\
typedef LESModel<eddyDiffusivity<Transport##BaseModel> > \
LES##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(LES##Transport##BaseModel, 0); \
\
defineTemplateRunTimeSelectionTable \
(LES##Transport##BaseModel, dictionary); \
\
addToRunTimeSelectionTable \
( \
Transport##baseModel, \
LES##Transport##BaseModel, \
dictionary \
); \
}
#define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \
namespace Foam \
{ \
namespace SType##Models \
{ \
typedef Type<eddyDiffusivity<BaseModel> > Type##SType##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \
\
addToRunTimeSelectionTable \
( \
SType##BaseModel, \
Type##SType##BaseModel, \
dictionary \
); \
} \
}
#define makeTurbulenceModel(BaseModel, SType, Type) \
namespace Foam \
{ \
namespace SType##Models \
{ \
defineTypeNameAndDebug(Type, 0); \
\
addToRunTimeSelectionTable \
( \
SType##BaseModel, \
Type, \
dictionary \
); \
} \
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,29 +21,54 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::compressible::turbulenceModel
Typedef
Foam::compressible::RASModel
Typedef
Foam::compressible::LESModel
Description
Typedefs for turbulence, RAS and LES models for compressible flow
based on the standard laminar transport package.
SourceFiles
turbulentFluidThermoModels.C
\*---------------------------------------------------------------------------*/
#ifndef kqRWallFunctionFvPatchFields_H
#define kqRWallFunctionFvPatchFields_H
#ifndef turbulentFluidThermoModel_H
#define turbulentFluidThermoModel_H
#include "kqRWallFunctionFvPatchField.H"
#include "fieldTypes.H"
#include "SpecificCompressibleTurbulenceModel.H"
#include "thermalDiffusivity.H"
#include "eddyDiffusivity.H"
#include "RASModel.H"
#include "LESModel.H"
#include "fluidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace compressible
{
typedef thermalDiffusivity<fluidThermo> turbulenceModel;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef SpecificCompressibleTurbulenceModel
<
RASModel<eddyDiffusivity<turbulenceModel> >
> RASModel;
makePatchTypeFieldTypedefs(kqRWallFunction);
typedef SpecificCompressibleTurbulenceModel
<
LESModel<eddyDiffusivity<turbulenceModel> >
> LESModel;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,11 +23,13 @@ License
\*---------------------------------------------------------------------------*/
#include "CompressibleTurbulenceModel.H"
#include "fluidThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
#include "thermalDiffusivity.H"
#include "eddyDiffusivity.H"
#include "laminar.H"
#include "RASModel.H"
#include "LESModel.H"
@ -37,17 +39,20 @@ makeBaseTurbulenceModel
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
CompressibleTurbulenceModel,
thermalDiffusivity,
fluidThermo
);
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
(fluidThermoCompressibleTurbulenceModel, RAS, Type)
(fluidThermothermalDiffusivity, RAS, Type)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
(fluidThermoCompressibleTurbulenceModel, LES, Type)
(fluidThermothermalDiffusivity, LES, Type)
#include "SpalartAllmaras.H"
makeRASModel(SpalartAllmaras);
#include "kEpsilon.H"
makeRASModel(kEpsilon);
@ -55,6 +60,9 @@ makeRASModel(kEpsilon);
#include "buoyantKEpsilon.H"
makeRASModel(buoyantKEpsilon);
#include "LaunderSharmaKE.H"
makeRASModel(LaunderSharmaKE);
#include "kOmegaSST.H"
makeRASModel(kOmegaSST);
@ -64,5 +72,14 @@ makeLESModel(Smagorinsky);
#include "kEqn.H"
makeLESModel(kEqn);
#include "SpalartAllmarasDES.H"
makeLESModel(SpalartAllmarasDES);
#include "SpalartAllmarasDDES.H"
makeLESModel(SpalartAllmarasDDES);
#include "SpalartAllmarasIDDES.H"
makeLESModel(SpalartAllmarasIDDES);
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,12 +31,13 @@ template<class TransportModel>
Foam::IncompressibleTurbulenceModel<TransportModel>::
IncompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const TransportModel& transportModel,
const TransportModel& transport,
const word& propertiesName
)
:
@ -53,7 +54,7 @@ IncompressibleTurbulenceModel
U,
alphaRhoPhi,
phi,
transportModel,
transport,
propertiesName
)
{}
@ -67,7 +68,7 @@ Foam::IncompressibleTurbulenceModel<TransportModel>::New
(
const volVectorField& U,
const surfaceScalarField& phi,
const TransportModel& transportModel,
const TransportModel& transport,
const word& propertiesName
)
{
@ -87,7 +88,7 @@ Foam::IncompressibleTurbulenceModel<TransportModel>::New
U,
phi,
phi,
transportModel,
transport,
propertiesName
).ptr())
);
@ -148,4 +149,23 @@ divDevRhoReff
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::IncompressibleTurbulenceModel<TransportModel>::
divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
notImplemented
(
"IncompressibleTurbulenceModel<TransportModel>::"
"divDevRhoReff(const volScalarField& rho, volVectorField& U)"
);
return divDevReff(U);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,6 +38,7 @@ SourceFiles
#include "TurbulenceModel.H"
#include "incompressibleTurbulenceModel.H"
#include "fvMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,12 +73,13 @@ public:
//- Construct
IncompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const TransportModel& trasportModel,
const TransportModel& transport,
const word& propertiesName
);
@ -112,6 +114,13 @@ public:
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
};

View File

@ -1,4 +1,21 @@
incompressibleTurbulenceModel.C
incompressibleTurbulenceModels.C
turbulentTransportModels/turbulentTransportModels.C
turbulentTransportModels/RAS/kOmega/kOmega.C
turbulentTransportModels/RAS/RNGkEpsilon/RNGkEpsilon.C
turbulentTransportModels/RAS/v2f/v2f.C
turbulentTransportModels/RAS/qZeta/qZeta.C
turbulentTransportModels/RAS/kkLOmega/kkLOmega.C
turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C
turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C
turbulentTransportModels/RAS/LienCubicKELowRe/LienCubicKELowRe.C
turbulentTransportModels/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C
turbulentTransportModels/RAS/nonlinearKEShih/nonlinearKEShih.C
BCs = turbulentTransportModels/RAS/derivedFvPatchFields
$(BCs)/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C
$(BCs)/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C
turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libincompressibleTurbulenceModels

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I../turbulenceModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
-I$(LIB_SRC)/transportModels
LIB_LIBS = \
-lincompressibleTransportModels \

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "SpecificIncompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicIncompressibleTurbulenceModel>
Foam::SpecificIncompressibleTurbulenceModel
<
BasicIncompressibleTurbulenceModel
>::SpecificIncompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
BasicIncompressibleTurbulenceModel
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class BasicIncompressibleTurbulenceModel>
Foam::autoPtr
<
Foam::SpecificIncompressibleTurbulenceModel
<
BasicIncompressibleTurbulenceModel
>
>
Foam::SpecificIncompressibleTurbulenceModel
<
BasicIncompressibleTurbulenceModel
>::New
(
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
{
return autoPtr<SpecificIncompressibleTurbulenceModel>
(
static_cast<SpecificIncompressibleTurbulenceModel*>(
BasicIncompressibleTurbulenceModel::New
(
geometricOneField(),
geometricOneField(),
U,
phi,
phi,
transport,
propertiesName
).ptr())
);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,92 +22,88 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::DESModel
Group
grpIcoDESTurbulence
Foam::SpecificIncompressibleTurbulenceModel
Description
Extension of LES models to provide an interface for Detached Eddy
Simulation turbulence models
SeeAlso
Foam::LESModel
Templated abstract base class for specific (RAS/LES) incompressible
turbulence models
SourceFiles
DESModel.C
SpecificIncompressibleTurbulenceModel.C
\*---------------------------------------------------------------------------*/
#ifndef incompressibleDESModel_H
#define incompressibleDESModel_H
#ifndef SpecificIncompressibleTurbulenceModel_H
#define SpecificIncompressibleTurbulenceModel_H
// note: use full(er) path so that derived utilities can bring in
// incompressible and compressible variants
#include "incompressible/LES/LESModel/LESModel.H"
#include "IncompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class DESModel Declaration
Class SpecificIncompressibleTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
class DESModel
template<class BasicIncompressibleTurbulenceModel>
class SpecificIncompressibleTurbulenceModel
:
public LESModel
public BasicIncompressibleTurbulenceModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
DESModel(const DESModel&);
//- Disallow default bitwise assignment
DESModel& operator=(const DESModel&);
public:
typedef typename BasicIncompressibleTurbulenceModel::transportModel
transportModel;
// Constructors
//- Construct from components
DESModel
SpecificIncompressibleTurbulenceModel
(
const word& type,
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName
const word& propertiesName
);
//- Destructor
virtual ~DESModel()
virtual ~SpecificIncompressibleTurbulenceModel()
{}
// Public Member Functions
// Selectors
//- Return the LES field indicator
virtual tmp<volScalarField> LESRegion() const = 0;
//- Return a reference to the selected RAS model
static autoPtr<SpecificIncompressibleTurbulenceModel> New
(
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SpecificIncompressibleTurbulenceModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,5 +27,5 @@ License
@{
This group contains incompressible turbulence models.
@}
\*---------------------------------------------------------------------------*/

View File

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#include "LamBremhorstKE.H"
#include "wallDist.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -42,18 +42,40 @@ namespace RASModels
defineTypeNameAndDebug(LamBremhorstKE, 0);
addToRunTimeSelectionTable(RASModel, LamBremhorstKE, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void LamBremhorstKE::correctNut()
{
nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
LamBremhorstKE::LamBremhorstKE
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
Cmu_
(
@ -96,7 +118,7 @@ LamBremhorstKE::LamBremhorstKE
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -109,7 +131,7 @@ LamBremhorstKE::LamBremhorstKE
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -126,103 +148,24 @@ LamBremhorstKE::LamBremhorstKE
(
sqr(scalar(1) - exp(-0.0165*(sqrt(k_)*y_/nu())))
*(scalar(1) + 20.5/(Rt_ + SMALL))
),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateLowReNut("nut", mesh_)
)
{
bound(k_, kMin_);
// already bounded: bound(epsilon_, epsilonMin_);
nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> LamBremhorstKE::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> LamBremhorstKE::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> LamBremhorstKE::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> LamBremhorstKE::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool LamBremhorstKE::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
Cmu_.readIfPresent(coeffDict());
C1_.readIfPresent(coeffDict());
@ -240,7 +183,7 @@ bool LamBremhorstKE::read()
void LamBremhorstKE::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -293,9 +236,7 @@ void LamBremhorstKE::correct()
solve(kEqn);
bound(k_, kMin_);
// Re-calculate viscosity
nut_ == Cmu_*fMu_*sqr(k_)/epsilon_;
correctNut();
}

View File

@ -39,8 +39,8 @@ SourceFiles
#ifndef LamBremhorstKE_H
#define LamBremhorstKE_H
#include "RASModel.H"
#include "wallDist.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace RASModels
class LamBremhorstKE
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
protected:
@ -80,7 +80,11 @@ protected:
volScalarField Rt_;
volScalarField fMu_;
volScalarField nut_;
// Protected Member Functions
virtual void correctNut();
public:
@ -94,11 +98,14 @@ public:
//- Construct from components
LamBremhorstKE
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -109,11 +116,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -145,27 +149,8 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,10 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "LienCubicKE.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -42,18 +41,82 @@ namespace RASModels
defineTypeNameAndDebug(LienCubicKE, 0);
addToRunTimeSelectionTable(RASModel, LienCubicKE, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void LienCubicKE::correctNut()
{
nut_ =
Cmu_*sqr(k_)/epsilon_
// C5 term, implicit
+ max
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
);
nut_.correctBoundaryConditions();
}
void LienCubicKE::correctNonlinearStress(const volTensorField& gradU)
{
nonlinearStress_ = symm
(
// quadratic terms
pow3(k_)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(gradU & gradU)
+ (gradU & gradU)().T()
)
+ Ctau2_/fEta_*(gradU & gradU.T())
+ Ctau3_/fEta_*(gradU.T() & gradU)
)
// cubic term C4
- 20.0*pow4(k_)/pow3(epsilon_)
*pow3(Cmu_)
*(
((gradU & gradU) & gradU.T())
+ ((gradU & gradU.T()) & gradU.T())
- ((gradU.T() & gradU) & gradU)
- ((gradU.T() & gradU.T()) & gradU)
)
// cubic term C5, explicit part
+ min
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
)*gradU
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
LienCubicKE::LienCubicKE
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
nonlinearEddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
C1_
(
@ -150,25 +213,25 @@ LienCubicKE::LienCubicKE
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("k", mesh_)
mesh_
),
epsilon_
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateEpsilon("epsilon", mesh_)
mesh_
),
eta_
@ -182,142 +245,34 @@ LienCubicKE::LienCubicKE
*sqrt(2.0*magSqr(0.5*(fvc::grad(U) - T(fvc::grad(U)))))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
fEta_(A2_ + pow(eta_, 3.0)),
fEta_(A2_ + pow3(eta_)),
C5viscosity_
(
- 2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
*(
magSqr(fvc::grad(U) + T(fvc::grad(U)))
- magSqr(fvc::grad(U) - T(fvc::grad(U)))
)
),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
),
nonlinearStress_
(
"nonlinearStress",
// quadratic terms
symm
(
pow(k_, 3.0)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(fvc::grad(U) & fvc::grad(U))
+ (fvc::grad(U) & fvc::grad(U))().T()
)
+ Ctau2_/fEta_*(fvc::grad(U) & T(fvc::grad(U)))
+ Ctau3_/fEta_*(T(fvc::grad(U)) & fvc::grad(U))
)
// cubic term C4
- 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0)
*pow(Cmu_, 3.0)
*(
((fvc::grad(U) & fvc::grad(U)) & T(fvc::grad(U)))
+ ((fvc::grad(U) & T(fvc::grad(U))) & T(fvc::grad(U)))
- ((T(fvc::grad(U)) & fvc::grad(U)) & fvc::grad(U))
- ((T(fvc::grad(U)) & T(fvc::grad(U))) & fvc::grad(U))
)
)
)
{
bound(k_, kMin_);
// already bounded: bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_ + C5viscosity_;
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
correctNonlinearStress(fvc::grad(U));
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> LienCubicKE::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)) + nonlinearStress_,
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> LienCubicKE::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_))) + nonlinearStress_
)
);
}
tmp<fvVectorMatrix> LienCubicKE::divDevReff(volVectorField& U) const
{
return
(
fvc::div(nonlinearStress_)
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> LienCubicKE::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
fvc::div(rho*nonlinearStress_)
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool LienCubicKE::read()
{
if (RASModel::read())
if (nonlinearEddyViscosity<incompressible::RASModel>::read())
{
C1_.readIfPresent(coeffDict());
C2_.readIfPresent(coeffDict());
@ -341,7 +296,7 @@ bool LienCubicKE::read()
void LienCubicKE::correct()
{
RASModel::correct();
nonlinearEddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -404,38 +359,14 @@ void LienCubicKE::correct()
eta_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU + gradU.T())));
ksi_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU - gradU.T())));
Cmu_ = 2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_));
fEta_ = A2_ + pow(eta_, 3.0);
fEta_ = A2_ + pow3(eta_);
C5viscosity_ =
- 2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0)
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
*(magSqr(gradU + gradU.T()) - magSqr(gradU - gradU.T()));
nut_ = Cmu_*sqr(k_)/epsilon_ + C5viscosity_;
nut_.correctBoundaryConditions();
nonlinearStress_ = symm
(
// quadratic terms
pow(k_, 3.0)/sqr(epsilon_)*
(
Ctau1_/fEta_*
(
(gradU & gradU)
+ (gradU & gradU)().T()
)
+ Ctau2_/fEta_*(gradU & gradU.T())
+ Ctau3_/fEta_*(gradU.T() & gradU)
)
// cubic term C4
- 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0)
*pow(Cmu_, 3.0)
*(
((gradU & gradU) & gradU.T())
+ ((gradU & gradU.T()) & gradU.T())
- ((gradU.T() & gradU) & gradU)
- ((gradU.T() & gradU.T()) & gradU)
)
);
correctNut();
correctNonlinearStress(gradU);
}

View File

@ -38,7 +38,8 @@ SourceFiles
#ifndef LienCubicKE_H
#define LienCubicKE_H
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "nonlinearEddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +56,7 @@ namespace RASModels
class LienCubicKE
:
public RASModel
public nonlinearEddyViscosity<incompressible::RASModel>
{
protected:
@ -87,9 +88,11 @@ protected:
volScalarField fEta_;
volScalarField C5viscosity_;
volScalarField nut_;
volSymmTensorField nonlinearStress_;
// Protected Member Functions
virtual void correctNut();
virtual void correctNonlinearStress(const volTensorField& gradU);
public:
@ -102,11 +105,14 @@ public:
//- Construct from components
LienCubicKE
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -117,11 +123,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -153,27 +156,8 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,11 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "LienCubicKELowRe.H"
#include "wallDist.H"
#include "wallFvPatch.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -43,18 +43,90 @@ namespace RASModels
defineTypeNameAndDebug(LienCubicKELowRe, 0);
addToRunTimeSelectionTable(RASModel, LienCubicKELowRe, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<volScalarField> LienCubicKELowRe::fMu()
{
return
(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL);
}
void LienCubicKELowRe::correctNut()
{
nut_ =
Cmu_*fMu()*sqr(k_)/epsilon_
// C5 term, implicit
+ max
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
);
nut_.correctBoundaryConditions();
}
void LienCubicKELowRe::correctNonlinearStress(const volTensorField& gradU)
{
nonlinearStress_ = symm
(
// quadratic terms
pow3(k_)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(gradU & gradU)
+ (gradU & gradU)().T()
)
+ Ctau2_/fEta_*(gradU & gradU.T())
+ Ctau3_/fEta_*(gradU.T() & gradU)
)
// cubic term C4
- 20.0*pow4(k_)/pow3(epsilon_)
*pow3(Cmu_)
*(
((gradU & gradU) & gradU.T())
+ ((gradU & gradU.T()) & gradU.T())
- ((gradU.T() & gradU) & gradU)
- ((gradU.T() & gradU.T()) & gradU)
)
// cubic term C5, explicit part
+ min
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
)*gradU
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
LienCubicKELowRe::LienCubicKELowRe
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
nonlinearEddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
C1_
(
@ -196,7 +268,7 @@ LienCubicKELowRe::LienCubicKELowRe
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -209,7 +281,7 @@ LienCubicKELowRe::LienCubicKELowRe
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -235,156 +307,32 @@ LienCubicKELowRe::LienCubicKELowRe
C5viscosity_
(
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
*(
magSqr(fvc::grad(U) + T(fvc::grad(U)))
- magSqr(fvc::grad(U) - T(fvc::grad(U)))
magSqr(fvc::grad(U) + T(fvc::grad(U)))
- magSqr(fvc::grad(U) - T(fvc::grad(U)))
)
),
yStar_(sqrt(k_)*y_/nu() + SMALL),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateLowReNut("nut", mesh_)
),
nonlinearStress_
(
"nonlinearStress",
symm
(
// quadratic terms
pow3(k_)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(fvc::grad(U) & fvc::grad(U))
+ (fvc::grad(U) & fvc::grad(U))().T()
)
+ Ctau2_/fEta_*(fvc::grad(U) & T(fvc::grad(U)))
+ Ctau3_/fEta_*(T(fvc::grad(U)) & fvc::grad(U))
)
// cubic term C4
- 20.0*pow4(k_)/pow3(epsilon_)
*pow3(Cmu_)
*(
((fvc::grad(U) & fvc::grad(U)) & T(fvc::grad(U)))
+ ((fvc::grad(U) & T(fvc::grad(U))) & T(fvc::grad(U)))
- ((T(fvc::grad(U)) & fvc::grad(U)) & fvc::grad(U))
- ((T(fvc::grad(U)) & T(fvc::grad(U))) & fvc::grad(U))
)
// cubic term C5, explicit part
+ min
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
)*fvc::grad(U)
)
)
yStar_(sqrt(k_)*y_/nu() + SMALL)
{
bound(k_, kMin_);
// already bounded: bound(epsilon_, epsilonMin_);
nut_ = Cmu_
* (scalar(1) - exp(-Am_*yStar_))
/ (scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
* sqr(k_)/epsilon_
// cubic term C5, implicit part
+ max
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
);
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
correctNonlinearStress(fvc::grad(U));
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> LienCubicKELowRe::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)) + nonlinearStress_,
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> LienCubicKELowRe::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_))) + nonlinearStress_
)
);
}
tmp<fvVectorMatrix> LienCubicKELowRe::divDevReff(volVectorField& U) const
{
return
(
fvc::div(nonlinearStress_)
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> LienCubicKELowRe::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
fvc::div(rho*nonlinearStress_)
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool LienCubicKELowRe::read()
{
if (RASModel::read())
if (nonlinearEddyViscosity<incompressible::RASModel>::read())
{
C1_.readIfPresent(coeffDict());
C2_.readIfPresent(coeffDict());
@ -413,7 +361,7 @@ bool LienCubicKELowRe::read()
void LienCubicKELowRe::correct()
{
RASModel::correct();
nonlinearEddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -429,11 +377,6 @@ void LienCubicKELowRe::correct()
yStar_ = sqrt(k_)*y_/nu() + SMALL;
tmp<volScalarField> Rt = sqr(k_)/(nu()*epsilon_);
const volScalarField fMu
(
(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
);
const volScalarField f2
(
scalar(1) - 0.3*exp(-sqr(Rt))
@ -442,7 +385,7 @@ void LienCubicKELowRe::correct()
volScalarField G
(
GName(),
Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU)
Cmu_*fMu()*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU)
);
// Dissipation equation
@ -491,50 +434,14 @@ void LienCubicKELowRe::correct()
eta_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU + gradU.T())));
ksi_ = k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU - gradU.T())));
Cmu_ = 2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_));
fEta_ = A2_ + pow(eta_, 3.0);
fEta_ = A2_ + pow3(eta_);
C5viscosity_ =
- 2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0)
-2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
*(magSqr(gradU + gradU.T()) - magSqr(gradU - gradU.T()));
nut_ =
Cmu_*fMu*sqr(k_)/epsilon_
// C5 term, implicit
+ max
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
);
nonlinearStress_ = symm
(
// quadratic terms
pow(k_, 3.0)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(gradU & gradU)
+ (gradU & gradU)().T()
)
+ Ctau2_/fEta_*(gradU & gradU.T())
+ Ctau3_/fEta_*(gradU.T() & gradU)
)
// cubic term C4
- 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0)
*pow(Cmu_, 3.0)
*(
((gradU & gradU) & gradU.T())
+ ((gradU & gradU.T()) & gradU.T())
- ((gradU.T() & gradU) & gradU)
- ((gradU.T() & gradU.T()) & gradU)
)
// cubic term C5, explicit part
+ min
(
C5viscosity_,
dimensionedScalar("0", C5viscosity_.dimensions(), 0.0)
)*gradU
);
correctNut();
correctNonlinearStress(gradU);
}

View File

@ -53,8 +53,8 @@ SourceFiles
#ifndef LienCubicKELowRe_H
#define LienCubicKELowRe_H
#include "RASModel.H"
#include "wallDist.H"
#include "turbulentTransportModel.H"
#include "nonlinearEddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,7 +71,7 @@ namespace RASModels
class LienCubicKELowRe
:
public RASModel
public nonlinearEddyViscosity<incompressible::RASModel>
{
protected:
@ -117,9 +117,13 @@ protected:
volScalarField yStar_;
volScalarField nut_;
volSymmTensorField nonlinearStress_;
// Protected Member Functions
tmp<volScalarField> fMu();
virtual void correctNut();
virtual void correctNonlinearStress(const volTensorField& gradU);
public:
@ -132,11 +136,14 @@ public:
//- Construct from components
LienCubicKELowRe
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -147,11 +154,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -183,27 +187,8 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,11 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "LienLeschzinerLowRe.H"
#include "wallDist.H"
#include "wallFvPatch.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -43,18 +43,48 @@ namespace RASModels
defineTypeNameAndDebug(LienLeschzinerLowRe, 0);
addToRunTimeSelectionTable(RASModel, LienLeschzinerLowRe, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<volScalarField> LienLeschzinerLowRe::fMu()
{
return
(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL);
}
void LienLeschzinerLowRe::correctNut()
{
nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
LienLeschzinerLowRe::LienLeschzinerLowRe
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
C1_
(
@ -142,7 +172,7 @@ LienLeschzinerLowRe::LienLeschzinerLowRe
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -155,7 +185,7 @@ LienLeschzinerLowRe::LienLeschzinerLowRe
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -166,107 +196,24 @@ LienLeschzinerLowRe::LienLeschzinerLowRe
y_(wallDist::New(mesh_).y()),
yStar_(sqrt(k_)*y_/nu() + SMALL),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateLowReNut("nut", mesh_)
)
yStar_(sqrt(k_)*y_/nu() + SMALL)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)*sqr(k_)
/(epsilon_);
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> LienLeschzinerLowRe::R() const
{
tmp<volTensorField> gradU = fvc::grad(U_);
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(gradU),
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> LienLeschzinerLowRe::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> LienLeschzinerLowRe::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*T(fvc::grad(U)))
);
}
tmp<fvVectorMatrix> LienLeschzinerLowRe::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool LienLeschzinerLowRe::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
C1_.readIfPresent(coeffDict());
C2_.readIfPresent(coeffDict());
@ -289,7 +236,7 @@ bool LienLeschzinerLowRe::read()
void LienLeschzinerLowRe::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -306,15 +253,9 @@ void LienLeschzinerLowRe::correct()
yStar_ = sqrt(k_)*y_/nu() + SMALL;
tmp<volScalarField> Rt = sqr(k_)/(nu()*epsilon_);
volScalarField fMu
(
(scalar(1) - exp(-Am_*yStar_))
/(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)
);
const volScalarField f2(scalar(1) - 0.3*exp(-sqr(Rt)));
volScalarField G(GName(), Cmu_*fMu*sqr(k_)/epsilon_*S2);
volScalarField G(GName(), Cmu_*fMu()*sqr(k_)/epsilon_*S2);
// Dissipation equation
@ -357,9 +298,7 @@ void LienLeschzinerLowRe::correct()
solve(kEqn);
bound(k_, kMin_);
// Re-calculate viscosity
nut_ = Cmu_*fMu*sqr(k_)/epsilon_;
correctNut();
}

View File

@ -39,8 +39,8 @@ SourceFiles
#ifndef LienLeschzinerLowRe_H
#define LienLeschzinerLowRe_H
#include "RASModel.H"
#include "wallDist.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace RASModels
class LienLeschzinerLowRe
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
protected:
@ -90,7 +90,12 @@ protected:
volScalarField yStar_;
volScalarField nut_;
// Protected Member Functions
tmp<volScalarField> fMu();
virtual void correctNut();
public:
@ -102,11 +107,14 @@ public:
//- Construct from components
LienLeschzinerLowRe
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -117,11 +125,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -153,27 +158,8 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,10 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "RNGkEpsilon.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -42,18 +41,40 @@ namespace RASModels
defineTypeNameAndDebug(RNGkEpsilon, 0);
addToRunTimeSelectionTable(RASModel, RNGkEpsilon, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void RNGkEpsilon::correctNut()
{
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
RNGkEpsilon::RNGkEpsilon
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
Cmu_
(
@ -123,122 +144,43 @@ RNGkEpsilon::RNGkEpsilon
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("k", mesh_)
mesh_
),
epsilon_
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateEpsilon("epsilon", mesh_)
),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
mesh_
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> RNGkEpsilon::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> RNGkEpsilon::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> RNGkEpsilon::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> RNGkEpsilon::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool RNGkEpsilon::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
Cmu_.readIfPresent(coeffDict());
C1_.readIfPresent(coeffDict());
@ -259,7 +201,7 @@ bool RNGkEpsilon::read()
void RNGkEpsilon::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -286,7 +228,6 @@ void RNGkEpsilon::correct()
- fvm::laplacian(DepsilonEff(), epsilon_)
==
(C1_ - R)*G*epsilon_/k_
//- fvm::SuSp(R*G/k_, epsilon_)
- fvm::Sp(C2_*epsilon_/k_, epsilon_)
);
@ -313,10 +254,7 @@ void RNGkEpsilon::correct()
solve(kEqn);
bound(k_, kMin_);
// Re-calculate viscosity
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
correctNut();
}

View File

@ -60,7 +60,8 @@ SourceFiles
#ifndef RNGkEpsilon_H
#define RNGkEpsilon_H
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,7 +78,7 @@ namespace RASModels
class RNGkEpsilon
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
protected:
@ -99,7 +100,11 @@ protected:
volScalarField k_;
volScalarField epsilon_;
volScalarField nut_;
// Protected Member Functions
virtual void correctNut();
public:
@ -112,11 +117,14 @@ public:
//- Construct from components
RNGkEpsilon
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -127,11 +135,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -163,27 +168,8 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,11 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#include "fWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "v2f.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
#include "v2f.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -174,13 +173,19 @@ void fWallFunctionFvPatchScalarField::updateCoeffs()
return;
}
const label patchI = patch().index();
const label patchi = patch().index();
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
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 scalarField& y = v2fModel.y()[patchi];
const tmp<volScalarField> tk = v2fModel.k();
const volScalarField& k = tk();
@ -191,8 +196,8 @@ void fWallFunctionFvPatchScalarField::updateCoeffs()
const tmp<volScalarField> tv2 = v2fModel.v2();
const volScalarField& v2 = tv2();
const tmp<volScalarField> tnu = v2fModel.nu();
const scalarField& nuw = tnu().boundaryField()[patchI];
const tmp<scalarField> tnuw = turbulence.nu(patchi);
const scalarField& nuw = tnuw();
const scalar Cmu25 = pow025(Cmu_);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,10 +22,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::fWallFunctionFvPatchScalarField
Foam::RASModels::fWallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
grpWallFunctions
Description
This boundary condition provides a turbulence damping function, f, wall

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "v2WallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -173,17 +173,23 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs()
return;
}
const label patchI = patch().index();
const label patchi = patch().index();
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbulence.y()[patchI];
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<volScalarField> tnu = turbulence.nu();
const scalarField& nuw = tnu().boundaryField()[patchI];
const tmp<scalarField> tnuw = turbulence.nu(patchi);
const scalarField& nuw = tnuw();
const scalar Cmu25 = pow025(Cmu_);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,10 +22,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::v2WallFunctionFvPatchScalarField
Foam::RASModels::v2WallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
grpWallFunctions
Description
This boundary condition provides a turbulence stress normal to streamlines

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -0,0 +1,144 @@
turbulenceModelName -> propertiesName
modelName -> type
* Header
*** Includes
- Remove
#include "RASModel.H"
+ Add
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
*** Base class
- Change
RASModel -> eddyViscosity<RASModel>
*** Protected data
- Remove
volScalarField nut_;
*** Constructor
+ Add
const geometricOneField& alpha,
const geometricOneField& rho,
.
const surfaceScalarField& alphaRhoPhi,
*** Private member functions
+ Add
// Protected Member Functions
virtual void correctNut();
*** Member functions
- Remove
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
+ Move to top
//- Read RASProperties dictionary
virtual bool read();
* Source
*** Includes
+ Add
#include "bound.H"
- Remove
#include "backwardsCompatibilityWallFunctions.H"
*** Constructor
+ Add arguments
const geometricOneField& alpha,
const geometricOneField& rho,
.
const surfaceScalarField& alphaRhoPhi,
+ Replace
RASModel(modelName, U, phi, transport, turbulenceModelName),
with
eddyViscosity<RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
+ Replace
autoCreate.*mesh_) -> mesh_
NO_READ -> MUST_READ
- Remove
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
)
+ Replace
nut_ = k_/omega_;
nut_.correctBoundaryConditions();
printCoeffs();
with
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
*** Member functions
+ Move read to top
+ Add after read
void kOmega::correctNut()
{
....
nut_.correctBoundaryConditions();
}
- Remove
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
*** correct()
- Replace
// Re-calculate viscosity
nut_ = Cmu_*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
with
correctNut();

View File

@ -24,10 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "kOmega.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -42,18 +41,40 @@ namespace RASModels
defineTypeNameAndDebug(kOmega, 0);
addToRunTimeSelectionTable(RASModel, kOmega, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void kOmega::correctNut()
{
nut_ = k_/omega_;
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
kOmega::kOmega
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
Cmu_
(
@ -105,121 +126,43 @@ kOmega::kOmega
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("k", mesh_)
mesh_
),
omega_
(
IOobject
(
"omega",
IOobject::groupName("omega", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateOmega("omega", mesh_)
),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
mesh_
)
{
bound(k_, kMin_);
bound(omega_, omegaMin_);
nut_ = k_/omega_;
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> kOmega::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> kOmega::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> kOmega::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> kOmega::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool kOmega::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
Cmu_.readIfPresent(coeffDict());
beta_.readIfPresent(coeffDict());
@ -237,7 +180,7 @@ bool kOmega::read()
void kOmega::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -283,10 +226,7 @@ void kOmega::correct()
solve(kEqn);
bound(k_, kMin_);
// Re-calculate viscosity
nut_ = k_/omega_;
nut_.correctBoundaryConditions();
correctNut();
}

View File

@ -62,7 +62,8 @@ SourceFiles
#ifndef kOmega_H
#define kOmega_H
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,7 +80,7 @@ namespace RASModels
class kOmega
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
protected:
@ -99,7 +100,11 @@ protected:
volScalarField k_;
volScalarField omega_;
volScalarField nut_;
// Protected Member Functions
virtual void correctNut();
public:
@ -107,16 +112,20 @@ public:
//- Runtime type information
TypeName("kOmega");
// Constructors
//- Construct from components
kOmega
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -127,11 +136,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -182,27 +188,8 @@ public:
);
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#include "kkLOmega.H"
#include "bound.H"
#include "wallDist.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -42,7 +42,7 @@ namespace RASModels
defineTypeNameAndDebug(kkLOmega, 0);
addToRunTimeSelectionTable(RASModel, kkLOmega, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
tmp<volScalarField> kkLOmega::fv(const volScalarField& Ret) const
{
@ -200,18 +200,40 @@ tmp<volScalarField> kkLOmega::gammaNAT
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void kkLOmega::correctNut()
{
nut_ = kt_/omega_;
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
kkLOmega::kkLOmega
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
A0_
(
@ -460,49 +482,37 @@ kkLOmega::kkLOmega
(
IOobject
(
"kt",
IOobject::groupName("kt", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("kt", mesh_)
mesh_
),
omega_
(
IOobject
(
"omega",
IOobject::groupName("omega", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateOmega("omega", mesh_)
mesh_
),
kl_
(
IOobject
(
"kl",
IOobject::groupName("kl", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
autoCreateK("kl", mesh_)
),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
mesh_
),
y_(wallDist::New(mesh_).y())
{
@ -510,85 +520,22 @@ kkLOmega::kkLOmega
bound(kl_, kMin_);
bound(omega_, omegaMin_);
nut_ = kt_/(omega_ + omegaMin_);
nut_.correctBoundaryConditions();
if (type == typeName)
{
// This is only an approximate nut, so only good for initialization
// not restart
// correctNut();
printCoeffs();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> kkLOmega::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*(kt_) - nut_*twoSymm(fvc::grad(U_)),
kt_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> kkLOmega::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> kkLOmega::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> kkLOmega::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool kkLOmega::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
A0_.readIfPresent(coeffDict());
As_.readIfPresent(coeffDict());
@ -630,7 +577,7 @@ bool kkLOmega::read()
void kkLOmega::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -641,7 +588,6 @@ void kkLOmega::correct()
const volScalarField kT(kt_ + kl_);
const volScalarField lambdaT(sqrt(kT)/(omega_ + omegaMin_));
const volScalarField lambdaEff(min(Clambda_*y_, lambdaT));
const volScalarField fw
@ -650,9 +596,7 @@ void kkLOmega::correct()
);
const volTensorField gradU(fvc::grad(U_));
const volScalarField omega(sqrt(2.0)*mag(skew(gradU)));
const volScalarField S2(2.0*magSqr(symm(gradU)));
const volScalarField ktS(fSS(omega)*fw*kt_);
@ -663,6 +607,7 @@ void kkLOmega::correct()
*fINT()
*Cmu(sqrt(S2))*sqrt(ktS)*lambdaEff
);
const volScalarField Pkt(nuts*S2);
const volScalarField ktL(kt_ - ktS);
@ -674,7 +619,7 @@ void kkLOmega::correct()
C11_*fTaul(lambdaEff, ktL)*omega*sqr(lambdaEff)
* sqrt(ktL)*lambdaEff/nu()
+ C12_*BetaTS(ReOmega)*ReOmega*sqr(y_)*omega
,
,
0.5*(kl_ + ktL)/sqrt(S2)
)
);
@ -748,6 +693,7 @@ void kkLOmega::correct()
omega_.boundaryField().updateCoeffs();
// Turbulence specific dissipation rate equation
tmp<fvScalarMatrix> omegaEqn
(

View File

@ -80,8 +80,8 @@ SourceFiles
#ifndef kkLOmega_H
#define kkLOmega_H
#include "RASModel.H"
#include "wallDist.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -98,7 +98,7 @@ namespace RASModels
class kkLOmega
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
// Private memmber functions
@ -180,7 +180,6 @@ protected:
volScalarField kt_;
volScalarField omega_;
volScalarField kl_;
volScalarField nut_;
//- Wall distance
// Note: different to wall distance in parent RASModel
@ -188,21 +187,30 @@ protected:
const volScalarField& y_;
// Protected Member Functions
virtual void correctNut();
public:
//- Runtime type information
TypeName("kkLOmega");
// Constructors
//- Construct from components
kkLOmega
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -213,11 +221,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff(const volScalarField& alphaT) const
@ -274,27 +279,8 @@ public:
);
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -23,10 +23,11 @@ License
\*---------------------------------------------------------------------------*/
#include "NonlinearKEShih.H"
#include "addToRunTimeSelectionTable.H"
#include "nonlinearKEShih.H"
#include "bound.H"
#include "wallFvPatch.H"
#include "nutkWallFunctionFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,21 +40,61 @@ namespace RASModels
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(NonlinearKEShih, 0);
addToRunTimeSelectionTable(RASModel, NonlinearKEShih, dictionary);
defineTypeNameAndDebug(nonlinearKEShih, 0);
addToRunTimeSelectionTable(RASModel, nonlinearKEShih, dictionary);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nonlinearKEShih::correctNut()
{
nut_ = Cmu_*sqr(k_)/epsilon_;
#include "wallNonlinearViscosityI.H"
}
void nonlinearKEShih::correctNonlinearStress(const volTensorField& gradU)
{
nonlinearStress_ = symm
(
pow(k_, 3.0)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(gradU & gradU)
+ (gradU & gradU)().T()
)
+ Ctau2_/fEta_*(gradU & T(gradU))
+ Ctau3_/fEta_*(T(gradU) & gradU)
)
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
NonlinearKEShih::NonlinearKEShih
nonlinearKEShih::nonlinearKEShih
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
nonlinearEddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
C1_
(
@ -169,7 +210,7 @@ NonlinearKEShih::NonlinearKEShih
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -182,7 +223,7 @@ NonlinearKEShih::NonlinearKEShih
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -202,111 +243,25 @@ NonlinearKEShih::NonlinearKEShih
*sqrt(2.0*magSqr(0.5*(fvc::grad(U) - T(fvc::grad(U)))))
),
Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))),
fEta_(A2_ + pow(eta_, 3.0)),
nut_("nut", Cmu_*sqr(k_)/epsilon_),
nonlinearStress_
(
"nonlinearStress",
symm
(
pow3(k_)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(fvc::grad(U) & fvc::grad(U))
+ (fvc::grad(U) & fvc::grad(U))().T()
)
+ Ctau2_/fEta_*(fvc::grad(U) & T(fvc::grad(U)))
+ Ctau3_/fEta_*(T(fvc::grad(U)) & fvc::grad(U))
)
)
)
fEta_(A2_ + pow(eta_, 3.0))
{
bound(k_, kMin_);
// already bounded: bound(epsilon_, epsilonMin_);
#include "wallNonlinearViscosityI.H"
printCoeffs();
if (type == typeName)
{
correctNut();
correctNonlinearStress(fvc::grad(U));
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> NonlinearKEShih::R() const
bool nonlinearKEShih::read()
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)) + nonlinearStress_,
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> NonlinearKEShih::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_))) + nonlinearStress_
)
);
}
tmp<fvVectorMatrix> NonlinearKEShih::divDevReff(volVectorField& U) const
{
return
(
fvc::div(nonlinearStress_)
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> NonlinearKEShih::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
fvc::div(rho*nonlinearStress_)
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool NonlinearKEShih::read()
{
if (RASModel::read())
if (nonlinearEddyViscosity<incompressible::RASModel>::read())
{
C1_.readIfPresent(coeffDict());
C2_.readIfPresent(coeffDict());
@ -331,9 +286,9 @@ bool NonlinearKEShih::read()
}
void NonlinearKEShih::correct()
void nonlinearKEShih::correct()
{
RASModel::correct();
nonlinearEddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -397,23 +352,8 @@ void NonlinearKEShih::correct()
Cmu_ = 2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_));
fEta_ = A2_ + pow(eta_, 3.0);
nut_ = Cmu_*sqr(k_)/epsilon_;
#include "wallNonlinearViscosityI.H"
nonlinearStress_ = symm
(
pow(k_, 3.0)/sqr(epsilon_)
*(
Ctau1_/fEta_
*(
(gradU & gradU)
+ (gradU & gradU)().T()
)
+ Ctau2_/fEta_*(gradU & T(gradU))
+ Ctau3_/fEta_*(T(gradU) & gradU)
)
);
correctNut();
correctNonlinearStress(gradU);
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::RASModels::NonlinearKEShih
Foam::incompressible::RASModels::nonlinearKEShih
Group
grpIcoRASTurbulence
@ -32,14 +32,15 @@ Description
incompressible flows
SourceFiles
NonlinearKEShih.C
nonlinearKEShih.C
\*---------------------------------------------------------------------------*/
#ifndef NonlinearKEShih_H
#define NonlinearKEShih_H
#ifndef nonlinearKEShih_H
#define nonlinearKEShih_H
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "nonlinearEddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,12 +52,12 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class NonlinearKEShih Declaration
Class nonlinearKEShih Declaration
\*---------------------------------------------------------------------------*/
class NonlinearKEShih
class nonlinearKEShih
:
public RASModel
public nonlinearEddyViscosity<incompressible::RASModel>
{
protected:
@ -90,41 +91,44 @@ protected:
volScalarField Cmu_;
volScalarField fEta_;
volScalarField nut_;
volSymmTensorField nonlinearStress_;
// Protected Member Functions
virtual void correctNut();
virtual void correctNonlinearStress(const volTensorField& gradU);
public:
//- Runtime type information
TypeName("NonlinearKEShih");
TypeName("nonlinearKEShih");
// Constructors
//- Construct from components
NonlinearKEShih
nonlinearKEShih
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
//- Destructor
virtual ~NonlinearKEShih()
virtual ~nonlinearKEShih()
{}
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -156,27 +160,8 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,10 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "qZeta.H"
#include "bound.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -68,18 +67,38 @@ tmp<volScalarField> qZeta::f2() const
}
void qZeta::correctNut()
{
nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
qZeta::qZeta
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
Cmu_
(
@ -127,14 +146,14 @@ qZeta::qZeta
)
),
qMin_("qMin", dimVelocity, SMALL),
zetaMin_("zetaMin", dimVelocity/dimTime, SMALL),
qMin_("qMin", sqrt(kMin_)),
zetaMin_("zetaMin", epsilonMin_/(2*qMin_)),
k_
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -147,7 +166,7 @@ qZeta::qZeta
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -160,13 +179,13 @@ qZeta::qZeta
(
IOobject
(
"q",
IOobject::groupName("q", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
sqrt(k_),
sqrt(bound(k_, kMin_)),
k_.boundaryField().types()
),
@ -174,113 +193,31 @@ qZeta::qZeta
(
IOobject
(
"zeta",
IOobject::groupName("zeta", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
epsilon_/(2.0*bound(q_, qMin_)),
bound(epsilon_, epsilonMin_)/(2.0*q_),
epsilon_.boundaryField().types()
),
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateNut("nut", mesh_)
)
{
bound(k_, kMin_);
bound(epsilon_, epsilonMin_);
// already bounded: bound(q_, qMin_);
bound(zeta_, zetaMin_);
nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> qZeta::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
k_.boundaryField().types()
)
);
}
tmp<volSymmTensorField> qZeta::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> qZeta::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> qZeta::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool qZeta::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
Cmu_.readIfPresent(coeffDict());
C1_.readIfPresent(coeffDict());
@ -302,7 +239,7 @@ bool qZeta::read()
void qZeta::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -356,10 +293,7 @@ void qZeta::correct()
epsilon_ = 2*q_*zeta_;
epsilon_.correctBoundaryConditions();
// Re-calculate viscosity
nut_ = Cmu_*fMu()*sqr(k_)/epsilon_;
nut_.correctBoundaryConditions();
correctNut();
}

View File

@ -52,7 +52,8 @@ SourceFiles
#ifndef qZeta_H
#define qZeta_H
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,7 +70,7 @@ namespace RASModels
class qZeta
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
protected:
@ -98,13 +99,12 @@ protected:
volScalarField q_;
volScalarField zeta_;
volScalarField nut_;
// Protected Member Functions
tmp<volScalarField> fMu() const;
tmp<volScalarField> f2() const;
virtual void correctNut();
public:
@ -117,11 +117,14 @@ public:
//- Construct from components
qZeta
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -132,37 +135,31 @@ public:
// Member Functions
// Access
//- Read RASProperties dictionary
virtual bool read();
//- Return the lower allowable limit for q (default: SMALL)
const dimensionedScalar& qMin() const
{
return qMin_;
}
//- Return the lower allowable limit for zeta (default: SMALL)
const dimensionedScalar& zetaMin() const
{
return zetaMin_;
}
//- Allow qMin to be changed
dimensionedScalar& qMin()
{
return qMin_;
}
//- Allow zetaMin to be changed
dimensionedScalar& zetaMin()
{
return zetaMin_;
}
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
//- Return the lower allowable limit for q (default: SMALL)
const dimensionedScalar& qMin() const
{
return nut_;
return qMin_;
}
//- Return the lower allowable limit for zeta (default: SMALL)
const dimensionedScalar& zetaMin() const
{
return zetaMin_;
}
//- Allow qMin to be changed
dimensionedScalar& qMin()
{
return qMin_;
}
//- Allow zetaMin to be changed
dimensionedScalar& zetaMin()
{
return zetaMin_;
}
//- Return the effective diffusivity for q
@ -195,9 +192,6 @@ public:
return epsilon_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
virtual const volScalarField& q() const
{
return q_;
@ -208,24 +202,8 @@ public:
return zeta_;
}
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "v2f.H"
#include "bound.H"
#include "fixedValueFvPatchField.H"
#include "zeroGradientFvPatchField.H"
#include "addToRunTimeSelectionTable.H"
@ -44,37 +45,6 @@ addToRunTimeSelectionTable(RASModel, v2f, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
wordList v2f::RBoundaryTypes() const
{
const volScalarField::GeometricBoundaryField& bf(k_.boundaryField());
wordList bTypes
(
bf.size(),
zeroGradientFvPatchField<symmTensor>::typeName
);
forAll(bf, patchI)
{
if (bf[patchI].fixesValue())
{
bTypes[patchI] = fixedValueFvPatchField<symmTensor>::typeName;
}
}
return bTypes;
}
tmp<volScalarField> v2f::davidsonCorrectNut
(
const tmp<volScalarField>& value
) const
{
return min(CmuKEps_*sqr(k_)/epsilon_, value);
}
tmp<volScalarField> v2f::Ts() const
{
return max(k_/epsilon_, 6.0*sqrt(nu()/epsilon_));
@ -87,18 +57,38 @@ tmp<volScalarField> v2f::Ls() const
}
void v2f::correctNut()
{
nut_ = min(CmuKEps_*sqr(k_)/epsilon_, Cmu_*v2_*Ts());
nut_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
v2f::v2f
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName,
const word& modelName
const word& propertiesName,
const word& type
)
:
RASModel(modelName, U, phi, transport, turbulenceModelName),
eddyViscosity<incompressible::RASModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
Cmu_
(
@ -186,7 +176,7 @@ v2f::v2f
(
IOobject
(
"k",
IOobject::groupName("k", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -198,7 +188,7 @@ v2f::v2f
(
IOobject
(
"epsilon",
IOobject::groupName("epsilon", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -210,7 +200,7 @@ v2f::v2f
(
IOobject
(
"v2",
IOobject::groupName("v2", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -222,19 +212,7 @@ v2f::v2f
(
IOobject
(
"f",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
nut_
(
IOobject
(
"nut",
IOobject::groupName("f", U.group()),
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
@ -250,85 +228,19 @@ v2f::v2f
bound(v2_, v2Min_);
bound(f_, fMin_);
nut_ = davidsonCorrectNut(Cmu_*v2_*Ts());
nut_.correctBoundaryConditions();
printCoeffs();
if (type == typeName)
{
correctNut();
printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<volSymmTensorField> v2f::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
RBoundaryTypes()
)
);
}
tmp<volSymmTensorField> v2f::devReff() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"devRhoReff",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(U_)))
)
);
}
tmp<fvVectorMatrix> v2f::divDevReff(volVectorField& U) const
{
return
(
- fvm::laplacian(nuEff(), U)
- fvc::div(nuEff()*dev(T(fvc::grad(U))))
);
}
tmp<fvVectorMatrix> v2f::divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const
{
volScalarField muEff("muEff", rho*nuEff());
return
(
- fvm::laplacian(muEff, U)
- fvc::div(muEff*dev(T(fvc::grad(U))))
);
}
bool v2f::read()
{
if (RASModel::read())
if (eddyViscosity<incompressible::RASModel>::read())
{
Cmu_.readIfPresent(coeffDict());
CmuKEps_.readIfPresent(coeffDict());
@ -351,7 +263,7 @@ bool v2f::read()
void v2f::correct()
{
RASModel::correct();
eddyViscosity<incompressible::RASModel>::correct();
if (!turbulence_)
{
@ -373,7 +285,6 @@ void v2f::correct()
1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0))
);
tmp<volScalarField> Ceps1 =
1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0)));
@ -444,10 +355,7 @@ void v2f::correct()
solve(v2Eqn);
bound(v2_, v2Min_);
// Re-calculate viscosity
nut_ = davidsonCorrectNut(Cmu_*v2_*T);
nut_.correctBoundaryConditions();
correctNut();
}

View File

@ -31,9 +31,11 @@ Description
Lien and Kalitzin's v2-f turbulence model for incompressible flows, with
a limit imposed on the turbulent viscosity given by Davidson et al.
The model solves for turbulence k and epsilon, with additional equations
for the turbulence stress normal to streamlines, v2, and elliptic damping
function, f. The variant implemented employs N=6, such that f=0 on walls.
The model solves for turbulence kinetic energy k and turbulence dissipation
rate epsilon, with additional equations for the turbulence stress normal to
streamlines, v2, and elliptic damping function, f.
The variant implemented employs N=6, such that f=0 on walls.
Wall boundary conditions are:
@ -49,15 +51,17 @@ Description
v2 = 2/3 k
f = zero-gradient
References:
\verbatim
Lien F-S, Kalitzin G,
"Computations of transonic flow with the v2-f turbulence model",
Int. J. Heat Fluid Flow 22, 2001, pp 53-61
Lien F-S, Kalitzin G, 2001. Computations of transonic flow with the v2-f
turbulence model. Int. J. Heat Fluid Flow 22, pp 53-61
Davidson L, Nielsen P, Sveningsson A, 2003. Modifications of the v2-f
model for computing the flow in a 3D wall jet. Turbulence, Heat and Mass
Transfer 4, pp 577-584
Davidson L, Nielsen P, Sveningsson A,
"Modifications of the v2-f model for computing the flow in a
3D wall jet",
Turbulence, Heat and Mass Transfer 4, 2003, pp 577-584
\endverbatim
The default model coefficients are given as:
\verbatim
@ -81,7 +85,7 @@ Note
k variants (nutk...) for this case will not behave correctly.
SeeAlso
Foam::kEpsilon
Foam::incompressible::RASModels::kEpsilon
Foam::kLowReWallFunctionFvPatchScalarField
Foam::epsilonLowReWallFunctionFvPatchScalarField
Foam::v2WallFunctionFvPatchScalarField
@ -95,7 +99,8 @@ SourceFiles
#ifndef v2f_H
#define v2f_H
#include "RASModel.H"
#include "turbulentTransportModel.H"
#include "eddyViscosity.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -112,7 +117,7 @@ namespace RASModels
class v2f
:
public RASModel
public eddyViscosity<incompressible::RASModel>
{
protected:
@ -146,9 +151,6 @@ protected:
//- Damping function
volScalarField f_;
//- Turbulence viscosity
volScalarField nut_;
// Bounding values
@ -158,14 +160,7 @@ protected:
// Protected Member Functions
//- Return boundary type names for the R field
wordList RBoundaryTypes() const;
//- Apply Davidson correction to nut
tmp<volScalarField> davidsonCorrectNut
(
const tmp<volScalarField>& value
) const;
virtual void correctNut();
//- Return time scale, Ts
tmp<volScalarField> Ts() const;
@ -184,11 +179,14 @@ public:
//- Construct from components
v2f
(
const geometricOneField& alpha,
const geometricOneField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName,
const word& modelName = typeName
const word& propertiesName = turbulenceModel::propertiesName,
const word& type = typeName
);
@ -199,11 +197,8 @@ public:
// Member Functions
//- Return the turbulence viscosity
virtual tmp<volScalarField> nut() const
{
return nut_;
}
//- Read RASProperties dictionary
virtual bool read();
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
@ -247,27 +242,8 @@ public:
return f_;
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff
(
const volScalarField& rho,
volVectorField& U
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();
//- Read RASProperties dictionary
virtual bool read();
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
@ -202,14 +202,22 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const label patchi = patch().index();
// Retrieve turbulence properties from model
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const turbulenceModel& turbulence = db().lookupObject<turbulenceModel>
(
IOobject::groupName
(
turbulenceModel::propertiesName,
dimensionedInternalField().group()
)
);
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const scalarField& y = turbulence.y()[patchi];
const tmp<volScalarField> tnu = turbulence.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const tmp<volScalarField> tk = turbulence.k();
const volScalarField& k = tk();
const IOdictionary& transportProperties =

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,27 +21,52 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::incompressible::turbulenceModel
Typedef
Foam::incompressible::RASModel
Typedef
Foam::incompressible::LESModel
Description
Typedefs for turbulence, RAS and LES models for incompressible flow
based on the standard laminar transport package.
SourceFiles
turbulentTransportModels.C
\*---------------------------------------------------------------------------*/
#ifndef porousBafflePressureFvPatchFieldsFwd_H
#define porousBafflePressureFvPatchFieldsFwd_H
#ifndef turbulentTransportModel_H
#define turbulentTransportModel_H
#include "fieldTypes.H"
#include "SpecificIncompressibleTurbulenceModel.H"
#include "RASModel.H"
#include "LESModel.H"
#include "incompressible/transportModel/transportModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
typedef IncompressibleTurbulenceModel<transportModel> turbulenceModel;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef SpecificIncompressibleTurbulenceModel
<
RASModel<turbulenceModel>
> RASModel;
template<class Type> class porousBafflePressureFvPatchField;
typedef SpecificIncompressibleTurbulenceModel
<
LESModel<turbulenceModel>
> LESModel;
}
}
makePatchTypeFieldTypedefs(porousBafflePressure);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "IncompressibleTurbulenceModel.H"
#include "transportModel.H"
#include "incompressible/transportModel/transportModel.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
@ -49,9 +49,15 @@ makeBaseTurbulenceModel
makeTemplatedTurbulenceModel \
(transportModelIncompressibleTurbulenceModel, LES, Type)
#include "SpalartAllmaras.H"
makeRASModel(SpalartAllmaras);
#include "kEpsilon.H"
makeRASModel(kEpsilon);
#include "LaunderSharmaKE.H"
makeRASModel(LaunderSharmaKE);
#include "kOmegaSST.H"
makeRASModel(kOmegaSST);
@ -61,5 +67,14 @@ makeLESModel(Smagorinsky);
#include "kEqn.H"
makeLESModel(kEqn);
#include "SpalartAllmarasDES.H"
makeLESModel(SpalartAllmarasDES);
#include "SpalartAllmarasDDES.H"
makeLESModel(SpalartAllmarasDDES);
#include "SpalartAllmarasIDDES.H"
makeLESModel(SpalartAllmarasIDDES);
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,7 @@ template<class TransportModel>
Foam::PhaseCompressibleTurbulenceModel<TransportModel>::
PhaseCompressibleTurbulenceModel
(
const word& type,
const volScalarField& alpha,
const volScalarField& rho,
const volVectorField& U,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,6 +72,7 @@ public:
//- Construct
PhaseCompressibleTurbulenceModel
(
const word& type,
const alphaField& alpha,
const volScalarField& rho,
const volVectorField& U,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,7 @@ template<class TransportModel>
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::
PhaseIncompressibleTurbulenceModel
(
const word& type,
const volScalarField& alpha,
const geometricOneField& rho,
const volVectorField& U,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,6 +72,7 @@ public:
//- Construct
PhaseIncompressibleTurbulenceModel
(
const word& type,
const alphaField& alpha,
const geometricOneField& rho,
const volVectorField& U,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,6 +54,7 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel
:
BasicTurbulenceModel
(
type,
alpha,
rho,
U,
@ -84,7 +85,7 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel
LESdelta::New
(
IOobject::groupName("delta", U.group()),
U.mesh(),
*this,
LESDict_
)
)

View File

@ -30,20 +30,24 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
defineTypeNameAndDebug(IDDESDelta, 0);
addToRunTimeSelectionTable(LESdelta, IDDESDelta, dictionary);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::IDDESDelta::calcDelta()
void Foam::LESModels::IDDESDelta::calcDelta()
{
const volScalarField& hmax = hmax_();
const volScalarField& hmax = hmax_;
const fvMesh& mesh = turbulenceModel_.mesh();
// Wall-reflection vectors
const volVectorField& n = wallDist::New(mesh()).n();
// Wall-normal vectors
const volVectorField& n = wallDist::New(mesh).n();
tmp<volScalarField> tfaceToFacenMax
(
@ -52,46 +56,50 @@ void Foam::IDDESDelta::calcDelta()
IOobject
(
"faceToFaceMax",
mesh().time().timeName(),
mesh(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("zrero", dimLength, 0.0)
mesh,
dimensionedScalar("zero", dimLength, 0.0)
)
);
scalarField& faceToFacenMax = tfaceToFacenMax().internalField();
const cellList& cells = mesh().cells();
const vectorField& faceCentres = mesh().faceCentres();
const cellList& cells = mesh.cells();
const vectorField& faceCentres = mesh.faceCentres();
forAll(cells, cellI)
forAll(cells, celli)
{
scalar deltaMaxTmp = 0.0;
const labelList& cFaces = cells[cellI];
const vector nCell = n[cellI];
forAll(cFaces, cFaceI)
scalar maxDelta = 0.0;
const labelList& cFaces = cells[celli];
const vector nci = n[celli];
forAll(cFaces, cFacei)
{
label faceI = cFaces[cFaceI];
const point& faceCentreI = faceCentres[faceI];
forAll(cFaces, cFaceJ)
label facei = cFaces[cFacei];
const point& fci = faceCentres[facei];
forAll(cFaces, cFacej)
{
label faceJ = cFaces[cFaceJ];
const point& faceCentreJ = faceCentres[faceJ];
scalar tmp = (faceCentreJ - faceCentreI) & nCell;
if (tmp > deltaMaxTmp)
label facej = cFaces[cFacej];
const point& fcj = faceCentres[facej];
scalar ndfc = nci & (fcj - fci);
if (ndfc > maxDelta)
{
deltaMaxTmp = tmp;
maxDelta = ndfc;
}
}
}
faceToFacenMax[cellI] = deltaMaxTmp;
faceToFacenMax[celli] = maxDelta;
}
label nD = mesh().nGeometricD();
label nD = mesh.nGeometricD();
if (nD == 2)
{
@ -106,15 +114,14 @@ void Foam::IDDESDelta::calcDelta()
}
delta_.internalField() =
deltaCoeff_
*min
min
(
max
(
max
(
cw_*wallDist::New(mesh()).y(),
cw_*hmax
Cw_*wallDist::New(mesh).y(),
Cw_*hmax
),
tfaceToFacenMax
),
@ -125,38 +132,47 @@ void Foam::IDDESDelta::calcDelta()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::IDDESDelta::IDDESDelta
Foam::LESModels::IDDESDelta::IDDESDelta
(
const word& name,
const fvMesh& mesh,
const dictionary& dd
const turbulenceModel& turbulence,
const dictionary& dict
)
:
LESdelta(name, mesh),
hmax_(LESdelta::New("hmax", mesh, dd.parent())),
deltaCoeff_(readScalar(dd.subDict(type()+"Coeffs").lookup("deltaCoeff"))),
cw_(0.15)
LESdelta(name, turbulence),
hmax_
(
IOobject::groupName("hmax", turbulence.U().group()),
turbulence,
dict
),
Cw_
(
dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cw", 0.15)
)
{
dd.subDict(type() + "Coeffs").readIfPresent("cw", cw_);
calcDelta();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::IDDESDelta::read(const dictionary& dd)
void Foam::LESModels::IDDESDelta::read(const dictionary& dict)
{
dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
const dictionary& coeffsDict(dict.subDict(type() + "Coeffs"));
coeffsDict.readIfPresent<scalar>("Cw", Cw_);
calcDelta();
}
void Foam::IDDESDelta::correct()
void Foam::LESModels::IDDESDelta::correct()
{
if (mesh_.changing())
if (turbulenceModel_.mesh().changing())
{
hmax_.correct();
calcDelta();
hmax_().correct();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,12 +37,14 @@ SourceFiles
#ifndef IDDESDeltaDelta_H
#define IDDESDeltaDelta_H
#include "incompressibleLESdelta.H"
#include "maxDeltaxyz.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class IDDESDelta Declaration
@ -54,9 +56,9 @@ class IDDESDelta
{
// Private data
autoPtr<Foam::LESdelta> hmax_;
scalar deltaCoeff_;
scalar cw_;
maxDeltaxyz hmax_;
scalar Cw_;
// Private Member Functions
@ -81,7 +83,7 @@ public:
IDDESDelta
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary&
);
@ -97,6 +99,12 @@ public:
//- Read the LESdelta dictionary
void read(const dictionary&);
//- Return the hmax delta field
const volScalarField& hmax() const
{
return hmax_;
}
// Correct values
void correct();
};
@ -104,6 +112,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,20 +36,24 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::LESdelta::LESdelta(const word& name, const fvMesh& mesh)
Foam::LESdelta::LESdelta
(
const word& name,
const turbulenceModel& turbulence
)
:
mesh_(mesh),
turbulenceModel_(turbulence),
delta_
(
IOobject
(
name,
mesh.time().timeName(),
mesh,
turbulence.mesh().time().timeName(),
turbulence.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
turbulence.mesh(),
dimensionedScalar(name, dimLength, SMALL),
calculatedFvPatchScalarField::typeName
)
@ -61,7 +65,7 @@ Foam::LESdelta::LESdelta(const word& name, const fvMesh& mesh)
Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary& dict
)
{
@ -76,7 +80,7 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
{
FatalErrorIn
(
"LESdelta::New(const fvMesh&, const dictionary&)"
"LESdelta::New(const word& name, const turbulenceModel& turbulence)"
) << "Unknown LESdelta type "
<< deltaType << nl << nl
<< "Valid LESdelta types are :" << endl
@ -84,14 +88,14 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
<< exit(FatalError);
}
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
return autoPtr<LESdelta>(cstrIter()(name, turbulence, dict));
}
Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary& dict,
const dictionaryConstructorTable& additionalConstructors
)
@ -106,7 +110,7 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
if (cstrIter != additionalConstructors.end())
{
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
return autoPtr<LESdelta>(cstrIter()(name, turbulence, dict));
}
else
{
@ -117,7 +121,9 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
{
FatalErrorIn
(
"LESdelta::New(const fvMesh&, const dictionary&)"
"LESdelta::New(const word& name, "
"const turbulenceModel& turbulence, "
"const dictionaryConstructorTable&)"
) << "Unknown LESdelta type "
<< deltaType << nl << nl
<< "Valid LESdelta types are :" << endl
@ -129,7 +135,7 @@ Foam::autoPtr<Foam::LESdelta> Foam::LESdelta::New
}
else
{
return autoPtr<LESdelta>(cstrIter()(name, mesh, dict));
return autoPtr<LESdelta>(cstrIter()(name, turbulence, dict));
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,9 +35,8 @@ SourceFiles
#ifndef LESdelta_H
#define LESdelta_H
#include "turbulenceModel.H"
#include "volFields.H"
#include "typeInfo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,8 +44,6 @@ SourceFiles
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class LESdelta Declaration
\*---------------------------------------------------------------------------*/
@ -58,7 +55,7 @@ protected:
// Protected data
const fvMesh& mesh_;
const turbulenceModel& turbulenceModel_;
volScalarField delta_;
@ -87,17 +84,21 @@ public:
dictionary,
(
const word& name,
const fvMesh& mesh,
const dictionary& LESdeltaDict
const turbulenceModel& turbulence,
const dictionary& dict
),
(name, mesh, LESdeltaDict)
(name, turbulence, dict)
);
// Constructors
//- Construct from name and mesh
LESdelta(const word& name, const fvMesh&);
//- Construct from name, turbulenceModel and dictionary
LESdelta
(
const word& name,
const turbulenceModel& turbulence
);
// Selectors
@ -106,16 +107,16 @@ public:
static autoPtr<LESdelta> New
(
const word& name,
const fvMesh&,
const dictionary&
const turbulenceModel& turbulence,
const dictionary& dict
);
//- Return a reference to the selected LES delta
static autoPtr<LESdelta> New
(
const word& name,
const fvMesh&,
const dictionary&,
const turbulenceModel& turbulence,
const dictionary& dict,
const dictionaryConstructorTable&
);
@ -127,10 +128,10 @@ public:
// Member Functions
//- Return mesh reference
const fvMesh& mesh() const
//- Return turbulenceModel reference
const turbulenceModel& turbulence() const
{
return mesh_;
return turbulenceModel_;
}
//- Read the LESdelta dictionary

View File

@ -30,35 +30,46 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
defineTypeNameAndDebug(PrandtlDelta, 0);
addToRunTimeSelectionTable(LESdelta, PrandtlDelta, dictionary);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::PrandtlDelta::calcDelta()
void Foam::LESModels::PrandtlDelta::calcDelta()
{
delta_ = min
(
static_cast<const volScalarField&>(geometricDelta_()),
(kappa_/Cdelta_)*wallDist::New(mesh_).y()
(kappa_/Cdelta_)*wallDist::New(turbulenceModel_.mesh()).y()
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::PrandtlDelta::PrandtlDelta
Foam::LESModels::PrandtlDelta::PrandtlDelta
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary& dict
)
:
LESdelta(name, mesh),
geometricDelta_(LESdelta::New(name, mesh, dict.subDict(type() + "Coeffs"))),
LESdelta(name, turbulence),
geometricDelta_
(
LESdelta::New
(
name,
turbulence,
dict.subDict(type() + "Coeffs")
)
),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Cdelta_
(
@ -71,7 +82,7 @@ Foam::PrandtlDelta::PrandtlDelta
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::PrandtlDelta::read(const dictionary& dict)
void Foam::LESModels::PrandtlDelta::read(const dictionary& dict)
{
const dictionary& coeffDict(dict.subDict(type() + "Coeffs"));
@ -82,11 +93,11 @@ void Foam::PrandtlDelta::read(const dictionary& dict)
}
void Foam::PrandtlDelta::correct()
void Foam::LESModels::PrandtlDelta::correct()
{
geometricDelta_().correct();
if (mesh_.changing())
if (turbulenceModel_.mesh().changing())
{
calcDelta();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,8 @@ SourceFiles
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class PrandtlDelta Declaration
@ -75,11 +77,11 @@ public:
// Constructors
//- Construct from name, mesh and IOdictionary
//- Construct from name, turbulenceModel and dictionary
PrandtlDelta
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary&
);
@ -101,6 +103,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,21 +29,26 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
defineTypeNameAndDebug(cubeRootVolDelta, 0);
addToRunTimeSelectionTable(LESdelta, cubeRootVolDelta, dictionary);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::cubeRootVolDelta::calcDelta()
void Foam::LESModels::cubeRootVolDelta::calcDelta()
{
label nD = mesh().nGeometricD();
const fvMesh& mesh = turbulenceModel_.mesh();
label nD = mesh.nGeometricD();
if (nD == 3)
{
delta_.internalField() = deltaCoeff_*pow(mesh().V(), 1.0/3.0);
delta_.internalField() = deltaCoeff_*pow(mesh.V(), 1.0/3.0);
}
else if (nD == 2)
{
@ -51,19 +56,19 @@ void Foam::cubeRootVolDelta::calcDelta()
<< "Case is 2D, LES is not strictly applicable\n"
<< endl;
const Vector<label>& directions = mesh().geometricD();
const Vector<label>& directions = mesh.geometricD();
scalar thickness = 0.0;
for (direction dir=0; dir<directions.nComponents; dir++)
{
if (directions[dir] == -1)
{
thickness = mesh().bounds().span()[dir];
thickness = mesh.bounds().span()[dir];
break;
}
}
delta_.internalField() = deltaCoeff_*sqrt(mesh().V()/thickness);
delta_.internalField() = deltaCoeff_*sqrt(mesh.V()/thickness);
}
else
{
@ -76,14 +81,14 @@ void Foam::cubeRootVolDelta::calcDelta()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cubeRootVolDelta::cubeRootVolDelta
Foam::LESModels::cubeRootVolDelta::cubeRootVolDelta
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary& dict
)
:
LESdelta(name, mesh),
LESdelta(name, turbulence),
deltaCoeff_
(
dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("deltaCoeff", 1)
@ -95,7 +100,7 @@ Foam::cubeRootVolDelta::cubeRootVolDelta
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cubeRootVolDelta::read(const dictionary& dict)
void Foam::LESModels::cubeRootVolDelta::read(const dictionary& dict)
{
dict.subDict(type() + "Coeffs").readIfPresent<scalar>
(
@ -107,9 +112,9 @@ void Foam::cubeRootVolDelta::read(const dictionary& dict)
}
void Foam::cubeRootVolDelta::correct()
void Foam::LESModels::cubeRootVolDelta::correct()
{
if (mesh_.changing())
if (turbulenceModel_.mesh().changing())
{
calcDelta();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,6 +41,8 @@ SourceFiles
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class cubeRootVolDelta Declaration
@ -73,11 +75,11 @@ public:
// Constructors
//- Construct from name, mesh and IOdictionary
//- Construct from name, turbulenceModel and dictionary
cubeRootVolDelta
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary&
);
@ -99,6 +101,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,17 +29,22 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
defineTypeNameAndDebug(maxDeltaxyz, 0);
addToRunTimeSelectionTable(LESdelta, maxDeltaxyz, dictionary);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::maxDeltaxyz::calcDelta()
void Foam::LESModels::maxDeltaxyz::calcDelta()
{
label nD = mesh().nGeometricD();
const fvMesh& mesh = turbulenceModel_.mesh();
label nD = mesh.nGeometricD();
tmp<volScalarField> hmax
(
@ -48,28 +53,28 @@ void Foam::maxDeltaxyz::calcDelta()
IOobject
(
"hmax",
mesh().time().timeName(),
mesh(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh(),
mesh,
dimensionedScalar("zrero", dimLength, 0.0)
)
);
const cellList& cells = mesh().cells();
const cellList& cells = mesh.cells();
forAll(cells,cellI)
{
scalar deltaMaxTmp = 0.0;
const labelList& cFaces = mesh().cells()[cellI];
const point& centrevector = mesh().cellCentres()[cellI];
const labelList& cFaces = mesh.cells()[cellI];
const point& centrevector = mesh.cellCentres()[cellI];
forAll(cFaces, cFaceI)
{
label faceI = cFaces[cFaceI];
const point& facevector = mesh().faceCentres()[faceI];
const point& facevector = mesh.faceCentres()[faceI];
scalar tmp = mag(facevector - centrevector);
if (tmp > deltaMaxTmp)
{
@ -102,14 +107,14 @@ void Foam::maxDeltaxyz::calcDelta()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::maxDeltaxyz::maxDeltaxyz
Foam::LESModels::maxDeltaxyz::maxDeltaxyz
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary& dict
)
:
LESdelta(name, mesh),
LESdelta(name, turbulence),
deltaCoeff_
(
dict.subDict(type() + "Coeffs").lookupOrDefault<scalar>("deltaCoeff", 1)
@ -121,21 +126,19 @@ Foam::maxDeltaxyz::maxDeltaxyz
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::maxDeltaxyz::read(const dictionary& dict)
void Foam::LESModels::maxDeltaxyz::read(const dictionary& dict)
{
dict.subDict(type() + "Coeffs").readIfPresent<scalar>
(
"deltaCoeff",
deltaCoeff_
);
const dictionary& coeffsDict(dict.subDict(type() + "Coeffs"));
coeffsDict.readIfPresent<scalar>("deltaCoeff", deltaCoeff_);
calcDelta();
}
void Foam::maxDeltaxyz::correct()
void Foam::LESModels::maxDeltaxyz::correct()
{
if (mesh_.changing())
if (turbulenceModel_.mesh().changing())
{
calcDelta();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -44,6 +44,8 @@ SourceFiles
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class maxDeltaxyz Declaration
@ -77,11 +79,11 @@ public:
// Constructors
//- Construct from name, mesh and IOdictionary
//- Construct from name, turbulenceModel and dictionary
maxDeltaxyz
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary&
);
@ -103,6 +105,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,26 +30,18 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
defineTypeNameAndDebug(smoothDelta, 0);
addToRunTimeSelectionTable(LESdelta, smoothDelta, dictionary);
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Fill changedFaces (with face labels) and changedFacesInfo (with delta)
// This is the initial set of faces from which to start the waves.
// Since there might be lots of places with delta jumps we can follow various
// strategies for this initial 'seed'.
// - start from single cell/face and let FaceCellWave pick up all others
// from there. might be quite a few waves before everything settles.
// - start from all faces. Lots of initial transfers.
// We do something inbetween:
// - start from all faces where there is a jump. Since we cannot easily
// determine this across coupled patches (cyclic, processor) introduce
// all faces of these and let FaceCellWave sort it out.
void Foam::smoothDelta::setChangedFaces
void Foam::LESModels::smoothDelta::setChangedFaces
(
const polyMesh& mesh,
const volScalarField& delta,
@ -102,18 +94,20 @@ void Foam::smoothDelta::setChangedFaces
}
void Foam::smoothDelta::calcDelta()
void Foam::LESModels::smoothDelta::calcDelta()
{
const fvMesh& mesh = turbulenceModel_.mesh();
const volScalarField& geometricDelta = geometricDelta_();
// Fill changed faces with info
DynamicList<label> changedFaces(mesh_.nFaces()/100 + 100);
DynamicList<label> changedFaces(mesh.nFaces()/100 + 100);
DynamicList<deltaData> changedFacesInfo(changedFaces.size());
setChangedFaces(mesh_, geometricDelta, changedFaces, changedFacesInfo);
setChangedFaces(mesh, geometricDelta, changedFaces, changedFacesInfo);
// Set initial field on cells.
List<deltaData> cellDeltaData(mesh_.nCells());
List<deltaData> cellDeltaData(mesh.nCells());
forAll(geometricDelta, cellI)
{
@ -121,18 +115,18 @@ void Foam::smoothDelta::calcDelta()
}
// Set initial field on faces.
List<deltaData> faceDeltaData(mesh_.nFaces());
List<deltaData> faceDeltaData(mesh.nFaces());
// Propagate information over whole domain.
FaceCellWave<deltaData, scalar> deltaCalc
(
mesh_,
mesh,
changedFaces,
changedFacesInfo,
faceDeltaData,
cellDeltaData,
mesh_.globalData().nTotalCells()+1, // max iterations
mesh.globalData().nTotalCells()+1, // max iterations
maxDeltaRatio_
);
@ -145,17 +139,22 @@ void Foam::smoothDelta::calcDelta()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::smoothDelta::smoothDelta
Foam::LESModels::smoothDelta::smoothDelta
(
const word& name,
const fvMesh& mesh,
const turbulenceModel& turbulence,
const dictionary& dict
)
:
LESdelta(name, mesh),
LESdelta(name, turbulence),
geometricDelta_
(
LESdelta::New("geometricDelta", mesh, dict.subDict(type() + "Coeffs"))
LESdelta::New
(
"geometricDelta",
turbulence,
dict.subDict(type() + "Coeffs")
)
),
maxDeltaRatio_
(
@ -168,7 +167,7 @@ Foam::smoothDelta::smoothDelta
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::smoothDelta::read(const dictionary& dict)
void Foam::LESModels::smoothDelta::read(const dictionary& dict)
{
const dictionary& coeffsDict(dict.subDict(type() + "Coeffs"));
@ -178,11 +177,11 @@ void Foam::smoothDelta::read(const dictionary& dict)
}
void Foam::smoothDelta::correct()
void Foam::LESModels::smoothDelta::correct()
{
geometricDelta_().correct();
if (mesh_.changing())
if (turbulenceModel_.mesh().changing())
{
calcDelta();
}

Some files were not shown because too many files have changed in this diff Show More