Commit 7d771c95 authored by Henry's avatar Henry
Browse files

TurbulenceModels: Preliminary version of the templated turbulence models library

parent 52a8bde2
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
set -x
wmake libso turbulenceModel
wmake libso incompressible
wmake libso compressible
wmakeLnInclude phaseIncompressible
wmakeLnInclude phaseCompressible
# ----------------------------------------------------------------- end-of-file
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class TransportModel>
Foam::CompressibleTurbulenceModel<TransportModel>::
CompressibleTurbulenceModel
(
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
TurbulenceModel
<
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
transportModel
>
(
alpha,
rho,
U,
alphaPhi,
phi,
transport,
propertiesName
)
{}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
template<class TransportModel>
Foam::autoPtr<Foam::CompressibleTurbulenceModel<TransportModel> >
Foam::CompressibleTurbulenceModel<TransportModel>::New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
{
return autoPtr<CompressibleTurbulenceModel>
(
static_cast<CompressibleTurbulenceModel*>(
TurbulenceModel
<
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
transportModel
>::New
(
geometricOneField(),
rho,
U,
phi,
phi,
transport,
propertiesName
).ptr())
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CompressibleTurbulenceModel
Description
Templated abstract base class for single-phase compressible
turbulence models.
SourceFiles
CompressibleTurbulenceModel.C
\*---------------------------------------------------------------------------*/
#ifndef CompressibleTurbulenceModel_H
#define CompressibleTurbulenceModel_H
#include "TurbulenceModel.H"
#include "compressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CompressibleTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
template<class TransportModel>
class CompressibleTurbulenceModel
:
public TurbulenceModel
<
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
TransportModel
>
{
public:
typedef geometricOneField alphaField;
typedef volScalarField rhoField;
typedef TransportModel transportModel;
// Constructors
//- Construct
CompressibleTurbulenceModel
(
const geometricOneField& alpha,
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const transportModel& trasport,
const word& propertiesName
);
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<CompressibleTurbulenceModel> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& trasportModel,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~CompressibleTurbulenceModel()
{}
// Member Functions
//- Return the laminar dynamic viscosity
virtual tmp<volScalarField> mu() const
{
return this->transport_.mu();
}
//- Return the laminar dynamic viscosity on patch
virtual tmp<scalarField> mu(const label patchi) const
{
return this->transport_.mu(patchi);
}
//- Return the turbulence dynamic viscosity
virtual tmp<volScalarField> mut() const
{
return this->rho_*this->nut();
}
//- Return the turbulence dynamic viscosity on patch
virtual tmp<scalarField> mut(const label patchi) const
{
return this->rho_.boundaryField()[patchi]*this->nut(patchi);
}
//- Return the effective dynamic viscosity
virtual tmp<volScalarField> muEff() const
{
return mut() + mu();
}
//- Return the effective dynamic viscosity on patch
virtual tmp<scalarField> muEff(const label patchi) const
{
return mut(patchi) + mu(patchi);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CompressibleTurbulenceModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
compressibleTurbulenceModel.C
compressibleTurbulenceModels.C
LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModels
EXE_INC = \
-I../turbulenceModel/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lfluidThermophysicalModels \
-lspecie
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "compressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(compressibleTurbulenceModel, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressibleTurbulenceModel::compressibleTurbulenceModel
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const word& propertiesName
)
:
turbulenceModel
(
U,
alphaPhi,
phi,
propertiesName
),
rho_(rho)
{}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressibleTurbulenceModel
Description
Abstract base class for turbulence models (RAS, LES and laminar).
SourceFiles
compressibleTurbulenceModel.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleTurbulenceModel_H
#define compressibleTurbulenceModel_H
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
class fvMesh;
/*---------------------------------------------------------------------------*\
Class compressibleTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
class compressibleTurbulenceModel
:
public turbulenceModel
{
protected:
// Protected data
const volScalarField& rho_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
compressibleTurbulenceModel(const compressibleTurbulenceModel&);
//- Disallow default bitwise assignment
void operator=(const compressibleTurbulenceModel&);
public:
//- Runtime type information
TypeName("compressibleTurbulenceModel");
// Constructors
//- Construct from components
compressibleTurbulenceModel
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const word& propertiesName
);
//- Destructor
virtual ~compressibleTurbulenceModel()
{}
// Member Functions
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoReff() const = 0;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "CompressibleTurbulenceModel.H"
#include "laminar.H"
#include "RASModel.H"
#include "kEpsilon.H"
#include "fluidThermo.H"
#include "addToRunTimeSelectionTable.H"
namespace Foam
{
typedef TurbulenceModel
<
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
fluidThermo
> baseCompressibleFluidThermoTurbulenceModel;
defineTemplateRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
dictionary
);
typedef CompressibleTurbulenceModel<fluidThermo>
compressibleFluidThermoTurbulenceModel;
typedef laminar<compressibleFluidThermoTurbulenceModel> compressibleLaminar;
defineNamedTemplateTypeNameAndDebug(compressibleLaminar, 0);
addToRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
compressibleLaminar,
dictionary
);
typedef RASModel<compressibleFluidThermoTurbulenceModel>
compressibleRASModel;
defineNamedTemplateTypeNameAndDebug(compressibleRASModel, 0);
defineTemplateRunTimeSelectionTable(compressibleRASModel, dictionary);
addToRunTimeSelectionTable
(
baseCompressibleFluidThermoTurbulenceModel,
compressibleRASModel,
dictionary
);
namespace RASModels
{
typedef kEpsilon<compressibleFluidThermoTurbulenceModel>
compressibleKEpsilon;
defineNamedTemplateTypeNameAndDebug(compressibleKEpsilon, 0);
addToRunTimeSelectionTable
(
compressibleRASModel,
compressibleKEpsilon,
dictionary
);
}
}
// ************************************************************************* //