LESdelta.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) 2011-2024 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 "LESdelta.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
35 }
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
40 (
41  const word& name,
43 )
44 :
45  momentumTransportModel_(turbulence),
46  delta_
47  (
48  IOobject
49  (
50  name,
51  turbulence.mesh().time().name(),
52  turbulence.mesh(),
53  IOobject::NO_READ,
54  IOobject::NO_WRITE
55  ),
56  turbulence.mesh(),
58  calculatedFvPatchScalarField::typeName
59  )
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
64 
66 (
67  const word& name,
69  const dictionary& dict
70 )
71 {
72  const word deltaType(dict.lookup("delta"));
73 
74  Info<< indent
75  << "Selecting LES delta type " << deltaType << endl;
76 
77  dictionaryConstructorTable::iterator cstrIter =
78  dictionaryConstructorTablePtr_->find(deltaType);
79 
80  if (cstrIter == dictionaryConstructorTablePtr_->end())
81  {
83  << "Unknown LESdelta type "
84  << deltaType << nl << nl
85  << "Valid LESdelta types are :" << endl
86  << dictionaryConstructorTablePtr_->sortedToc()
87  << exit(FatalError);
88  }
89 
90  Info<< incrIndent;
91  autoPtr<LESdelta> modelPtr(cstrIter()(name, turbulence, dict));
92  Info<< decrIndent;
93  return modelPtr;
94 }
95 
96 
98 (
99  const word& name,
101  const dictionary& dict,
102  const dictionaryConstructorTable& additionalConstructors
103 )
104 {
105  const word deltaType(dict.lookup("delta"));
106 
107  Info<< indent
108  << "Selecting LES delta type " << deltaType << endl;
109 
110  // First on additional ones
111  dictionaryConstructorTable::const_iterator cstrIter =
112  additionalConstructors.find(deltaType);
113 
114  if (cstrIter != additionalConstructors.end())
115  {
116  Info<< incrIndent;
117  autoPtr<LESdelta> modelPtr(cstrIter()(name, turbulence, dict));
118  Info<< decrIndent;
119  return modelPtr;
120  }
121  else
122  {
123  dictionaryConstructorTable::const_iterator cstrIter =
124  dictionaryConstructorTablePtr_->find(deltaType);
125 
126  if (cstrIter == dictionaryConstructorTablePtr_->end())
127  {
129  << "Unknown LESdelta type "
130  << deltaType << nl << nl
131  << "Valid LESdelta types are :" << endl
132  << additionalConstructors.sortedToc()
133  << " and "
134  << dictionaryConstructorTablePtr_->sortedToc()
135  << exit(FatalError);
136  return autoPtr<LESdelta>();
137  }
138  else
139  {
140  Info<< incrIndent;
141  autoPtr<LESdelta> modelPtr(cstrIter()(name, turbulence, dict));
142  Info<< decrIndent;
143  return modelPtr;
144  }
145  }
146 }
147 
148 
149 // ************************************************************************* //
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Abstract base class for LES deltas.
Definition: LESdelta.H:51
static autoPtr< LESdelta > New(const word &name, const momentumTransportModel &turbulence, const dictionary &dict)
Return a reference to the selected LES delta.
Definition: LESdelta.C:66
LESdelta(const word &name, const momentumTransportModel &turbulence)
Construct from name, momentumTransportModel and dictionary.
Definition: LESdelta.C:40
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:740
Abstract base class for turbulence models (RAS, LES and laminar).
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:242
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:258
messageStream Info
const dimensionSet dimLength
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:235
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:228
static const char nl
Definition: Ostream.H:267
dictionary dict
autoPtr< incompressible::momentumTransportModel > turbulence(incompressible::momentumTransportModel::New(U, phi, viscosity))