GeometricField.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-2023 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::GeometricField
29 
30 Description
31  Generic GeometricField class.
32 
33 SourceFiles
34  GeometricFieldI.H
35  GeometricField.C
36  GeometricFieldFunctions.H
37  GeometricFieldFunctions.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Foam_GeometricField_H
42 #define Foam_GeometricField_H
43 
44 #include "regIOobject.H"
45 #include "GeometricBoundaryField.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class dictionary;
54 
55 template<class Type, template<class> class PatchField, class GeoMesh>
56 class GeometricField;
57 
58 template<class Type, template<class> class PatchField, class GeoMesh>
59 Ostream& operator<<
60 (
61  Ostream&,
62  const GeometricField<Type, PatchField, GeoMesh>&
63 );
64 
65 template<class Type, template<class> class PatchField, class GeoMesh>
66 Ostream& operator<<
67 (
68  Ostream&,
69  const tmp<GeometricField<Type, PatchField, GeoMesh>>&
70 );
71 
72 
73 /*---------------------------------------------------------------------------*\
74  Class GeometricField Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 template<class Type, template<class> class PatchField, class GeoMesh>
78 class GeometricField
79 :
80  public DimensionedField<Type, GeoMesh>
81 {
82 public:
83 
84  // Public Typedefs
85 
86  //- The mesh type for the GeometricField
87  typedef typename GeoMesh::Mesh Mesh;
88 
89  //- The boundary mesh type for the boundary fields
90  typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
91 
92  //- The internal field type from which this GeometricField is derived
94 
95  //- Type of boundary fields
97 
98  //- The patch field type for the GeometricBoundaryField
99  typedef PatchField<Type> Patch;
100 
101  //- Component type of the field elements
102  typedef typename Field<Type>::cmptType cmptType;
103 
105 private:
106 
107  // Private Data
108 
109  //- Current time index.
110  // Used to trigger the storing of the old-time value
111  mutable label timeIndex_;
112 
113  //- Pointer to old time field
114  mutable GeometricField<Type, PatchField, GeoMesh>* field0Ptr_;
115 
116  //- Pointer to previous iteration (used for under-relaxation)
117  mutable GeometricField<Type, PatchField, GeoMesh>* fieldPrevIterPtr_;
118 
119  //- Boundary field containing boundary field values
120  Boundary boundaryField_;
121 
122 
123  // Private Member Functions
124 
125  //- Read from file if it is present
126  bool readIfPresent();
127 
128  //- Read old time field from file if it is present
129  bool readOldTimeIfPresent();
130 
131  //- Read the field from the dictionary
132  void readFields(const dictionary& dict);
133 
134  //- Read the field - create the field dictionary on-the-fly
135  void readFields();
136 
137 public:
138 
139  //- Runtime type information
140  TypeName("GeometricField");
141 
142 
143  // Static Member Functions
144 
145  //- Return a null geometric field
146  inline static const GeometricField<Type, PatchField, GeoMesh>& null();
147 
148 
149  // Constructors
150 
151  //- Construct given IOobject, mesh, dimensions and patch type.
152  // This allocates storage for the field but does not set values.
153  // Used only within this class to create TEMPORARY variables
155  (
156  const IOobject& io,
157  const Mesh& mesh,
158  const dimensionSet& dims,
159  const word& patchFieldType = PatchField<Type>::calculatedType()
160  );
161 
162  //- Construct given IOobject, mesh, dimensions and patch types.
163  // This allocates storage for the field but does not set values.
164  // Used only within this class to create TEMPORARY variables
166  (
167  const IOobject& io,
168  const Mesh& mesh,
169  const dimensionSet& dims,
170  const wordList& wantedPatchTypes,
171  const wordList& actualPatchTypes = wordList()
172  );
173 
174  //- Construct given IOobject, mesh, dimensions, initial field value
175  //- and given patch type.
176  // This assigns both dimensions and values.
178  (
179  const IOobject& io,
180  const Mesh& mesh,
181  const Type& value,
182  const dimensionSet& dims,
183  const word& patchFieldType = PatchField<Type>::calculatedType()
184  );
185 
186  //- Construct given IOobject, mesh, dimensions, initial field value
187  //- and given patch types.
188  // This assigns both dimensions and values.
190  (
191  const IOobject& io,
192  const Mesh& mesh,
193  const Type& value,
194  const dimensionSet& dims,
195  const wordList& wantedPatchTypes,
196  const wordList& actualPatchTypes = wordList()
197  );
198 
199  //- Construct given IOobject, mesh, dimensioned<Type> and patch type.
200  // This assigns both dimensions and values.
201  // The name of the dimensioned<Type> has no influence.
203  (
204  const IOobject& io,
205  const Mesh& mesh,
206  const dimensioned<Type>& dt,
207  const word& patchFieldType = PatchField<Type>::calculatedType()
208  );
209 
210  //- Construct given IOobject, mesh, dimensioned<Type> and patch types.
211  // This assigns both dimensions and values.
212  // The name of the dimensioned<Type> has no influence.
214  (
215  const IOobject& io,
216  const Mesh& mesh,
217  const dimensioned<Type>& dt,
218  const wordList& wantedPatchTypes,
219  const wordList& actualPatchTypes = wordList()
220  );
221 
222  //- Copy construct from internal field and a patch list to clone
224  (
225  const IOobject& io,
226  const Internal& diField,
227  const PtrList<PatchField<Type>>& ptfl
228  );
229 
230  //- Move construct from internal field and a patch list to clone
232  (
233  const IOobject& io,
234  Internal&& diField,
235  const PtrList<PatchField<Type>>& ptfl
236  );
237 
238  //- Move construct from internal field and a patch list to clone
240  (
241  const IOobject& io,
242  const tmp<Internal>& tfield,
243  const PtrList<PatchField<Type>>& ptfl
244  );
245 
246  //- Copy construct from internal field and a patch list to clone
248  (
249  const Internal& diField,
250  const PtrList<PatchField<Type>>& ptfl
251  );
252 
253  //- Move construct from internal field and a patch list to clone
255  (
256  Internal&& diField,
257  const PtrList<PatchField<Type>>& ptfl
258  );
259 
260  //- Copy construct from internal field, with specified patch type
262  (
263  const IOobject& io,
264  const Mesh& mesh,
265  const dimensionSet& dims,
266  const Field<Type>& iField,
267  const word& patchFieldType = PatchField<Type>::calculatedType()
268  );
269 
270  //- Move construct from internal field, with specified patch type
272  (
273  const IOobject& io,
274  const Mesh& mesh,
275  const dimensionSet& dims,
276  Field<Type>&& iField,
277  const word& patchFieldType = PatchField<Type>::calculatedType()
278  );
279 
280  //- Copy construct from components
282  (
283  const IOobject& io,
284  const Mesh& mesh,
285  const dimensionSet& dims,
286  const Field<Type>& iField,
287  const PtrList<PatchField<Type>>& ptfl
288  );
289 
290  //- Move construct from internal field and a patch list to clone
292  (
293  const IOobject& io,
294  const Mesh& mesh,
295  const dimensionSet& dims,
296  Field<Type>&& iField,
297  const PtrList<PatchField<Type>>& ptfl
298  );
299 
300  //- Copy construct from components
302  (
303  const IOobject& io,
304  const Mesh& mesh,
305  const dimensionSet& dims,
306  const tmp<Field<Type>>& tiField,
307  const PtrList<PatchField<Type>>& ptfl
308  );
309 
310  //- Construct and read given IOobject
312  (
313  const IOobject& io,
314  const Mesh& mesh,
315  const bool readOldTime = true
316  );
317 
318  //- Construct from dictionary
320  (
321  const IOobject& io,
322  const Mesh& mesh,
323  const dictionary& dict
324  );
325 
326  //- Copy construct
328  (
330  );
331 
332  //- Construct from tmp<GeometricField> deleting argument
334  (
336  );
337 
338  //- Construct as copy resetting IO parameters
340  (
341  const IOobject& io,
343  );
344 
345  //- Construct from tmp<GeometricField> resetting IO parameters
347  (
348  const IOobject& io,
350  );
351 
352  //- Copy construct with a new name
354  (
355  const word& newName,
357  );
358 
359  //- Construct with a new name from tmp<GeometricField>
361  (
362  const word& newName,
364  );
365 
366  //- Construct as copy resetting IO parameters and patch type
368  (
369  const IOobject& io,
371  const word& patchFieldType
372  );
373 
374  //- Construct as copy resetting IO parameters and boundary type
375  //- for selected patchIDs
377  (
378  const IOobject& io,
380  const labelList& patchIDs,
381  const word& patchFieldType
382  );
383 
384  //- Construct as copy resetting IO parameters and boundary types
386  (
387  const IOobject& io,
389  const wordList& patchFieldTypes,
390  const wordList& actualPatchTypes = wordList()
391  );
392 
393  //- Construct as copy resetting IO parameters and boundary types
395  (
396  const IOobject& io,
398  const wordList& patchFieldTypes,
399  const wordList& actualPatchTypes = wordList()
400  );
401 
402  //- Clone
404 
405 
406  // Factory Methods
407 
408  //- Return tmp field from name, mesh, dimensions and patch type.
409  // The field is NO_READ, NO_WRITE, unregistered and uses the
410  // current timeName from the mesh registry
412  (
413  const word& name,
414  const Mesh& mesh,
415  const dimensionSet& dims,
416  const word& patchFieldType = PatchField<Type>::calculatedType()
417  );
418 
419  //- Return tmp field from name, mesh, dimensions,
420  //- copy of internal field, with specified patch type.
421  // The field is NO_READ, NO_WRITE, unregistered and uses the
422  // current timeName from the mesh registry
424  (
425  const word& name,
426  const Mesh& mesh,
427  const dimensionSet& dims,
428  const Field<Type>& iField,
429  const word& patchFieldType = PatchField<Type>::calculatedType()
430  );
431 
432  //- Return tmp field from name, mesh, dimensions,
433  //- moved internal field contents, with specified patch type.
434  // The field is NO_READ, NO_WRITE, unregistered and uses the
435  // current timeName from the mesh registry
437  (
438  const word& name,
439  const Mesh& mesh,
440  const dimensionSet& dims,
441  Field<Type>&& iField,
442  const word& patchFieldType = PatchField<Type>::calculatedType()
443  );
444 
445  //- Return tmp field from name, mesh, dimensions, initial field value
446  //- and patch type.
447  // The field is NO_READ, NO_WRITE, unregistered and uses the
448  // current timeName from the mesh registry
450  (
451  const word& name,
452  const Mesh& mesh,
453  const Type& value,
454  const dimensionSet& dims,
455  const word& patchFieldType = PatchField<Type>::calculatedType()
456  );
457 
458  //- Return tmp field from name, mesh, dimensioned<Type>
459  //- and patch types.
460  // The field is NO_READ, NO_WRITE, unregistered and uses the
461  // current timeName from the mesh registry
463  (
464  const word& name,
465  const Mesh& mesh,
466  const Type& value,
467  const dimensionSet& dims,
468  const wordList& patchFieldTypes,
469  const wordList& actualPatchTypes = wordList()
470  );
471 
472  //- Return tmp field from name, mesh, dimensioned<Type>
473  //- and patch type.
474  // The field is NO_READ, NO_WRITE, unregistered and uses the
475  // current timeName from the mesh registry
477  (
478  const word& name,
479  const Mesh& mesh,
480  const dimensioned<Type>& dt,
481  const word& patchFieldType = PatchField<Type>::calculatedType()
482  );
483 
484  //- Return tmp field from name, mesh, dimensioned<Type>
485  //- and patch types.
486  // The field is NO_READ, NO_WRITE, unregistered and uses the
487  // current timeName from the mesh registry
489  (
490  const word& name,
491  const Mesh& mesh,
492  const dimensioned<Type>& dt,
493  const wordList& patchFieldTypes,
494  const wordList& actualPatchTypes = wordList()
495  );
496 
497  //- Return renamed tmp field
498  // The field is NO_READ, NO_WRITE, unregistered and uses the
499  // current timeName from the mesh registry
501  (
502  const word& newName,
504  );
505 
506  //- Rename tmp field and reset patch field type
507  // The field is NO_READ, NO_WRITE, unregistered and uses the
508  // current timeName from the mesh registry
510  (
511  const word& newName,
513  const word& patchFieldType
514  );
515 
516  //- Rename tmp field and reset patch field types and return
517  // The field is NO_READ, NO_WRITE, unregistered and uses the
518  // current timeName from the mesh registry
520  (
521  const word& newName,
523  const wordList& patchFieldTypes,
524  const wordList& actualPatchTypes = wordList()
525  );
526 
527  //- Construct tmp field based on mesh/registry information from
528  //- an existing field.
529  // Created NO_READ, NO_WRITE, NO_REGISTER, using the instance
530  // from the field
531  template<class AnyType>
533  (
535  const word& name,
536  const dimensionSet& dims,
537  const word& patchFieldType = PatchField<Type>::calculatedType()
538  );
539 
540  //- Construct tmp field based on mesh/registry information from
541  //- an existing field and initialise with value.
542  // Created NO_READ, NO_WRITE, NO_REGISTER, using the instance
543  // from the field
544  template<class AnyType>
546  (
548  const word& name,
549  const dimensioned<Type>& dt,
550  const word& patchFieldType = PatchField<Type>::calculatedType()
551  );
552 
553 
554  //- Destructor
555  virtual ~GeometricField();
556 
557 
558  // Member Functions
559 
560  //- Return a const-reference to the dimensioned internal field.
561  inline const Internal& internalField() const noexcept;
562 
563  //- Return a reference to the dimensioned internal field.
564  // \param updateAccessTime update event counter and check
565  // old-time fields
566  //
567  // \note Should avoid using updateAccessTime = true within loops.
568  Internal& internalFieldRef(const bool updateAccessTime = true);
569 
570  //- Same as internalFieldRef()
571  Internal& ref(const bool updateAccessTime = true)
572  {
573  return this->internalFieldRef(updateAccessTime);
574  }
575 
576  //- Return a const-reference to the dimensioned internal field
577  //- of a "vol" field.
578  // Useful in the formulation of source-terms for FV equations
579  //
580  // \note definition in finiteVolume/fields/volFields/volFieldsI.H
581  inline const Internal& v() const;
582 
583  //- Return a const-reference to the internal field values.
584  inline const typename Internal::FieldType& primitiveField()
585  const noexcept;
586 
587  //- Return a reference to the internal field values.
588  // \param updateAccessTime update event counter and check
589  // old-time fields
590  //
591  // \note Should avoid using updateAccessTime = true within loops.
593  (
594  const bool updateAccessTime = true
595  );
596 
597  //- Return const-reference to the boundary field
598  inline const Boundary& boundaryField() const noexcept;
599 
600  //- Return a reference to the boundary field
601  // \param updateAccessTime update event counter and check
602  // old-time fields
603  //
604  // \note Should avoid using updateAccessTime = true within loops.
605  Boundary& boundaryFieldRef(const bool updateAccessTime = true);
606 
607  //- Return the time index of the field
608  inline label timeIndex() const noexcept;
609 
610  //- Write-access to the time index of the field
611  inline label& timeIndex() noexcept;
612 
613  //- Store the old-time fields
614  void storeOldTimes() const;
615 
616  //- Store the old-time field
617  void storeOldTime() const;
618 
619  //- Return the number of old time fields stored
620  label nOldTimes() const;
621 
622  //- Return old time field
623  const GeometricField<Type, PatchField, GeoMesh>& oldTime() const;
624 
625  //- Return non-const old time field
626  // (Not a good idea but it is used for sub-cycling)
627  GeometricField<Type, PatchField, GeoMesh>& oldTime();
628 
629  //- Store the field as the previous iteration value
630  void storePrevIter() const;
631 
632  //- Return previous iteration field
633  const GeometricField<Type, PatchField, GeoMesh>& prevIter() const;
634 
635  //- Correct boundary field
637 
638  //- Does the field need a reference level for solution
639  bool needReference() const;
640 
641  //- Return a component of the field
643  (
644  const direction
645  ) const;
646 
647  //- WriteData member function required by regIOobject
648  bool writeData(Ostream&) const;
649 
650  //- Return transpose (only if it is a tensor field)
651  tmp<GeometricField<Type, PatchField, GeoMesh>> T() const;
652 
653  //- Relax field (for steady-state solution).
654  // alpha = 1 : no relaxation
655  // alpha < 1 : relaxation
656  // alpha = 0 : do nothing
657  void relax(const scalar alpha);
658 
659  //- Relax field (for steady-state solution).
660  // alpha is read from controlDict
661  void relax();
662 
663  //- Select the final iteration parameters if \c final is true
664  //- by returning the field name + "Final"
665  //- otherwise the standard parameters by returning the field name
666  word select(bool final) const;
667 
668  //- Helper function to write the min and max to an Ostream
669  void writeMinMax(Ostream& os) const;
670 
671 
672  // Member Function *this Operators
673 
674  //- Negate the field inplace. See notes in Field
675  void negate();
676 
677  //- Normalise the field inplace. See notes in Field
678  void normalise();
679 
680  //- Replace specified field component with content from another field
681  void replace
682  (
683  const direction d,
684  const GeometricField<cmptType, PatchField, GeoMesh>& gcf
685  );
686 
687  //- Replace specified field component with specified value
688  void replace
689  (
690  const direction d,
691  const dimensioned<cmptType>& ds
692  );
693 
694  //- Impose lower (floor) clamp on the field values (in-place)
695  void clamp_min(const Type& lower);
696 
697  //- Impose upper (ceiling) clamp on the field values (in-place)
698  void clamp_max(const Type& upper);
699 
700  //- Impose lower (floor) clamp on the field values (in-place)
701  // No dimension checking
702  void clamp_min(const dimensioned<Type>& lower);
703 
704  //- Impose upper (ceiling) clamp on the field values (in-place)
705  // No dimension checking
706  void clamp_max(const dimensioned<Type>& upper);
707 
708  //- Clamp field values (in-place) to the specified range.
709  // Does not check if range is valid or not. No dimension checking.
710  void clamp_range(const dimensioned<MinMax<Type>>& range);
711 
712  //- Clamp field values (in-place) to the specified range.
713  // Does not check if range is valid or not.
714  void clamp_range(const Type& lower, const Type& upper);
715 
716  //- Clamp field values (in-place) to the specified range.
717  // Does not check if range is valid or not.
718  void clamp_range(const MinMax<Type>& range);
719 
720  //- Clamp field values (in-place) to the specified range.
721  // Does not check if range is valid or not. No dimension checking.
722  void clamp_range
723  (
724  const dimensioned<Type>& lower,
725  const dimensioned<Type>& upper
726  );
727 
728 
729  // Member Operators
730 
731  //- Return a const-reference to the dimensioned internal field.
732  //- Same as internalField().
733  // Useful in the formulation of source-terms for FV equations
734  const Internal& operator()() const { return *this; }
735 
738  void operator=(const dimensioned<Type>&);
739 
741  void operator==(const dimensioned<Type>&);
742 
745 
748 
751 
754 
755  void operator+=(const dimensioned<Type>&);
756  void operator-=(const dimensioned<Type>&);
757 
758  void operator*=(const dimensioned<scalar>&);
759  void operator/=(const dimensioned<scalar>&);
760 
761 
762  // Ostream Operators
763 
764  friend Ostream& operator<< <Type, PatchField, GeoMesh>
765  (
766  Ostream&,
768  );
769 
770  friend Ostream& operator<< <Type, PatchField, GeoMesh>
771  (
772  Ostream&,
774  );
775 
776 
777  // Housekeeping
778 
779  //- Clamp field values (in-place) to the specified range.
780  // \deprecated(2023-01) prefer clamp_range() naming
781  void clip(const dimensioned<MinMax<Type>>& range)
782  {
783  this->clamp_range(range);
784  }
785 
786  //- Clamp field values (in-place) to the specified range.
787  // \deprecated(2023-01) prefer clamp_range() naming
788  void clip(const dimensioned<Type>& lo, const dimensioned<Type>& hi)
789  {
790  this->clamp_range(lo.value(), hi.value());
791  }
792 
793  //- Use minimum of the field and specified value. ie, clamp_max().
794  // This sets the \em ceiling on the field values
795  // \deprecated(2023-01) prefer clamp_max()
796  void min(const dimensioned<Type>& upper) { this->clamp_max(upper); }
797 
798  //- Use maximum of the field and specified value. ie, clamp_min().
799  // This sets the \em floor on the field values
800  // \deprecated(2023-01) prefer clamp_min()
801  void max(const dimensioned<Type>& lower) { this->clamp_min(lower); }
802 
803  //- Deprecated(2019-01) identical to clamp_range()
804  // \deprecated(2019-01) identical to clamp_range()
805  FOAM_DEPRECATED_FOR(2019-01, "clamp_range() method")
806  void maxMin(const dimensioned<Type>& lo, const dimensioned<Type>& hi)
807  {
808  return this->clamp_range(lo.value(), hi.value());
809  }
810 };
811 
812 
813 template<class Type, template<class> class PatchField, class GeoMesh>
814 Ostream& operator<<
815 (
816  Ostream&,
817  const typename GeometricField<Type, PatchField, GeoMesh>::
818  Boundary&
819 );
820 
821 
822 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
823 
824 } // End namespace Foam
825 
826 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
827 
828 #include "GeometricFieldI.H"
829 
830 #ifdef NoRepository
831  #include "GeometricField.C"
832 #endif
833 
834 #include "GeometricFieldFunctions.H"
835 
836 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
837 
838 #endif
839 
840 // ************************************************************************* //
void clamp_min(const Type &lower)
Impose lower (floor) clamp on the field values (in-place)
void clamp_range(const dimensioned< MinMax< Type >> &range)
Clamp field values (in-place) to the specified range.
dictionary dict
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
const GeometricField< Type, PatchField, GeoMesh > & oldTime() const
Return old time field.
uint8_t direction
Definition: direction.H:48
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
GeoMesh::BoundaryMesh BoundaryMesh
The boundary mesh type for the boundary fields.
void operator=(const GeometricField< Type, PatchField, GeoMesh > &)
void maxMin(const dimensioned< Type > &lo, const dimensioned< Type > &hi)
Deprecated(2019-01) identical to clamp_range()
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
bool writeData(Ostream &) const
WriteData member function required by regIOobject.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:162
Field< Type >::cmptType cmptType
Component type of the field elements.
MESH::BoundaryMesh BoundaryMesh
Definition: GeoMesh.H:59
const Internal & internalField() const noexcept
Return a const-reference to the dimensioned internal field.
pTraits< Type >::cmptType cmptType
Component type.
Definition: Field.H:123
A min/max value pair with additional methods. In addition to conveniently storing values...
Definition: HashSet.H:72
GeometricField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Construct given IOobject, mesh, dimensions and patch type.
void operator/=(const GeometricField< scalar, PatchField, GeoMesh > &)
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
GeoMesh::Mesh Mesh
The mesh type for the GeometricField.
void clip(const dimensioned< MinMax< Type >> &range)
Clamp field values (in-place) to the specified range.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Definition: stringOps.C:1186
TypeName("GeometricField")
Runtime type information.
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
GeometricBoundaryField< Type, PatchField, GeoMesh > Boundary
Type of boundary fields.
Generic dimensioned Type class.
label nOldTimes() const
Return the number of old time fields stored.
DimensionedField< Type, GeoMesh > Internal
The internal field type from which this GeometricField is derived.
Field< Type > FieldType
Type of the field from which this DimensionedField is derived.
word select(bool final) const
Select the final iteration parameters if final is true by returning the field name + "Final" otherwis...
scalar range
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
const word calculatedType
A calculated patch field type.
bool needReference() const
Does the field need a reference level for solution.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
const Internal & v() const
Return a const-reference to the dimensioned internal field of a "vol" field.
Definition: volFieldsI.H:26
void storeOldTimes() const
Store the old-time fields.
Generic templated field type.
Definition: Field.H:62
A class for handling words, derived from Foam::string.
Definition: word.H:63
void storeOldTime() const
Store the old-time field.
void operator*=(const GeometricField< scalar, PatchField, GeoMesh > &)
void operator+=(const GeometricField< Type, PatchField, GeoMesh > &)
void writeMinMax(Ostream &os) const
Helper function to write the min and max to an Ostream.
void min(const dimensioned< Type > &upper)
Use minimum of the field and specified value. ie, clamp_max().
GeoMesh::Mesh Mesh
Type of mesh on which this DimensionedField is instantiated.
void negate()
Negate the field inplace. See notes in Field.
const Mesh & mesh() const noexcept
Return mesh.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
const direction noexcept
Definition: Scalar.H:258
Internal & internalFieldRef(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
tmp< GeometricField< Type, PatchField, GeoMesh > > T() const
Return transpose (only if it is a tensor field)
void operator-=(const GeometricField< Type, PatchField, GeoMesh > &)
void normalise()
Normalise the field inplace. See notes in Field.
const GeometricField< Type, PatchField, GeoMesh > & prevIter() const
Return previous iteration field.
OBJstream os(runTime.globalPath()/outputName)
MESH Mesh
Definition: GeoMesh.H:58
virtual ~GeometricField()
Destructor.
Generic GeometricBoundaryField class.
Definition: areaFieldsFwd.H:46
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))
static const GeometricField< Type, PatchField, GeoMesh > & null()
Return a null geometric field.
void clamp_max(const Type &upper)
Impose upper (ceiling) clamp on the field values (in-place)
List< word > wordList
List of word.
Definition: fileName.H:58
void operator==(const tmp< GeometricField< Type, PatchField, GeoMesh >> &)
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
tmp< GeometricField< Type, PatchField, GeoMesh > > clone() const
Clone.
label timeIndex() const noexcept
Return the time index of the field.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Definition: stringOps.C:1170
PatchField< Type > Patch
The patch field type for the GeometricBoundaryField.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
void max(const dimensioned< Type > &lower)
Use maximum of the field and specified value. ie, clamp_min().
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
friend Ostream & operator(Ostream &, const GeometricField< Type, PatchField, GeoMesh > &)
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
void storePrevIter() const
Store the field as the previous iteration value.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:42
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
A class for managing temporary objects.
Definition: HashPtrTable.H:50
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Return tmp field from name, mesh, dimensions and patch type.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:171
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
void relax()
Relax field (for steady-state solution).
Namespace for OpenFOAM.
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.