Loading...
Searching...
No Matches
ensightCloudWriteObject.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::functionObjects::ensightCloudWriteObject
28
29Group
30 grpLagrangianFunctionObjects
31
32Description
33 This functionObject writes cloud(s) in ensight format
34
35 Example of function object specification:
36 \verbatim
37 cloudWrite1
38 {
39 type ensightCloud;
40 libs (lagrangianFunctionObjects);
41 writeControl writeTime;
42 writeInterval 1;
43 format ascii;
44
45 timeFormat scientific;
46 timePrecision 5;
47
48 cloud myCloud;
49 fields (T U rho);
50 width 4; // file-padding
51
52 selection
53 {
54 stride
55 {
56 // every 10th parcelId
57 action add;
58 source stride;
59 stride 10;
60 }
61 Umin
62 {
63 // Remove slow parcels
64 action subtract;
65 source field;
66 field U;
67 accept (less 1e-3);
68 }
69 diam
70 {
71 // Only particular diameter ranges
72 action subset;
73 source field;
74 field d;
75 accept (greater 1e-3) and (less 1e-3);
76 }
77 }
78 }
79 \endverbatim
80
81 \heading Basic Usage
82 \table
83 Property | Description | Required | Default
84 type | Type name: ensightCloud | yes |
85 clouds | List of clouds (name or regex) | no |
86 cloud | Cloud name | no |
87 fields | List of fields (name or regex) | no |
88 selection | Parcel selection control | no | empty-dict
89 \endtable
90
91 \heading Output Options
92 \table
93 Property | Description | Required | Default
94 format | Format as ascii or binary | no | binary
95 width | Mask width for \c data/XXXX | no | 8
96 directory | The output directory name | no | postProcessing/NAME
97 overwrite | Remove existing directory | no | false
98 consecutive | Consecutive output numbering | no | false
99 width | Padding width for file name | no | 8
100 prune | Suppress writing of empty clouds | no | false
101 timeFormat | Time format (ensight case) | no | scientific
102 timePrecision | Time precision (ensight case) | no | 5
103 writeControl | Output control | recommended | timeStep
104 \endtable
105
106 The output filename and fields are added to the functionObjectProperties
107 information. For the previous example specification:
108
109 \verbatim
110 cloudWrite1
111 {
112 myCloud
113 {
114 file "<case>/simulation.case";
115 fields (T U rho);
116 }
117 }
118 \endverbatim
119
120Note
121 The selection dictionary can be used for finer control of the parcel
122 output. It contains a set of (add,subtract,subset,clear,invert)
123 selection actions and sources.
124 Omitting the selection dictionary is the same as specifying the
125 conversion of all parcels (in the selected clouds).
126 More syntax details are to be found in the corresponding
127 Foam::Detail::parcelSelection class.
128
129See also
130 Foam::Detail::parcelSelection
131 Foam::functionObjects::vtkCloud
132 Foam::functionObjects::ensightWrite
133 Foam::functionObjects::fvMeshFunctionObject
134 Foam::functionObjects::timeControl
135
136SourceFiles
137 ensightCloudWriteObject.cxx
138 ensightCloudWriteObjectImpl.cxx
139
140\*---------------------------------------------------------------------------*/
141
142#ifndef Foam_functionObjects_ensightCloudWriteObject_H
143#define Foam_functionObjects_ensightCloudWriteObject_H
144
145#include "fvMeshFunctionObject.H"
146#include "ensightCase.H"
147#include "globalIndex.H"
149#include "wordRes.H"
150
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153namespace Foam
154{
155namespace functionObjects
156{
157
158/*---------------------------------------------------------------------------*\
159 Class ensightCloudWriteObject Declaration
160\*---------------------------------------------------------------------------*/
161
163:
165 public Foam::Detail::parcelSelection
166{
167 // Private Data
168
169 //- Ensight output options
170 ensightCase::options caseOpts_;
171
172 //- Output directory
173 fileName outputDir_;
174
175 //- Consecutive output numbering
176 bool consecutive_;
177
178 //- Suppress writing of empty clouds
179 bool pruneEmpty_;
180
181 //- Apply output filter (for the current cloud)
182 bool applyFilter_;
183
184 //- Sizing of selected parcels (including any filtering)
185 globalIndex procAddr_;
186
187 //- Requested names of clouds to process
188 wordRes selectClouds_;
189
190 //- Subset of cloud fields to process
191 wordRes selectFields_;
192
193 //- Ensight case handler
194 autoPtr<ensightCase> ensCase_;
195
196
197 // Private Member Functions
198
199 //- Ensight case handler
200 ensightCase& ensCase() { return *ensCase_; }
201
202 //- Write a cloud to disk (creates parent directory),
203 //- and record on the cloud OutputProperties.
204 // \param file is the output file name, with extension.
205 bool writeCloud(const word& cloudName);
206
207 //- Write fields of IOField<Type>
208 template<class Type>
209 wordList writeFields
210 (
211 const word& cloudName,
212 const objectRegistry& obrTmp
213 );
214
215
216 //- No copy construct
217 ensightCloudWriteObject(const ensightCloudWriteObject&) = delete;
218
219 //- No copy assignment
220 void operator=(const ensightCloudWriteObject&) = delete;
221
222
223public:
224
225 //- Runtime type information
226 TypeName("ensightCloud");
227
228
229 // Constructors
230
231 //- Construct from name, Time and dictionary
232 ensightCloudWriteObject
233 (
234 const word& name,
235 const Time& runTime,
236 const dictionary& dict
237 );
238
239
240 //- Destructor
241 virtual ~ensightCloudWriteObject() = default;
243
244 // Member Functions
245
246 //- Read the ensightCloud specification
247 virtual bool read(const dictionary& dict);
248
249 //- Execute, currently does nothing
250 virtual bool execute();
251
252 //- Write fields
253 virtual bool write();
254};
255
256
257// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258
259} // End namespace functionObjects
260} // End namespace Foam
261
262// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263
264#endif
265
266// ************************************************************************* //
const word cloudName(propsDict.get< word >("cloud"))
Selection of parcels based on their objectRegistry entries. Normally accessed via a dictionary entry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Configuration options for the ensightCase.
Supports writing of ensight cases as well as providing common factory methods to open new files.
Definition ensightCase.H:64
A class for handling file names.
Definition fileName.H:75
const word & name() const noexcept
Return the name of this functionObject.
This functionObject writes cloud(s) in ensight format.
virtual bool read(const dictionary &dict)
Read the ensightCloud specification.
virtual ~ensightCloudWriteObject()=default
Destructor.
virtual bool execute()
Execute, currently does nothing.
ensightCloudWriteObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
TypeName("ensightCloud")
Runtime type information.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
Registry of regIOobjects.
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68