boundaryDataSurfaceWriter.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 | Copyright (C) 2015 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::boundaryDataSurfaceWriter
26 
27 Description
28  A surfaceWriter for outputting to a form useable for the
29  timeVaryingMapped boundary condition. This reads the data from
30  constant/boundaryData/<patch> directory
31 
32  Typical way of working:
33  - use a sampledSurface of type 'patch' (to sample a patch):
34  \verbatim
35  surfaces
36  {
37  type surfaces;
38  surfaceFormat boundaryData;
39  fields ( p );
40  surfaces
41  (
42  outlet
43  {
44  type patch;
45  patches (outlet);
46  interpolate false;
47  }
48  );
49  }
50  \endverbatim
51 
52  - write using this writer.
53  - move postProcessing/surfaces/outlet to constant/boundaryData/outlet
54  in your destination case.
55  - use a timeVaryingMappedFixedValue condition to read and interpolate
56  the profile:
57  type timeVaryingMappedFixedValue;
58  setAverage false; // do not use read average
59  offset 0; // do not apply offset to values
60 
61  Note:
62  - with 'interpolate false' the data is on the face centres of the
63  patch. Take care that a 2D geometry will only have a single row
64  of face centres so might not provide a valid triangulation
65  (this is what timeVaryingMappedFixedValue uses to do interpolation)
66  (Alternatively use timeVaryingMappedFixedValue with mapMethod 'nearest')
67 
68 
69 SourceFiles
70  boundaryDataSurfaceWriter.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef boundaryDataSurfaceWriter_H
75 #define boundaryDataSurfaceWriter_H
76 
77 #include "surfaceWriter.H"
78 
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class boundaryDataSurfaceWriter Declaration
87 \*---------------------------------------------------------------------------*/
88 
90 :
91  public surfaceWriter
92 {
93  // Private Member Functions
94 
95  //- Templated write operation
96  template<class Type>
98  (
99  const fileName& outputDir,
100  const fileName& surfaceName,
101  const pointField& points,
102  const faceList& faces,
103  const word& fieldName,
104  const Field<Type>& values,
105  const bool isNodeValues,
106  const bool verbose
107  ) const;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("boundaryData");
114 
115 
116  // Constructors
117 
118  //- Construct null
120 
121 
122  //- Destructor
123  virtual ~boundaryDataSurfaceWriter();
124 
125 
126  // Member Functions
127 
128  //- Write single surface geometry to file.
129  virtual fileName write
130  (
131  const fileName& outputDir,
132  const fileName& surfaceName,
133  const pointField& points,
134  const faceList& faces,
135  const bool verbose = false
136  ) const;
137 
138 
139  //- Write scalarField for a single surface to file.
140  // One value per face or vertex (isNodeValues = true)
141  virtual fileName write
142  (
143  const fileName& outputDir, // <case>/surface/TIME
144  const fileName& surfaceName, // name of surface
145  const pointField& points,
146  const faceList& faces,
147  const word& fieldName, // name of field
148  const Field<scalar>& values,
149  const bool isNodeValues,
150  const bool verbose = false
151  ) const;
152 
153  //- Write vectorField for a single surface to file.
154  // One value per face or vertex (isNodeValues = true)
155  virtual fileName write
156  (
157  const fileName& outputDir, // <case>/surface/TIME
158  const fileName& surfaceName, // name of surface
159  const pointField& points,
160  const faceList& faces,
161  const word& fieldName, // name of field
162  const Field<vector>& values,
163  const bool isNodeValues,
164  const bool verbose = false
165  ) const;
166 
167  //- Write sphericalTensorField for a single surface to file.
168  // One value per face or vertex (isNodeValues = true)
169  virtual fileName write
170  (
171  const fileName& outputDir, // <case>/surface/TIME
172  const fileName& surfaceName, // name of surface
173  const pointField& points,
174  const faceList& faces,
175  const word& fieldName, // name of field
176  const Field<sphericalTensor>& values,
177  const bool isNodeValues,
178  const bool verbose = false
179  ) const;
180 
181  //- Write symmTensorField for a single surface to file.
182  // One value per face or vertex (isNodeValues = true)
183  virtual fileName write
184  (
185  const fileName& outputDir, // <case>/surface/TIME
186  const fileName& surfaceName, // name of surface
187  const pointField& points,
188  const faceList& faces,
189  const word& fieldName, // name of field
190  const Field<symmTensor>& values,
191  const bool isNodeValues,
192  const bool verbose = false
193  ) const;
194 
195  //- Write tensorField for a single surface to file.
196  // One value per face or vertex (isNodeValues = true)
197  virtual fileName write
198  (
199  const fileName& outputDir, // <case>/surface/TIME
200  const fileName& surfaceName, // name of surface
201  const pointField& points,
202  const faceList& faces,
203  const word& fieldName, // name of field
204  const Field<tensor>& values,
205  const bool isNodeValues,
206  const bool verbose = false
207  ) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #ifdef NoRepository
219 #endif
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
Foam::boundaryDataSurfaceWriter::write
virtual fileName write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
Definition: boundaryDataSurfaceWriter.C:53
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::surfaceWriter
Base class for surface writers.
Definition: surfaceWriter.H:54
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::boundaryDataSurfaceWriter
A surfaceWriter for outputting to a form useable for the timeVaryingMapped boundary condition....
Definition: boundaryDataSurfaceWriter.H:88
Foam::boundaryDataSurfaceWriter::writeTemplate
fileName writeTemplate(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const word &fieldName, const Field< Type > &values, const bool isNodeValues, const bool verbose) const
Templated write operation.
Foam::boundaryDataSurfaceWriter::~boundaryDataSurfaceWriter
virtual ~boundaryDataSurfaceWriter()
Destructor.
Definition: boundaryDataSurfaceWriter.C:46
surfaceWriter.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::boundaryDataSurfaceWriter::TypeName
TypeName("boundaryData")
Runtime type information.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::boundaryDataSurfaceWriter::boundaryDataSurfaceWriter
boundaryDataSurfaceWriter()
Construct null.
Definition: boundaryDataSurfaceWriter.C:38
boundaryDataSurfaceWriterTemplates.C