LESdelta.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) 2011-2015 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 "LESdelta.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
38}
39
40// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41
43(
44 const word& name,
46)
47:
48 turbulenceModel_(turbulence),
49 delta_
50 (
52 (
53 name,
54 turbulence.mesh().time().timeName(),
56 IOobject::NO_READ,
57 IOobject::NO_WRITE
58 ),
61 calculatedFvPatchScalarField::typeName
62 )
63{}
64
65
66// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
67
69(
70 const word& name,
71 const turbulenceModel& turbulence,
72 const dictionary& dict,
73 const word& lookupName
74)
75{
76 const word deltaType(dict.get<word>(lookupName));
77
78 Info<< "Selecting LES " << lookupName << " type " << deltaType << endl;
79
80 auto* ctorPtr = dictionaryConstructorTable(deltaType);
81
82 if (!ctorPtr)
83 {
85 (
86 dict,
87 "LESdelta",
88 deltaType,
89 *dictionaryConstructorTablePtr_
90 ) << exit(FatalIOError);
91 }
92
93 return autoPtr<LESdelta>(ctorPtr(name, turbulence, dict));
94}
95
96
98(
99 const word& name,
100 const turbulenceModel& turbulence,
101 const dictionary& dict,
102 const dictionaryConstructorTableType& additionalConstructors,
103 const word& lookupName
104)
105{
106 const word deltaType(dict.get<word>(lookupName));
107
108 Info<< "Selecting LES " << lookupName << " type " << deltaType << endl;
109
110 // First any additional ones
111 {
112 auto ctorIter = additionalConstructors.cfind(deltaType);
113
114 if (ctorIter.found())
115 {
116 return autoPtr<LESdelta>(ctorIter.val()(name, turbulence, dict));
117 }
118 }
119
120 auto* ctorPtr = dictionaryConstructorTable(deltaType);
121
122 if (!ctorPtr)
123 {
125 (
126 dict,
127 "LESdelta",
128 deltaType,
129 *dictionaryConstructorTablePtr_
130 );
131
132 if (!additionalConstructors.empty())
133 {
135 << " and " << additionalConstructors.sortedToc() << nl;
136 }
137
139 << exit(FatalIOError);
140 }
141
142 return autoPtr<LESdelta>(ctorPtr(name, turbulence, dict));
143}
144
145
146// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
Abstract base class for LES deltas.
Definition: LESdelta.H:54
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Abstract base class for turbulence models (RAS, LES and laminar).
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
compressible::turbulenceModel & turbulence
word timeName
Definition: getTimeIndex.H:3
Namespace for OpenFOAM.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
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
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict