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 -------------------------------------------------------------------------------
11 License
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 
35 template
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,
49  const surfaceScalarField& phi,
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 
69 template
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,
86  const surfaceScalarField& phi,
87  const transportModel& transport,
88  const word& propertiesName
89 )
90 {
91  const IOdictionary dict
92  (
93  IOobject
94  (
95  IOobject::groupName(propertiesName, alphaRhoPhi.group()),
96  U.time().constant(),
97  U.db(),
98  IOobject::MUST_READ_IF_MODIFIED,
99  IOobject::NO_WRITE,
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  {
113  (
114  dict,
115  "simulationType",
116  modelType,
117  *dictionaryConstructorTablePtr_
118  ) << exit(FatalIOError);
119  }
120 
121  return autoPtr<TurbulenceModel>
122  (
123  ctorPtr(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
124  );
125 }
126 
127 
128 // ************************************************************************* //
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::geometricOneField
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
Definition: geometricOneField.H:55
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
surfaceFields.H
Foam::surfaceFields.
rho
rho
Definition: readInitialConditions.H:88
Foam::TurbulenceModel::New
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.
Foam::TurbulenceModel
Templated abstract base class for turbulence models.
Definition: TurbulenceModel.H:59
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::TurbulenceModel< volScalarField, geometricOneField, incompressibleTurbulenceModel, TransportModel >::transportModel
TransportModel transportModel
Definition: TurbulenceModel.H:68
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::transportModel
Base-class for all transport models used by the incompressible turbulence models.
Definition: transportModel.H:53
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
TurbulenceModel.H
Foam::TurbulenceModel::TurbulenceModel
TurbulenceModel(const TurbulenceModel &)=delete
No copy construct.
Foam::GeometricField< scalar, fvPatchField, volMesh >