Loading...
Searching...
No Matches
TurbulenceModel.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "TurbulenceModel.H"
30#include "volFields.H"
31#include "surfaceFields.H"
32
33// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34
35template
36<
37 class Alpha,
38 class Rho,
39 class BasicTurbulenceModel,
40 class TransportModel
41>
44(
45 const alphaField& alpha,
46 const rhoField& rho,
47 const volVectorField& U,
48 const surfaceScalarField& alphaRhoPhi,
51 const word& propertiesName
52)
53:
54 BasicTurbulenceModel
55 (
56 rho,
57 U,
58 alphaRhoPhi,
59 phi,
60 propertiesName
61 ),
64{}
65
66
67// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
68
69template
70<
71 class Alpha,
72 class Rho,
73 class BasicTurbulenceModel,
74 class TransportModel
75>
77<
79>
81(
82 const alphaField& alpha,
83 const rhoField& rho,
84 const volVectorField& U,
85 const surfaceScalarField& alphaRhoPhi,
88 const word& propertiesName
89)
90{
91 const IOdictionary dict
92 (
94 (
95 IOobject::groupName(propertiesName, alphaRhoPhi.group()),
96 U.time().constant(),
97 U.db(),
101 )
102 );
103
104 const word modelType(dict.get<word>("simulationType"));
105
106 Info<< "Selecting turbulence model type " << modelType << endl;
107
108 auto* ctorPtr = dictionaryConstructorTable(modelType);
109
110 if (!ctorPtr)
111 {
113 (
114 dict,
115 "simulationType",
116 modelType,
117 *dictionaryConstructorTablePtr_
118 ) << exit(FatalIOError);
119 }
120
122 (
123 ctorPtr(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
124 );
125}
126
127
128// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
static word group(const word &name)
Return group (extension part of name).
Definition IOobject.C:300
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Templated abstract base class for turbulence models.
TransportModel transportModel
const alphaField & alpha_
const alphaField & alpha() const
Access function to phase fraction.
TurbulenceModel(const TurbulenceModel &)=delete
No copy construct.
const transportModel & transport_
static autoPtr< TurbulenceModel > New(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName=turbulenceModel::propertiesName)
Return a reference to the selected turbulence model.
const transportModel & transport() const
Access function to incompressible transport model.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A class for handling words, derived from Foam::string.
Definition word.H:66
U
Definition pEqn.H:72
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
GeometricField< vector, fvPatchField, volMesh > volVectorField
messageStream Info
Information stream (stdout output on master, null elsewhere).
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
dictionary dict
Foam::surfaceFields.