Loading...
Searching...
No Matches
ensightWrite.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) 2016-2023 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::ensightWrite
28
29Group
30 grpUtilitiesFunctionObjects
31
32Description
33 Writes fields in ensight format.
34
35 Example of function object specification:
36 \verbatim
37 ensight
38 {
39 type ensightWrite;
40 libs (utilityFunctionObjects);
41 writeControl writeTime;
42 writeInterval 1;
43 format binary;
44
45 timeFormat scientific;
46 timePrecision 5;
47
48 overwrite true;
49 width 12;
50
51 fields (U p);
52 // excludeFields ("force.*");
53
54 selection
55 {
56 box
57 {
58 action use;
59 source box;
60 box (-0.1 -0.01 -0.1) (0.1 0.30 0.1);
61 }
62 dome
63 {
64 action add;
65 shape sphere;
66 origin (-0.1 -0.01 -0.1);
67 radius 0.25;
68 }
69 centre
70 {
71 action subtract;
72 source sphere;
73 origin (-0.1 -0.01 -0.1);
74 radius 0.1;
75 }
76 blob
77 {
78 action add;
79 source surface;
80 surface triSurfaceMesh;
81 name blob.stl;
82 }
83 }
84 }
85 \endverbatim
86
87 \heading Basic Usage
88 \table
89 Property | Description | Required | Default
90 type | Type name: ensightWrite | yes |
91 fields | Fields to output | yes |
92 excludeFields | Exclude fields from output (wordRe list) | no |
93 boundary | Convert boundary fields | no | true
94 internal | Convert internal fields | no | true
95 nodeValues | Write values at nodes | no | false
96 \endtable
97
98 \heading Ensight Output Options
99 \table
100 Property | Description | Required | Default
101 format | ascii or binary format | no | binary
102 width | Mask width for \c data/XXXX | no | 8
103 directory | The output directory name | no | postProcessing/NAME
104 overwrite | Remove existing directory | no | false
105 consecutive | Consecutive output numbering | no | false
106 timeFormat | Time format (ensight case) | no | scientific
107 timePrecision | Time precision (ensight case) | no | 5
108 \endtable
109
110 \heading Output Selection
111 \table
112 Property | Description | Required | Default
113 region | Name for a single region | no | region0
114 faceZones | Select faceZones to write | no |
115 patches | Limit to listed patches (wordRe list) | no |
116 excludePatches | Exclude specified patches | no |
117 selection | Cell selection (topoSet actions) | no | empty dict
118 \endtable
119
120Note
121 The region of interest is defined by the selection dictionary
122 as a set of actions (use,add,subtract,subset,invert).
123 Omitting the selection dictionary is the same as specifying the
124 conversion of all cells (in the selected regions).
125 Omitting the patches entry is the same as specifying the conversion of all
126 patches.
127
128 Consecutive output numbering can be used in conjunction with \c overwrite.
129
130See also
131 Foam::functionObjects::vtkWrite
132 Foam::functionObjects::fvMeshFunctionObject
133 Foam::functionObjects::timeControl
134 Foam::cellBitSet::select
135
136SourceFiles
137 ensightWrite.C
138 ensightWriteImpl.cxx
139 ensightWriteUpdate.cxx
140
141\*---------------------------------------------------------------------------*/
142
143#ifndef Foam_functionObjects_ensightWrite_H
144#define Foam_functionObjects_ensightWrite_H
145
146#include "fvMeshFunctionObject.H"
147#include "ensightCase.H"
148#include "ensightMesh.H"
149#include "ensightOutputFwd.H"
150
151#include "interpolation.H"
152#include "volFields.H"
153#include "surfaceFields.H"
154#include "fvMeshSubsetProxy.H"
155#include "searchableSurfaces.H"
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159namespace Foam
160{
161namespace functionObjects
162{
163
164/*---------------------------------------------------------------------------*\
165 Class ensightWrite Declaration
166\*---------------------------------------------------------------------------*/
167
168class ensightWrite
169:
171{
172 // Private Data
173
174 //- Ensight writer options
175 ensightMesh::options writeOpts_;
176
177 //- Ensight case options
178 ensightCase::options caseOpts_;
179
180 //- The output directory
181 fileName outputDir_;
182
183 //- Consecutive output numbering
184 bool consecutive_;
185
186 //- Track changes in mesh geometry
187 polyMesh::readUpdateState meshState_;
188
189 //- Requested selection of fields to process
190 wordRes selectFields_;
191
192 //- Requested selection of fields to block
193 wordRes blockFields_;
194
195 //- Dictionary of volume selections
196 dictionary selection_;
197
198 //- Mesh subset handler
199 fvMeshSubset meshSubset_;
200
201 //- Ensight case handler
202 autoPtr<ensightCase> ensCase_;
203
204 //- Ensight mesh handler
205 autoPtr<ensightMesh> ensMesh_;
206
207
208 // Private Member Functions
209
210 //- Ensight case handler
211 ensightCase& ensCase() { return *ensCase_; }
212
213 //- Ensight mesh handler
214 ensightMesh& ensMesh() { return *ensMesh_; }
215
216
217 //- Update mesh subset according to zones, geometry, bounds
218 bool updateSubset(fvMeshSubset& subsetter) const;
219
220 //- Read information for selections
221 bool readSelection(const dictionary& dict);
222
223 //- Update meshes, subMeshes etc.
224 bool update();
225
226
227 // Write
228
229 //- Write selected volume fields.
230 template<class Type>
231 label writeVolFieldsImpl
232 (
234 const fvMeshSubset& proxy,
235 const wordHashSet& candidateNames
236 );
237
238 //- Write all volume fields
239 label writeAllVolFields
240 (
241 const fvMeshSubset& proxy,
242 const wordHashSet& candidateNames
243 );
244
245public:
246
247 //- Runtime type information
248 TypeName("ensightWrite");
249
250
251 // Constructors
252
253 //- Construct from runTime and dictionary.
255 (
256 const word& name,
257 const Time& runTime,
258 const dictionary& dict
259 );
260
261 //- No copy construct
262 ensightWrite(const ensightWrite&) = delete;
263
264 //- No copy assignment
265 void operator=(const ensightWrite&) = delete;
266
267
268 //- Destructor
269 virtual ~ensightWrite() = default;
270
271
272 // Member Functions
273
274 //- Read the ensightWrite specification
275 virtual bool read(const dictionary& dict);
276
277 //- Do nothing
278 virtual bool execute();
279
280 //- Write fields, flush case file
281 virtual bool write();
282
283 //- Do nothing at the final time-loop
284 virtual bool end();
285
286 //- Update for changes of mesh
287 virtual void updateMesh(const mapPolyMesh& mpm);
288
289 //- Update for mesh point-motion
290 virtual void movePoints(const polyMesh& mpm);
291};
292
293
294// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295
296} // End namespace functionObjects
297} // End namespace Foam
298
299// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300
301#endif
302
303// ************************************************************************* //
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
Configuration options for the ensightMesh.
Encapsulation of volume meshes for writing in ensight format. It manages cellZones,...
Definition ensightMesh.H:79
A class for handling file names.
Definition fileName.H:75
const word & name() const noexcept
Return the name of this functionObject.
Writes fields in ensight format.
virtual bool read(const dictionary &dict)
Read the ensightWrite specification.
virtual bool end()
Do nothing at the final time-loop.
virtual bool execute()
Do nothing.
virtual bool write()
Write fields, flush case file.
TypeName("ensightWrite")
Runtime type information.
virtual ~ensightWrite()=default
Destructor.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
virtual void movePoints(const polyMesh &mpm)
Update for mesh point-motion.
ensightWrite(const ensightWrite &)=delete
No copy construct.
void operator=(const ensightWrite &)=delete
No copy assignment.
ensightWrite(const word &name, const Time &runTime, const dictionary &dict)
Construct from runTime and dictionary.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
readUpdateState
Enumeration defining the state of the mesh after a read update.
Definition polyMesh.H:92
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
mesh update()
engineTime & runTime
DynamicList< float > floatBufferType
The list type used for component-wise buffering.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
Definition HashSet.H:80
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
Foam::surfaceFields.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68