surfaceCourantNumber.H
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) 2024 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 Class
27  Foam::functionObjects::surfaceCourantNumber
28 
29 Description
30  Computes the surface Courant number field at finite-area face centres.
31 
32  Operands:
33  \table
34  Operand | Type | Location
35  input | - | -
36  output file | dat <!--
37  --> | postProcessing/<FO>/<time>/<file>
38  output field | areaScalarField | <time>/<outField>
39  \endtable
40 
41 Usage
42  Minimal example by using \c system/controlDict.functions:
43  \verbatim
44  surfaceCourantNumber1
45  {
46  // Mandatory entries
47  type surfaceCourantNumber;
48  libs (regionFaModels);
49 
50  // Optional entries
51  area <word>;
52  result <word>;
53  phis <word>;
54  rho <word>;
55 
56  // Inherited entries
57  ...
58  }
59  \endverbatim
60 
61  where the entries mean:
62  \table
63  Property | Description | Type | Reqd | Deflt
64  type | Type name: surfaceCourantNumber | word | yes | -
65  libs | Library name: regionFaModels | word | yes | -
66  area | Name of finite-area region | word | no | region0
67  result | Name of result field | word | no | surfaceCo
68  phis | Name of edge flux field | word | no | phis
69  rho | Name of density field | word | no | rho
70  \endtable
71 
72  The inherited entries are elaborated in:
73  - \link fvMeshFunctionObject.H \endlink
74  - \link writeFile.H \endlink
75 
76 Note
77  - The \c surfaceCourantNumber calculates the Courant number at face centers,
78  rather than at edge centers.
79 
80 SourceFiles
81  surfaceCourantNumber.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef functionObjects_surfaceCourantNumber_H
86 #define functionObjects_surfaceCourantNumber_H
87 
88 #include "fvMeshFunctionObject.H"
89 #include "writeFile.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 
96 // Forward Declarations
97 class faMesh;
98 
99 namespace functionObjects
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class surfaceCourantNumber Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 class surfaceCourantNumber
107 :
108  public fvMeshFunctionObject,
109  public writeFile
110 {
111  // Private Data
112 
113  //- Name of result field
114  word resultName_;
115 
116  //- Name of edge flux field
117  word phisName_;
118 
119  //- Name of density field
120  word rhoName_;
121 
122  //- Reference to finite-area object registry
123  std::shared_ptr<const faMesh> faMeshPtr_;
124 
125 
126  // Private Member Functions
127 
128  //- Output file header information
129  virtual void writeFileHeader(Ostream& os);
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("surfaceCourantNumber");
136 
137 
138  // Constructors
139 
140  //- Construct from Time and dictionary
142  (
143  const word& name,
144  const Time& runTime,
145  const dictionary& dict
146  );
147 
148 
149  //- Destructor
150  virtual ~surfaceCourantNumber() = default;
151 
152 
153  // Member Functions
154 
155  //- Read the surfaceCourantNumber data
156  virtual bool read(const dictionary&);
157 
158  //- Calculate the Courant number field and return true if successful
159  virtual bool execute();
160 
161  //- Write the result field
162  virtual bool write();
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace functionObjects
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
dictionary dict
engineTime & runTime
TypeName("surfaceCourantNumber")
Runtime type information.
surfaceCourantNumber(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
const word & name() const noexcept
Return the name of this functionObject.
OBJstream os(runTime.globalPath()/outputName)
virtual bool write()
Write the result field.
virtual bool read(const dictionary &)
Read the surfaceCourantNumber data.
virtual bool execute()
Calculate the Courant number field and return true if successful.
virtual ~surfaceCourantNumber()=default
Destructor.
Namespace for OpenFOAM.