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 -------------------------------------------------------------------------------
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 "LESdelta.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
38 }
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 (
44  const word& name,
46 )
47 :
48  turbulenceModel_(turbulence),
49  delta_
50  (
51  IOobject
52  (
53  name,
54  turbulence.mesh().time().timeName(),
55  turbulence.mesh(),
56  IOobject::NO_READ,
57  IOobject::NO_WRITE
58  ),
59  turbulence.mesh(),
60  dimensionedScalar(word::null, dimLength, SMALL)
61  )
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
66 
68 (
69  const word& name,
71  const dictionary& dict,
72  const word& lookupName
73 )
74 {
75  const word deltaType(dict.get<word>(lookupName));
76 
77  Info<< "Selecting LES " << lookupName << " type " << deltaType << endl;
78 
79  auto* ctorPtr = dictionaryConstructorTable(deltaType);
80 
81  if (!ctorPtr)
82  {
84  (
85  dict,
86  "LESdelta",
87  deltaType,
88  *dictionaryConstructorTablePtr_
89  ) << exit(FatalIOError);
90  }
91 
92  return autoPtr<LESdelta>(ctorPtr(name, turbulence, dict));
93 }
94 
95 
97 (
98  const word& name,
100  const dictionary& dict,
101  const dictionaryConstructorTableType& additionalConstructors,
102  const word& lookupName
103 )
104 {
105  const word deltaType(dict.get<word>(lookupName));
106 
107  Info<< "Selecting LES " << lookupName << " type " << deltaType << endl;
108 
109  // First any additional ones
110  {
111  auto ctorIter = additionalConstructors.cfind(deltaType);
112 
113  if (ctorIter.good())
114  {
115  return autoPtr<LESdelta>(ctorIter.val()(name, turbulence, dict));
116  }
117  }
118 
119  auto* ctorPtr = dictionaryConstructorTable(deltaType);
120 
121  if (!ctorPtr)
122  {
124  (
125  dict,
126  "LESdelta",
127  deltaType,
128  *dictionaryConstructorTablePtr_
129  );
130 
131  if (!additionalConstructors.empty())
132  {
134  << " and " << additionalConstructors.sortedToc() << nl;
135  }
136 
138  << exit(FatalIOError);
139  }
140 
141  return autoPtr<LESdelta>(ctorPtr(name, turbulence, dict));
142 }
143 
144 
145 // ************************************************************************* //
dictionary dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
LESdelta(const LESdelta &)=delete
No copy construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Abstract base class for LES deltas.
Definition: LESdelta.H:49
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
Abstract base class for turbulence models (RAS, LES and laminar).
static autoPtr< LESdelta > New(const word &name, const turbulenceModel &turbulence, const dictionary &dict, const word &lookupName="delta")
Return a reference to the selected LES delta.
Definition: LESdelta.C:61
word timeName
Definition: getTimeIndex.H:3
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
defineTypeNameAndDebug(combustionModel, 0)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
messageStream Info
Information stream (stdout output on master, null elsewhere)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:635
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...