resolutionIndex.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) 2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "resolutionIndex.H"
29 #include "resolutionIndexModel.H"
30 #include "turbulenceModel.H"
31 #include "RASModel.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace functionObjects
39 {
40  defineTypeNameAndDebug(resolutionIndex, 0);
41  addToRunTimeSelectionTable(functionObject, resolutionIndex, dictionary);
42 }
43 }
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
49 (
50  const word& name,
51  const Time& runTime,
52  const dictionary& dict
53 )
54 :
55  fvMeshFunctionObject(name, runTime, dict),
56  resolutionIndexModelPtr_()
57 {
58  read(dict);
59 }
60 
61 
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
63 
65 {} // resolutionIndexModel was forward declared
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 {
72  if (mesh_.foundObject<RASModelBase>(turbulenceModel::propertiesName))
73  {
75  << type() << " " << name()
76  << " is not available for RANS-based turbulence models."
77  << exit(FatalIOError);
78 
79  return false;
80  }
81 
83  {
84  return false;
85  }
86 
87  Info<< type() << " " << name() << ":" << endl;
88 
89  resolutionIndexModelPtr_.reset
90  (
92  );
93 
94  return true;
95 }
96 
97 
99 {
100  if (!resolutionIndexModelPtr_->execute())
101  {
102  return false;
103  }
104 
105  return true;
106 }
107 
108 
110 {
111  Info<< type() << " " << name() << " write:" << endl;
112 
113  if (!resolutionIndexModelPtr_->write())
114  {
115  return false;
116  }
117  Info<< endl;
118 
119  return true;
120 }
121 
122 
123 // ************************************************************************* //
dictionary dict
defineTypeNameAndDebug(ObukhovLength, 0)
virtual bool read(const dictionary &dict)
Read the resolutionIndex data.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Macros for easy insertion into run-time selection tables.
resolutionIndex(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static autoPtr< resolutionIndexModel > New(const word &name, const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected resolutionIndex model.
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:627
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
virtual bool execute()
Calculate the result field.
virtual bool write()
Write the result field.
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...