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,
50 const transportModel& transport,
51 const word& propertiesName
52)
53:
54 BasicTurbulenceModel
55 (
56 rho,
57 U,
58 alphaRhoPhi,
59 phi,
60 propertiesName
61 ),
62 alpha_(alpha),
63 transport_(transport)
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,
87 const transportModel& transport,
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(),
100 false // Do not register
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 {
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// ************************************************************************* //
surfaceScalarField & phi
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:282
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:180
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Templated abstract base class for turbulence models.
TransportModel transportModel
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
IOerror FatalIOError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
volScalarField & alpha
dictionary dict
Foam::surfaceFields.