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 Usage
41  Example of function object specification:
42  \verbatim
43  cloudInfo1
44  {
45  type cloudInfo;
46  libs (lagrangianFunctionObjects);
47  ...
48  clouds
49  (
50  kinematicCloud1
51  thermoCloud1
52  );
53  }
54  \endverbatim
55 
56  Where the entries comprise:
57  \table
58  Property | Description | Required | Default
59  type | type name: cloudInfo | yes |
60  clouds | list of clouds names to process | yes |
61  selection | Parcel selection control | no | empty-dict
62  sampleOnExecute| Sample/report (on execute) without writing | no | false
63  \endtable
64 
65  The output data of each cloud is written to a file named <cloudName>.dat
66 
67 See also
68  Foam::functionObject
69  Foam::functionObjects::regionFunctionObject
70  Foam::functionObjects::logFiles
71 
72 SourceFiles
73  cloudInfo.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef Foam_functionObjects_cloudInfo_H
78 #define Foam_functionObjects_cloudInfo_H
79 
80 #include "regionFunctionObject.H"
81 #include "logFiles.H"
82 #include "parcelSelectionDetail.H"
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 namespace functionObjects
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class cloudInfo Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class cloudInfo
96 :
97  public functionObjects::regionFunctionObject,
98  public functionObjects::logFiles,
100 {
101 protected:
102 
103  // Data Types
104 
105  //- Local control for sampling actions
106  enum sampleActionType : unsigned
107  {
108  ACTION_NONE = 0,
109  ACTION_WRITE = 0x1,
110  ACTION_STORE = 0x2,
111  ACTION_ALL = 0xF
112  };
113 
114 
115  // Protected Data
116 
117  //- Additional verbosity
118  bool verbose_;
119 
120  //- Perform sample actions on execute as well
121  bool onExecute_;
122 
123  //- List of cloud names
125 
126  //- Output file per cloud
129 
130  // Protected Member Functions
132  //- File header information
133  virtual void writeFileHeader(Ostream& os) const;
134 
135  //- Perform operation report/write
136  bool performAction(unsigned request);
137 
138  //- No copy construct
139  cloudInfo(const cloudInfo&) = delete;
140 
141  //- No copy assignment
142  void operator=(const cloudInfo&) = delete;
143 
144 
145 public:
146 
147  //- Runtime type information
148  TypeName("cloudInfo");
149 
150 
151  // Constructors
153  //- Construct from Time and dictionary
154  cloudInfo
155  (
156  const word& name,
157  const Time& runTime,
158  const dictionary&
159  );
160 
161 
162  //- Destructor
163  virtual ~cloudInfo() = default;
164 
165 
166  // Member Functions
167 
168  //- Read the controls
169  virtual bool read(const dictionary& dict);
170 
171  //- Execute, currently does nothing
172  virtual bool execute();
173 
174  //- Write
175  virtual bool write();
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace functionObjects
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
virtual bool execute()
Execute, currently does nothing.
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:129
void operator=(const cloudInfo &)=delete
No copy assignment.
engineTime & runTime
Outputs Lagrangian cloud information to a file.
Definition: cloudInfo.H:115
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Selection of parcels based on their objectRegistry entries. Normally accessed via a dictionary entry...
PtrList< OFstream > filePtrs_
Output file per cloud.
Definition: cloudInfo.H:157
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:152
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool read(const dictionary &dict)
Read the controls.
Definition: cloudInfo.C:83
virtual bool write()
Write.
Definition: cloudInfo.C:293
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
bool performAction(unsigned request)
Perform operation report/write.
Definition: cloudInfo.C:127
bool verbose_
Additional verbosity.
Definition: cloudInfo.H:142
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
bool onExecute_
Perform sample actions on execute as well.
Definition: cloudInfo.H:147
sampleActionType
Local control for sampling actions.
Definition: cloudInfo.H:128
Namespace for OpenFOAM.