ThermophysicalTransportModel.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) 2020-2026 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 
27 #include "volFields.H"
28 #include "surfaceFields.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class MomentumTransportModel, class ThermoModel>
35 (
36  const momentumTransportModel& momentumTransport,
37  const thermoModel& thermo
38 )
39 :
40  fluidThermophysicalTransportModel(momentumTransport, thermo.phaseName()),
41  momentumTransport_(momentumTransport),
42  thermo_(thermo)
43 {}
44 
45 
46 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
47 
48 template<class MomentumTransportModel, class ThermoModel>
50 <
52 >
54 (
55  const momentumTransportModel& momentumTransport,
56  const thermoModel& thermo
57 )
58 {
59  const word modelType
60  (
61  momentumTransport.lookup("simulationType")
62  );
63 
65  << "Selecting thermophysical transport type " << modelType << endl;
66 
67  typename dictionaryConstructorTable::iterator cstrIter =
68  dictionaryConstructorTablePtr_->find(modelType);
69 
70  if (cstrIter == dictionaryConstructorTablePtr_->end())
71  {
73  << "Unknown thermophysical transport type "
74  << modelType << nl << nl
75  << "Available types:" << endl
76  << dictionaryConstructorTablePtr_->sortedToc()
77  << exit(FatalError);
78  }
79 
80  printDictionary print(momentumTransport.path(true)/typeName);
81 
82  return cstrIter()(momentumTransport, thermo);
83 }
84 
85 
86 // ************************************************************************* //
Templated abstract base class for thermophysical transport models.
static autoPtr< ThermophysicalTransportModel > New(const momentumTransportModel &transport, const thermoModel &thermo)
Return a reference to the selected thermophysical transport model.
ThermophysicalTransportModel(const momentumTransportModel &momentumTransport, const thermoModel &thermo)
Construct.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
Abstract base class for fluid thermophysical transport models RAS, LES and laminar.
Abstract base class for momentum transport models (RAS, LES and laminar).
fileName path() const
Return complete path.
Definition: regIOobject.C:175
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
error FatalError
static const char nl
Definition: Ostream.H:297
fluidMulticomponentThermo & thermo
Definition: createFields.H:15
Foam::surfaceFields.