Commit d968ee30 authored by Henry Weller's avatar Henry Weller
Browse files

TurbulenceModels: Improved instantiation of single-phase models in solvers

Simplifies lookup of RAS or LES models
parent 3050ff92
......@@ -49,7 +49,7 @@ mesh.setFluxRequired(p.name());
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
compressible::New<compressible::RASModel>
(
rho,
U,
......
......@@ -71,7 +71,7 @@ dimensionedScalar rhoMin
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
compressible::New<compressible::RASModel>
(
rho,
U,
......
......@@ -70,7 +70,7 @@ dimensionedScalar rhoMin
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
compressible::New<compressible::RASModel>
(
rho,
U,
......
......@@ -49,7 +49,7 @@ volVectorField U
Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
// Kinematic density for buoyancy force
......
......@@ -49,7 +49,7 @@ volVectorField U
Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
// Kinematic density for buoyancy force
......
......@@ -39,7 +39,7 @@ volVectorField U
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
compressible::New<compressible::RASModel>
(
rho,
U,
......
......@@ -44,7 +44,7 @@
{
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
compressible::New<compressible::RASModel>
(
rho,
U,
......@@ -59,7 +59,7 @@
{
autoPtr<compressible::LESModel> turbulence
(
compressible::LESModel::New
compressible::New<compressible::LESModel>
(
rho,
U,
......
......@@ -82,7 +82,7 @@ singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
......
......@@ -33,7 +33,7 @@ singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
dimensionedVector Ubar("Ubar", dimVelocity, laminarTransport);
......
......@@ -66,5 +66,5 @@ singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
......@@ -18,5 +18,5 @@
autoPtr<incompressible::RASModel> RASModel
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
......@@ -55,7 +55,7 @@ void calcIncompressible
autoPtr<incompressible::RASModel> model
(
incompressible::RASModel::New(U, phi, laminarTransport)
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
);
const volSymmTensorField Reff(model->devReff());
......@@ -104,7 +104,7 @@ void calcCompressible
autoPtr<compressible::RASModel> model
(
compressible::RASModel::New
compressible::New<compressible::RASModel>
(
rho,
U,
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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())
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::SpecificCompressibleTurbulenceModel
Description
Templated abstract base class for specific (RAS/LES) compressible
turbulence models
SourceFiles
SpecificCompressibleTurbulenceModel.C
\*---------------------------------------------------------------------------*/
#ifndef SpecificCompressibleTurbulenceModel_H
#define SpecificCompressibleTurbulenceModel_H
#include "CompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SpecificCompressibleTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasicCompressibleTurbulenceModel>
class SpecificCompressibleTurbulenceModel
:
public BasicCompressibleTurbulenceModel
{
public:
typedef typename BasicCompressibleTurbulenceModel::transportModel
transportModel;
// Constructors
//- Construct from components
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
);
//- Destructor
virtual ~SpecificCompressibleTurbulenceModel()
{}
// Selectors
//- Return a reference to the selected turbulence model
static autoPtr<SpecificCompressibleTurbulenceModel> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SpecificCompressibleTurbulenceModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -42,7 +42,7 @@ SourceFiles
#ifndef turbulentFluidThermoModel_H
#define turbulentFluidThermoModel_H
#include "SpecificCompressibleTurbulenceModel.H"
#include "CompressibleTurbulenceModel.H"
#include "ThermalDiffusivity.H"
#include "EddyDiffusivity.H"
#include "RASModel.H"
......@@ -58,15 +58,31 @@ namespace Foam
typedef ThermalDiffusivity<CompressibleTurbulenceModel<fluidThermo> >
turbulenceModel;
typedef SpecificCompressibleTurbulenceModel
<
RASModel<EddyDiffusivity<turbulenceModel> >
> RASModel;
typedef SpecificCompressibleTurbulenceModel
<
LESModel<EddyDiffusivity<turbulenceModel> >
> LESModel;
typedef RASModel<EddyDiffusivity<turbulenceModel> > RASModel;
typedef LESModel<EddyDiffusivity<turbulenceModel> > LESModel;
template<class BasicCompressibleTurbulenceModel>
autoPtr<BasicCompressibleTurbulenceModel> New
(
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const typename BasicCompressibleTurbulenceModel::transportModel&
transport,
const word& propertiesName = turbulenceModel::propertiesName
)
{
return BasicCompressibleTurbulenceModel::New
(
geometricOneField(),
rho,
U,
phi,
phi,
transport,
propertiesName
);
}
}
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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())
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::SpecificIncompressibleTurbulenceModel
Description
Templated abstract base class for specific (RAS/LES) incompressible
turbulence models
SourceFiles
SpecificIncompressibleTurbulenceModel.C
\*---------------------------------------------------------------------------*/
#ifndef SpecificIncompressibleTurbulenceModel_H
#define SpecificIncompressibleTurbulenceModel_H
#include "IncompressibleTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SpecificIncompressibleTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasicIncompressibleTurbulenceModel>
class SpecificIncompressibleTurbulenceModel
:
public BasicIncompressibleTurbulenceModel
{
public:
typedef typename BasicIncompressibleTurbulenceModel::transportModel
transportModel;
// Constructors
//- Construct from components
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
);
//- Destructor
virtual ~SpecificIncompressibleTurbulenceModel()
{}