surfaceFieldValue.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2015-2020 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::fieldValues::surfaceFieldValue
29 
30 Group
31  grpFieldFunctionObjects
32 
33 Description
34  A \c face regionType variant of the \c fieldValues function object.
35 
36  Given a list of user-specified fields and a selection of mesh (or general
37  surface) faces, a number of operations can be performed, such as sums,
38  averages and integrations.
39 
40  For example, to calculate the volumetric or mass flux across a patch,
41  apply the \c sum operator to the flux field (typically \c phi).
42 
43 Usage
44  A minimal example:
45  \verbatim
46  surfaceFieldValuePatch1
47  {
48  // Mandatory entries (unmodifiable)
49  type surfaceFieldValue;
50  libs (fieldFunctionObjects);
51 
52  // Mandatory entries (runtime modifiable)
53  fields (<field1> <field2> ... <fieldN>);
54  operation <operationType>;
55  regionType patch;
56  name <patch>;
57 
58  // Optional entries (runtime modifiable)
59  names (<patch-name> <patch-regex>);
60 
61  postOperation none;
62  weightField alpha1;
63  scaleFactor 1.0;
64  writeArea false;
65  surfaceFormat none;
66 
67  // Optional (inherited) entries
68  ...
69  }
70 
71  surfaceFieldValueFaceZone1
72  {
73  // Mandatory entries (unmodifiable)
74  type surfaceFieldValue;
75  libs (fieldFunctionObjects);
76 
77  // Mandatory entries (runtime modifiable)
78  fields (<field1> <field2> ... <fieldN>);
79  operation <operationType>;
80  regionType faceZone;
81  name <faceZone>;
82 
83  // Optional entries (runtime modifiable)
84  names (<zone-name> <zone-regex>);
85 
86  postOperation none;
87  weightFields (rho U);
88  scaleFactor 1.0;
89  writeArea false;
90  surfaceFormat none;
91 
92  // Optional (inherited) entries
93  ...
94  }
95  \endverbatim
96 
97  where the entries mean:
98  \table
99  Property | Description | Type | Reqd | Dflt
100  type | Type name: surfaceFieldValue | word | yes | -
101  libs | Libraries: fieldFunctionObjects | wordList | yes | -
102  regionType | Face regionType: see below | word | yes | -
103  fields | Names of operand fields | wordList | yes | -
104  name | Name of the regionType | word | yes | -
105  names | Extended selection | word/regex list | no | -
106  operation | Operation type: see below | word | yes | -
107  postOperation | Post-operation type: see below | word | no | none
108  weightField | Name of field to apply weighting | word | maybe |
109  weightFields | Names of fields to apply weighting | wordList | maybe |
110  scaleFactor | Output value scaling factor | scalar | no | 1.0
111  writeArea | Write the surface area | bool | no | false
112  surfaceFormat | Output value format | word <!--
113  --> | conditional on writeFields | none
114  \endtable
115 
116  The inherited entries are elaborated in:
117  - \link fieldValue.H \endlink
118 
119  Options for the \c regionType entry:
120  \plaintable
121  faceZone | The \b name entry specifies a faceZone. Supports \b names
122  patch | The \b name entry specifies a patch. Supports \b names
123  functionObjectSurface | The \b name entry specifies a polySurface
124  sampledSurface | A \b sampledSurfaceDict sub-dictionary and \b name
125  \endplaintable
126 
127  Options for the \c operation entry:
128  \plaintable
129  none | no operation
130  min | minimum
131  max | maximum
132  sum | sum
133  sumMag | sum of component magnitudes
134  sumDirection | sum values that are positive in given direction
135  sumDirectionBalance | sum of balance of values in given direction
136  average | ensemble average
137  areaAverage | area-weighted average
138  areaIntegrate | area integral
139  CoV | coefficient of variation: standard deviation/mean
140  areaNormalAverage | area-weighted average in face normal direction
141  areaNormalIntegrate | area-weighted integral in face normal directon
142  uniformity | uniformity index
143  weightedSum | weighted sum
144  weightedAverage | weighted average
145  weightedAreaAverage | weighted area average
146  weightedAreaIntegrate | weighted area integral
147  weightedUniformity | weighted uniformity index
148  absWeightedSum | sum using absolute weighting
149  absWeightedAverage | average using absolute weighting
150  absWeightedAreaAverage | area average using absolute weighting
151  absWeightedAreaIntegrate | area integral using absolute weighting
152  absWeightedUniformity | uniformity index using absolute weighting
153  \endplaintable
154 
155  Options for the \c postOperation entry:
156  \plaintable
157  none | No additional operation after calculation
158  mag | Component-wise \c mag() after normal operation
159  sqrt | Component-wise \c sqrt() after normal operation
160  \endplaintable
161 
162  Usage by the \c postProcess utility is not available.
163 
164 Note
165  - Some types (eg, patch or faceZone) support the selection of multiple
166  entries, which can be specified as list of words or regular expressions
167  by \b names entry.<br>
168  If the \b names enty exists \em and contains a literal that can be used
169  as a suitable value for \b name, the \b name entry becomes optional
170  instead of being mandatory.
171  - The values reported by the \c areaNormalAverage and \c areaNormalIntegrate
172  operations are written as the first component of a field with the same
173  rank as the input field.
174  - Faces on empty patches are ignored.
175  - Using \c functionObjectSurface:
176  - The keyword %subRegion should not be used to select surfaces.
177  Instead specify the regionType 'functionObjectSurface' and provide
178  the name.
179  - Using \c sampledSurface:
180  - surface fields only supported by some surfaces
181  - default uses sampleScheme \c cell
182  - each face in \c sampledSurface is logically only in one cell
183  so sampling will be wrong when they are larger than cells.
184  This can only happen for sampling on a \c triSurfaceMesh
185  - take care when using isoSurfaces - these might have duplicate
186  triangles and so integration might be wrong
187 
188  Uniformity:
189  \f[
190  UI(\phi) = 1 - \frac{1}{2 \overline{\phi} A}
191  \int{\left| W \phi \cdot \hat{n} - \bar{W} \bar{\phi}\right| d\vec{A}}
192  \,,\;
193  \bar{\phi} = \frac{\int{W \phi \cdot d\vec{A}}}{\int{W \cdot d\vec{A}}}
194  \f]
195 
196  A velocity uniformity index is calculated with no weighting (W=1) and
197  \f$ \phi = \vec{U} \f$.
198 
199  A scalar concentration uniformity index is calculated with either
200  \f$ \rho \vec U \f$ or \f$ \vec U \f$ for weighting and
201  \f$ \phi = conc \f$.
202 
203 See also
204  - Foam::functionObject
205  - Foam::functionObjects::fieldValues::fieldValue
206  - ExtendedCodeGuide::functionObjects::field::surfaceFieldValue
207 
208 SourceFiles
209  surfaceFieldValue.C
210  surfaceFieldValueTemplates.C
211 
212 \*---------------------------------------------------------------------------*/
213 
214 #ifndef functionObjects_surfaceFieldValue_H
215 #define functionObjects_surfaceFieldValue_H
216 
217 #include "fieldValue.H"
218 #include "Enum.H"
219 #include "surfaceMesh.H"
220 #include "polySurface.H"
221 #include "fvsPatchField.H"
222 #include "volFieldsFwd.H"
223 #include "polySurfaceFieldsFwd.H"
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 namespace Foam
228 {
229 
230 // Forward Declarations
231 class sampledSurface;
232 class surfaceWriter;
233 
234 namespace functionObjects
235 {
236 namespace fieldValues
237 {
238 
239 /*---------------------------------------------------------------------------*\
240  Class surfaceFieldValue Declaration
241 \*---------------------------------------------------------------------------*/
242 
243 class surfaceFieldValue
244 :
245  public fieldValue
246 {
247 public:
248 
249  // Public Data Types
250 
251  //- Region type enumeration
252  enum regionTypes
253  {
254  stFaceZone = 0x01,
255  stPatch = 0x02,
256  stObject = 0x11,
257  stSampled = 0x12
258  };
259 
260  //- Region type names
261  static const Enum<regionTypes> regionTypeNames_;
262 
263  //- Bitmask values for operation variants
264  enum operationVariant
265  {
266  typeBase = 0,
267  typeScalar = 0x100,
268  typeWeighted = 0x200,
269  typeAbsolute = 0x400,
270  };
271 
272  //- Operation type enumeration
273  enum operationType
274  {
275  // Normal operations
276 
277  opNone = 0,
278  opMin,
279  opMax,
280  opSum,
281  opSumMag,
283 
286 
287  opAverage,
288  opAreaAverage,
290  opCoV,
291 
292  // Scalar return values
293 
296 
299 
301  opUniformity,
302 
303  // Weighted variants
304 
307 
310 
313 
316 
319 
320  // Variants using absolute weighting
321 
324 
327 
330 
334 
338  };
339 
340  //- Operation type names
341  static const Enum<operationType> operationTypeNames_;
342 
343 
344  //- Post-operation type enumeration
345  enum postOperationType
346  {
347  postOpNone,
348  postOpMag,
349  postOpSqrt
350  };
351 
352  //- Operation type names
353  static const Enum<postOperationType> postOperationTypeNames_;
354 
355 
356 private:
357 
358  // Private Member Functions
359 
360  //- Set faces to evaluate based on a face zone
361  void setFaceZoneFaces();
362 
363  //- Set faces to evaluate based on a patch
364  void setPatchFaces();
365 
366  //- Combine mesh faces and points from multiple processors
367  void combineMeshGeometry
368  (
369  faceList& faces,
371  ) const;
372 
373  //- Combine surface faces and points from multiple processors
374  void combineSurfaceGeometry
375  (
376  faceList& faces,
378  ) const;
379 
380  //- Calculate and return total area of the surfaceFieldValue: sum(magSf)
381  scalar totalArea() const;
382 
383 
384 protected:
385 
386  // Protected Data
387 
388  //- Region type
390 
391  //- Operation to apply to values
393 
394  //- Optional post-evaluation operation
396 
397  //- Track if the surface needs an update
398  bool needsUpdate_;
399 
400  //- Optionally write the area of the surfaceFieldValue
401  bool writeArea_;
402 
403  //- Extended selections
404  wordRes selectionNames_;
405 
406  //- Weight field name(s) - optional
408 
409  //- Total area of the surfaceFieldValue
410  scalar totalArea_;
411 
412  //- Global number of faces
413  label nFaces_;
414 
415 
416  // If operating on mesh faces (faceZone, patch)
417 
418  //- Local list of face IDs
420 
421  //- Local list of patch ID per face
423 
424  //- List representing the face flip map
425  // (false: use as-is, true: negate)
427 
428 
429  // Demand-driven
430 
431  //- The sampledSurface (when operating on sampledSurface)
432  autoPtr<sampledSurface> sampledPtr_;
433 
434  //- Surface writer
435  autoPtr<surfaceWriter> surfaceWriterPtr_;
436 
437 
438  // Static Member Functions
439 
440  //- Weighting factor.
441  // Possibly applies mag() depending on the operation type.
442  template<class WeightType>
443  static tmp<scalarField> weightingFactor
444  (
445  const Field<WeightType>& weightField,
446  const bool useMag
447  );
448 
449  //- Weighting factor, weight field projected onto unit-normal.
450  // Possibly applies mag() depending on the operation type.
451  // Reverts to 'one' if the weight field is unavailable.
452  template<class WeightType>
454  (
455  const Field<WeightType>& weightField,
456  const vectorField& Sf,
457  const bool useMag
458  );
459 
460  //- Weighting factor, weight field with area factor.
461  // Possibly applies mag() depending on the operation type.
462  // Reverts to mag(Sf) if the weight field is unavailable.
463  template<class WeightType>
465  (
466  const Field<WeightType>& weightField,
467  const vectorField& Sf,
468  const bool useMag
469  );
470 
471 
472  // Protected Member Functions
473 
474  //- The volume mesh or surface registry being used
475  const objectRegistry& obr() const;
476 
477  //- Can the surface definition sample surface-fields?
478  inline bool withSurfaceFields() const;
479 
480  //- Can use mesh topological merge?
481  inline bool withTopologicalMerge() const noexcept;
482 
483  //- Return the local list of face IDs
484  inline const labelList& faceId() const noexcept;
485 
486  //- Return the local list of patch ID per face
487  inline const labelList& facePatch() const noexcept;
488 
489  //- Return the local true/false list representing the face flip map
490  inline const boolList& faceFlip() const noexcept;
491 
492  //- True if the operation needs a surface Sf
493  bool usesSf() const noexcept;
494 
495  //- True if the operation variant uses mag
496  inline bool is_magOp() const noexcept;
497 
498  //- True if the operation variant uses a weight-field
499  inline bool is_weightedOp() const noexcept;
500 
501  //- True if field is non-empty on any processor.
502  template<class WeightType>
503  inline bool canWeight(const Field<WeightType>& fld) const;
504 
505  //- Update the surface and surface information as required.
506  // Do nothing (and return false) if no update was required
507  bool update();
508 
509  //- Return true if the field name is known and a valid type
510  template<class Type>
511  bool validField(const word& fieldName) const;
512 
513  //- Return field values by looking up field name
514  template<class Type>
516  (
517  const word& fieldName,
518  const bool mandatory = false
519  ) const;
520 
521  //- Apply the 'operation' to the values. Operation must preserve Type.
522  template<class Type, class WeightType>
524  (
525  const Field<Type>& values,
526  const vectorField& Sf,
527  const Field<WeightType>& weightField
528  ) const;
529 
530  //- Apply the 'operation' to the values. Wrapper around
531  // processSameTypeValues. See also template specialisation below.
532  template<class Type, class WeightType>
533  Type processValues
534  (
535  const Field<Type>& values,
536  const vectorField& Sf,
537  const Field<WeightType>& weightField
538  ) const;
539 
540 
541  //- Filter a surface field according to faceIds
542  template<class Type>
543  tmp<Field<Type>> filterField
544  (
546  ) const;
547 
548  //- Filter a volume field according to faceIds
549  template<class Type>
551  (
553  ) const;
554 
555  //- Templated helper function to output field values
556  template<class WeightType>
557  label writeAll
558  (
559  const vectorField& Sf,
560  const Field<WeightType>& weightField,
561  const pointField& points,
562  const faceList& faces
563  );
564 
565  //- Templated helper function to output field values
566  template<class Type, class WeightType>
567  bool writeValues
568  (
569  const word& fieldName,
570  const vectorField& Sf,
571  const Field<WeightType>& weightField,
572  const pointField& points,
573  const faceList& faces
574  );
575 
576 
577  //- Output file header information
578  virtual void writeFileHeader(Ostream& os);
579 
580 
581 public:
582 
583  //- Declare type-name, virtual type (with debug switch)
585 
586 
587  // Constructors
588 
589  //- Construct from name, Time and dictionary
591  (
592  const word& name,
593  const Time& runTime,
594  const dictionary& dict
595  );
596 
597  //- Construct from name, objectRegistry and dictionary
599  (
600  const word& name,
602  const dictionary& dict
603  );
604 
605  //- No copy construct
606  surfaceFieldValue(const surfaceFieldValue&) = delete;
607 
608  //- No copy assignment
609  void operator=(const surfaceFieldValue&) = delete;
610 
611 
612  //- Destructor
613  virtual ~surfaceFieldValue();
614 
615 
616  // Member Functions
617 
618  //- Return the region type
619  inline regionTypes regionType() const noexcept;
620 
621  //- Return the output directory
622  inline fileName outputDir() const;
623 
624  //- Read from dictionary
625  virtual bool read(const dictionary& dict);
626 
627  //- Calculate and write
628  virtual bool write();
629 
630  //- Update for changes of mesh
631  virtual void updateMesh(const mapPolyMesh& mpm);
632 
633  //- Update for changes of mesh
634  virtual void movePoints(const polyMesh& mesh);
635 };
636 
637 
638 //- Specialisation for scalar fields
639 template<>
641 (
642  const Field<scalar>& values,
643  const vectorField& Sf,
644  const scalarField& weightField
645 ) const;
646 
647 
648 //- Specialisation for vector fields
649 template<>
651 (
652  const Field<vector>& values,
653  const vectorField& Sf,
654  const scalarField& weightField
655 ) const;
656 
657 
658 //- Specialisation for scalar - pass through
659 template<>
661 (
662  const Field<scalar>& weightField,
663  const bool useMag
664 );
665 
666 //- Specialisation for scalar - pass through
667 template<>
669 (
670  const Field<scalar>& weightField,
671  const vectorField& Sf /* unused */,
672  const bool useMag
673 );
674 
675 //- Specialisation for scalar - scalar * Area
676 template<>
678 (
679  const Field<scalar>& weightField,
680  const vectorField& Sf,
681  const bool useMag
682 );
683 
684 
685 //- Specialisation for vector - vector (dot) unit-normal
686 template<>
688 (
689  const Field<vector>& weightField,
690  const vectorField& Sf,
691  const bool useMag
692 );
693 
694 //- Specialisation for vector - vector (dot) Area
695 template<>
697 (
698  const Field<vector>& weightField,
699  const vectorField& Sf,
700  const bool useMag
701 );
702 
703 
704 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
705 
706 } // End namespace fieldValues
707 } // End namespace functionObjects
708 } // End namespace Foam
709 
710 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
711 
712 #include "surfaceFieldValueI.H"
713 
714 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
715 
716 #ifdef NoRepository
718 #endif
719 
720 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
721 
722 #endif
723 
724 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::functionObjects::fieldValues::surfaceFieldValue::opAbsWeightedAreaIntegrate
Area integral using abs weighting.
Definition: surfaceFieldValue.H:541
Foam::functionObjects::fieldValues::surfaceFieldValue::opWeightedUniformity
Weighted uniformity index.
Definition: surfaceFieldValue.H:527
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::functionObjects::fieldValues::surfaceFieldValue::operation_
operationType operation_
Operation to apply to values.
Definition: surfaceFieldValue.H:601
runTime
engineTime & runTime
Definition: createEngineTime.H:13
volFieldsFwd.H
Foam::functionObjects::fieldValues::surfaceFieldValue::opMin
Minimum value.
Definition: surfaceFieldValue.H:487
Foam::Enum< regionTypes >
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::functionObjects::fieldValues::surfaceFieldValue::opSumDirectionBalance
Sum of balance of values in given direction.
Definition: surfaceFieldValue.H:494
fvsPatchField.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::fieldValues::surfaceFieldValue::is_weightedOp
bool is_weightedOp() const noexcept
True if the operation variant uses a weight-field.
Definition: surfaceFieldValueI.H:89
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
polySurface.H
Foam::functionObjects::fieldValues::surfaceFieldValue::canWeight
bool canWeight(const Field< WeightType > &fld) const
True if field is non-empty on any processor.
Definition: surfaceFieldValueTemplates.C:58
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType
operationType
Operation type enumeration.
Definition: surfaceFieldValue.H:482
Foam::functionObjects::fieldValues::surfaceFieldValue::read
virtual bool read(const dictionary &dict)
Read from dictionary.
Definition: surfaceFieldValue.C:1054
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationType
postOperationType
Post-operation type enumeration.
Definition: surfaceFieldValue.H:554
Foam::functionObjects::fieldValues::surfaceFieldValue::typeScalar
Operation returns a scalar.
Definition: surfaceFieldValue.H:476
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
Foam::volMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:51
Foam::surfaceMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: surfaceMesh.H:49
Foam::functionObjects::fieldValues::surfaceFieldValue::opAreaIntegrate
Area integral.
Definition: surfaceFieldValue.H:498
Foam::functionObjects::fieldValues::surfaceFieldValue::typeWeighted
Operation using weighting.
Definition: surfaceFieldValue.H:477
Foam::functionObjects::fieldValues::surfaceFieldValue::processSameTypeValues
Type processSameTypeValues(const Field< Type > &values, const vectorField &Sf, const Field< WeightType > &weightField) const
Apply the 'operation' to the values. Operation must preserve Type.
Definition: surfaceFieldValueTemplates.C:140
Foam::fvsPatchField
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Definition: fvsPatchField.H:68
Foam::boolList
List< bool > boolList
A List of bools.
Definition: List.H:65
Foam::functionObjects::fieldValues::surfaceFieldValue::postOpNone
No additional operation after calculation.
Definition: surfaceFieldValue.H:556
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperation_
postOperationType postOperation_
Optional post-evaluation operation.
Definition: surfaceFieldValue.H:604
Foam::functionObjects::fieldValues::surfaceFieldValue::weightFieldNames_
wordList weightFieldNames_
Weight field name(s) - optional.
Definition: surfaceFieldValue.H:616
Foam::functionObjects::fieldValues::surfaceFieldValue::opAbsWeightedAreaAverage
Area average using abs weighting.
Definition: surfaceFieldValue.H:538
Foam::functionObjects::fieldValues::surfaceFieldValue::opUniformity
Uniformity index (output is always scalar)
Definition: surfaceFieldValue.H:510
Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
tmp< Field< Type > > filterField(const GeometricField< Type, fvsPatchField, surfaceMesh > &field) const
Filter a surface field according to faceIds.
Foam::functionObjects::fieldValues::surfaceFieldValue::opAbsWeightedUniformity
Uniformity index using abs weighting.
Definition: surfaceFieldValue.H:545
Foam::functionObjects::fieldValues::surfaceFieldValue::stSampled
Sample onto surface and calculate.
Definition: surfaceFieldValue.H:466
Foam::functionObjects::fieldValues::surfaceFieldValue::stFaceZone
Calculate with faceZone(s)
Definition: surfaceFieldValue.H:463
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_
static const Enum< regionTypes > regionTypeNames_
Region type names.
Definition: surfaceFieldValue.H:470
Foam::functionObjects::fieldValues::surfaceFieldValue::writeAll
label writeAll(const vectorField &Sf, const Field< WeightType > &weightField, const pointField &points, const faceList &faces)
Templated helper function to output field values.
Foam::functionObjects::fieldValues::surfaceFieldValue::regionType_
regionTypes regionType_
Region type.
Definition: surfaceFieldValue.H:598
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::functionObjects::fieldValues::surfaceFieldValue::regionType
regionTypes regionType() const noexcept
Return the region type.
Definition: surfaceFieldValueI.H:97
Foam::functionObjects::fieldValues::surfaceFieldValue::stObject
Calculate with function object surface.
Definition: surfaceFieldValue.H:465
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::functionObjects::fieldValues::surfaceFieldValue::withSurfaceFields
bool withSurfaceFields() const
Can the surface definition sample surface-fields?
Definition: surfaceFieldValueI.H:35
Foam::functionObjects::fieldValues::surfaceFieldValue::update
bool update()
Update the surface and surface information as required.
Definition: surfaceFieldValue.C:566
Foam::functionObjects::fieldValues::surfaceFieldValue::opMax
Maximum value.
Definition: surfaceFieldValue.H:488
Foam::functionObjects::fieldValues::surfaceFieldValue::typeAbsolute
Operation using mag (eg, for weighting)
Definition: surfaceFieldValue.H:478
Foam::Field< vector >
Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceWriterPtr_
autoPtr< surfaceWriter > surfaceWriterPtr_
Surface writer.
Definition: surfaceFieldValue.H:644
Foam::functionObjects::fieldValue::dict
const dictionary & dict() const noexcept
Return the reference to the construction dictionary.
Definition: fieldValueI.H:31
Foam::functionObjects::fieldValues::surfaceFieldValue::is_magOp
bool is_magOp() const noexcept
True if the operation variant uses mag.
Definition: surfaceFieldValueI.H:80
Foam::functionObjects::fieldValues::surfaceFieldValue::opWeightedAreaIntegrate
Weighted area integral.
Definition: surfaceFieldValue.H:524
Foam::functionObjects::fieldValues::surfaceFieldValue::withTopologicalMerge
bool withTopologicalMerge() const noexcept
Can use mesh topological merge?
Definition: surfaceFieldValueI.H:47
Foam::functionObjects::fieldValues::surfaceFieldValue::opSumDirection
Sum in a given direction.
Definition: surfaceFieldValue.H:491
Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
tmp< Field< Type > > getFieldValues(const word &fieldName, const bool mandatory=false) const
Return field values by looking up field name.
Foam::functionObjects::fieldValues::surfaceFieldValue::updateMesh
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
Definition: surfaceFieldValue.C:1376
Foam::functionObjects::fieldValues::surfaceFieldValue::opAreaNormalIntegrate
Area integral in normal direction (output is always scalar)
Definition: surfaceFieldValue.H:507
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes
regionTypes
Region type enumeration.
Definition: surfaceFieldValue.H:461
Foam::functionObjects::fieldValues::surfaceFieldValue::opSum
Sum of values.
Definition: surfaceFieldValue.H:489
field
rDeltaTY field()
Foam::functionObjects::fieldValues::surfaceFieldValue::selectionNames_
wordRes selectionNames_
Extended selections.
Definition: surfaceFieldValue.H:613
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::functionObjects::fieldValues::surfaceFieldValue::opWeightedSum
Weighted sum.
Definition: surfaceFieldValue.H:515
Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea_
scalar totalArea_
Total area of the surfaceFieldValue.
Definition: surfaceFieldValue.H:619
Foam::functionObjects::fieldValues::surfaceFieldValue::opAbsWeightedAverage
Average using abs weighting.
Definition: surfaceFieldValue.H:535
Foam::functionObjects::fieldValues::surfaceFieldValue::TypeName
TypeName("surfaceFieldValue")
Declare type-name, virtual type (with debug switch)
polySurfaceFieldsFwd.H
Foam::functionObjects::fieldValues::surfaceFieldValue::nFaces_
label nFaces_
Global number of faces.
Definition: surfaceFieldValue.H:622
Foam::functionObjects::fieldValues::surfaceFieldValue::opCoV
Coefficient of variation.
Definition: surfaceFieldValue.H:499
Foam::functionObjects::fieldValues::surfaceFieldValue::faceId_
labelList faceId_
Local list of face IDs.
Definition: surfaceFieldValue.H:628
Foam::functionObjects::fieldValues::surfaceFieldValue::opSumMag
Sum of component magnitudes.
Definition: surfaceFieldValue.H:490
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
surfaceMesh.H
Foam::functionObjects::fieldValues::surfaceFieldValue::faceFlip
const boolList & faceFlip() const noexcept
Return the local true/false list representing the face flip map.
Definition: surfaceFieldValueI.H:70
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::functionObjects::fieldValues::surfaceFieldValue::opWeightedAverage
Weighted average.
Definition: surfaceFieldValue.H:518
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::fieldValues::surfaceFieldValue::obr
const objectRegistry & obr() const
The volume mesh or surface registry being used.
Definition: surfaceFieldValue.C:120
Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
static tmp< scalarField > weightingFactor(const Field< WeightType > &weightField, const bool useMag)
Weighting factor.
Foam::functionObjects::fieldValues::surfaceFieldValue::faceId
const labelList & faceId() const noexcept
Return the local list of face IDs.
Definition: surfaceFieldValueI.H:54
Foam::functionObjects::fieldValues::surfaceFieldValue::facePatchId_
labelList facePatchId_
Local list of patch ID per face.
Definition: surfaceFieldValue.H:631
Foam::functionObjects::fieldValues::surfaceFieldValue::movePoints
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
Definition: surfaceFieldValue.C:1385
Foam::functionObjects::fieldValues::surfaceFieldValue::validField
bool validField(const word &fieldName) const
Return true if the field name is known and a valid type.
Definition: surfaceFieldValueTemplates.C:69
Foam::functionObjects::fieldValues::surfaceFieldValue::postOpMag
Component-wise mag after normal operation.
Definition: surfaceFieldValue.H:557
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::functionObjects::fieldValues::surfaceFieldValue::writeArea_
bool writeArea_
Optionally write the area of the surfaceFieldValue.
Definition: surfaceFieldValue.H:610
Foam::functionObjects::fieldValues::surfaceFieldValue::opAverage
Ensemble average.
Definition: surfaceFieldValue.H:496
Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_
static const Enum< operationType > operationTypeNames_
Operation type names.
Definition: surfaceFieldValue.H:550
fieldValue.H
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
Foam::Vector< scalar >
Foam::functionObjects::fieldValues::surfaceFieldValue::opAbsWeightedSum
Sum using abs weighting.
Definition: surfaceFieldValue.H:532
Foam::functionObjects::fieldValues::surfaceFieldValue::needsUpdate_
bool needsUpdate_
Track if the surface needs an update.
Definition: surfaceFieldValue.H:607
Foam::List< face >
Foam::functionObjects::fieldValue
Intermediate class for handling field value-based function objects.
Definition: fieldValue.H:119
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::functionObjects::fieldValues::surfaceFieldValue::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: surfaceFieldValue.C:627
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::functionObjects::fieldValues::surfaceFieldValue::opWeightedAreaAverage
Weighted area average.
Definition: surfaceFieldValue.H:521
Foam::functionObjects::fieldValues::surfaceFieldValue::postOpSqrt
Component-wise sqrt after normal operation.
Definition: surfaceFieldValue.H:558
Foam::functionObjects::fieldValues::surfaceFieldValue
A face regionType variant of the fieldValues function object.
Definition: surfaceFieldValue.H:452
Foam::functionObjects::fieldValues::surfaceFieldValue::sampledPtr_
autoPtr< sampledSurface > sampledPtr_
The sampledSurface (when operating on sampledSurface)
Definition: surfaceFieldValue.H:641
Foam::functionObjects::fieldValues::surfaceFieldValue::typeBase
Base operation.
Definition: surfaceFieldValue.H:475
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::functionObjects::fieldValues::surfaceFieldValue::opAreaNormalAverage
Area average in normal direction (output is always scalar)
Definition: surfaceFieldValue.H:504
Foam::functionObjects::fieldValues::surfaceFieldValue::stPatch
Calculate with patch(es)
Definition: surfaceFieldValue.H:464
Foam::functionObjects::fieldValues::surfaceFieldValue::areaWeightingFactor
static tmp< scalarField > areaWeightingFactor(const Field< WeightType > &weightField, const vectorField &Sf, const bool useMag)
Weighting factor, weight field with area factor.
Foam::functionObjects::fieldValues::surfaceFieldValue::outputDir
fileName outputDir() const
Return the output directory.
Definition: surfaceFieldValueI.H:105
Foam::functionObjects::fieldValues::surfaceFieldValue::operationVariant
operationVariant
Bitmask values for operation variants.
Definition: surfaceFieldValue.H:473
Foam::functionObjects::fieldValues::surfaceFieldValue::write
virtual bool write()
Calculate and write.
Definition: surfaceFieldValue.C:1231
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
bool writeValues(const word &fieldName, const vectorField &Sf, const Field< WeightType > &weightField, const pointField &points, const faceList &faces)
Templated helper function to output field values.
Definition: surfaceFieldValueTemplates.C:411
Foam::functionObjects::fieldValues::surfaceFieldValue::faceFlip_
boolList faceFlip_
List representing the face flip map.
Definition: surfaceFieldValue.H:635
Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
Type processValues(const Field< Type > &values, const vectorField &Sf, const Field< WeightType > &weightField) const
Apply the 'operation' to the values. Wrapper around.
Definition: surfaceFieldValueTemplates.C:318
Foam::functionObjects::fieldValues::surfaceFieldValue::opNone
No operation.
Definition: surfaceFieldValue.H:486
Foam::functionObjects::fieldValues::surfaceFieldValue::opAreaAverage
Area average.
Definition: surfaceFieldValue.H:497
Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_
static const Enum< postOperationType > postOperationTypeNames_
Operation type names.
Definition: surfaceFieldValue.H:562
surfaceFieldValueTemplates.C
Foam::functionObjects::fieldValues::surfaceFieldValue::usesSf
bool usesSf() const noexcept
True if the operation needs a surface Sf.
Definition: surfaceFieldValue.C:546
Foam::functionObjects::fieldValues::surfaceFieldValue::facePatch
const labelList & facePatch() const noexcept
Return the local list of patch ID per face.
Definition: surfaceFieldValueI.H:62
Enum.H