cloudInfo.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2022 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 Class
28  Foam::functionObjects::cloudInfo
29 
30 Group
31  grpLagrangianFunctionObjects
32 
33 Description
34  Outputs Lagrangian cloud information to a file.
35 
36  The current outputs include:
37  - total current number of parcels
38  - total current mass of parcels
39 
40  Operands:
41  \table
42  Operand | Type | Location
43  input | - | -
44  output file | dat | postProcessing/<FO>/<time>/<cloudName>.dat
45  output field | - | -
46  \endtable
47 
48 Usage
49  Minimal example by using \c system/controlDict.functions:
50  \verbatim
51  cloudInfoFO
52  {
53  // Mandatory entries
54  type cloudInfo;
55  libs (lagrangianFunctionObjects);
56  clouds <wordList>; // (kinematicCloud1 thermoCloud1)
57 
58  // Optional entries
59  selection <dictionary>;
60  sampleOnExecute <bool>;
61  verbose <bool>;
62 
63  // Inherited entries
64  ...
65  }
66  \endverbatim
67 
68  where the entries mean:
69  \table
70  Property | Description | Type | Reqd | Deflt
71  type | Type name: cloudInfo | word | yes | -
72  libs | Library name: lagrangianFunctionObjects | word | yes | -
73  clouds | List of clouds names to process | yes | - | -
74  selection | Parcel selection control | no | empty-dict
75  sampleOnExecute| Sample/report (on execute) without writing | no | false
76  verbose | Additional verbosity | bool | no | false
77  \endtable
78 
79  The inherited entries are elaborated in:
80  - \link regionFunctionObject.H \endlink
81  - \link logFiles.H \endlink
82  - \link parcelSelectionDetail.H \endlink
83 
84 SourceFiles
85  cloudInfo.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef Foam_functionObjects_cloudInfo_H
90 #define Foam_functionObjects_cloudInfo_H
91 
92 #include "regionFunctionObject.H"
93 #include "logFiles.H"
94 #include "parcelSelectionDetail.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 namespace functionObjects
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class cloudInfo Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class cloudInfo
108 :
109  public functionObjects::regionFunctionObject,
110  public functionObjects::logFiles,
112 {
113 protected:
114 
115  // Data Types
116 
117  //- Local control for sampling actions
118  enum sampleActionType : unsigned
119  {
120  ACTION_NONE = 0,
121  ACTION_WRITE = 0x1,
122  ACTION_STORE = 0x2,
123  ACTION_ALL = 0xF
124  };
125 
126 
127  // Protected Data
128 
129  //- Additional verbosity
130  bool verbose_;
131 
132  //- Perform sample actions on execute as well
133  bool onExecute_;
134 
135  //- List of cloud names
137 
138  //- Output file per cloud
139  PtrList<OFstream> filePtrs_;
140 
141 
142  // Protected Member Functions
143 
144  //- File header information
145  virtual void writeFileHeader(Ostream& os) const;
146 
147  //- Perform operation report/write
148  bool performAction(unsigned request);
149 
150  //- No copy construct
151  cloudInfo(const cloudInfo&) = delete;
152 
153  //- No copy assignment
154  void operator=(const cloudInfo&) = delete;
155 
156 
157 public:
159  //- Runtime type information
160  TypeName("cloudInfo");
161 
162 
163  // Constructors
164 
165  //- Construct from name, Time and dictionary
166  cloudInfo
167  (
168  const word& name,
169  const Time& runTime,
170  const dictionary&
171  );
172 
174  //- Destructor
175  virtual ~cloudInfo() = default;
177 
178  // Member Functions
179 
180  //- Read the function-object dictionary
181  virtual bool read(const dictionary& dict);
182 
183  //- Execute the function-object operations
184  virtual bool execute();
186  //- Write the function-object results
187  virtual bool write();
188 };
189 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 } // End namespace functionObjects
194 } // End namespace Foam
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
virtual bool execute()
Execute the function-object operations.
Definition: cloudInfo.C:282
dictionary dict
TypeName("cloudInfo")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
void operator=(const cloudInfo &)=delete
No copy assignment.
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Selection of parcels based on their objectRegistry entries. Normally accessed via a dictionary entry...
PtrList< OFstream > filePtrs_
Output file per cloud.
Definition: cloudInfo.H:200
const word & name() const noexcept
Return the name of this functionObject.
virtual ~cloudInfo()=default
Destructor.
virtual void writeFileHeader(Ostream &os) const
File header information.
Definition: cloudInfo.C:50
cloudInfo(const cloudInfo &)=delete
No copy construct.
wordList cloudNames_
List of cloud names.
Definition: cloudInfo.H:195
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition: cloudInfo.C:83
virtual bool write()
Write the function-object results.
Definition: cloudInfo.C:293
bool performAction(unsigned request)
Perform operation report/write.
Definition: cloudInfo.C:127
bool verbose_
Additional verbosity.
Definition: cloudInfo.H:185
List< word > wordList
List of word.
Definition: fileName.H:59
bool onExecute_
Perform sample actions on execute as well.
Definition: cloudInfo.H:190
sampleActionType
Local control for sampling actions.
Definition: cloudInfo.H:171
Namespace for OpenFOAM.