MomentumTransportModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "MomentumTransportModel.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template
33 <
34  class Alpha,
35  class Rho,
36  class BasicMomentumTransportModel,
37  class TransportModel
38 >
40 <
41  Alpha,
42  Rho,
43  BasicMomentumTransportModel,
44  TransportModel
45 >::MomentumTransportModel
46 (
47  const alphaField& alpha,
48  const rhoField& rho,
49  const volVectorField& U,
50  const surfaceScalarField& alphaRhoPhi,
51  const surfaceScalarField& phi,
52  const transportModel& transport
53 )
54 :
55  BasicMomentumTransportModel
56  (
57  rho,
58  U,
59  alphaRhoPhi,
60  phi
61  ),
62  alpha_(alpha),
63  transport_(transport)
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
68 
69 template
70 <
71  class Alpha,
72  class Rho,
73  class BasicMomentumTransportModel,
74  class TransportModel
75 >
77 <
79  <
80  Alpha,
81  Rho,
82  BasicMomentumTransportModel,
83  TransportModel
84  >
85 >
87 <
88  Alpha,
89  Rho,
90  BasicMomentumTransportModel,
91  TransportModel
92 >::New
93 (
94  const alphaField& alpha,
95  const rhoField& rho,
96  const volVectorField& U,
97  const surfaceScalarField& alphaRhoPhi,
98  const surfaceScalarField& phi,
99  const transportModel& transport
100 )
101 {
102  const word modelType
103  (
104  momentumTransportModel::readModelDict
105  (
106  U.db(),
107  alphaRhoPhi.group()
108  ).lookup("simulationType")
109  );
110 
111  Info<< "Selecting turbulence model type " << modelType << endl;
112 
113  typename dictionaryConstructorTable::iterator cstrIter =
114  dictionaryConstructorTablePtr_->find(modelType);
115 
116  if (cstrIter == dictionaryConstructorTablePtr_->end())
117  {
119  << "Unknown MomentumTransportModel type "
120  << modelType << nl << nl
121  << "Valid MomentumTransportModel types:" << endl
122  << dictionaryConstructorTablePtr_->sortedToc()
123  << exit(FatalError);
124  }
125 
127  (
128  cstrIter()(alpha, rho, U, alphaRhoPhi, phi, transport)
129  );
130 }
131 
132 
133 // ************************************************************************* //
Foam::surfaceFields.
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:144
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
phi
Definition: pEqn.H:104
stressControl lookup("compactNormalStress") >> compactNormalStress
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
A class for handling words, derived from string.
Definition: word.H:59
static const char nl
Definition: Ostream.H:260
U
Definition: pEqn.H:72
messageStream Info
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:322
Templated abstract base class for turbulence models.