GeometricBoundaryField.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,2022 OpenFOAM Foundation
9  Copyright (C) 2015-2022 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::GeometricBoundaryField
29 
30 Description
31  Generic GeometricBoundaryField class.
32 
33 SourceFiles
34  GeometricBoundaryField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_GeometricBoundaryField_H
39 #define Foam_GeometricBoundaryField_H
40 
41 #include "dimensionedTypes.H"
42 #include "DimensionedField.H"
43 #include "FieldField.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 /*---------------------------------------------------------------------------*\
59  Class GeometricBoundaryField Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class Type, template<class> class PatchField, class GeoMesh>
63 class GeometricBoundaryField
64 :
65  public FieldField<PatchField, Type>
66 {
67 public:
68 
69  // Public Typedefs
70 
71  //- The boundary mesh type for the boundary fields
72  typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
73 
74  //- The internal field type associated with the boundary fields
76 
77  //- The patch field type for the boundary fields
78  typedef PatchField<Type> Patch;
79 
80 
81 private:
82 
83  // Private Data
84 
85  //- Reference to BoundaryMesh for which this field is defined
86  const BoundaryMesh& bmesh_;
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct from a BoundaryMesh, setting patches later
94  explicit GeometricBoundaryField(const BoundaryMesh& bmesh);
95 
96  //- Construct from a BoundaryMesh, reference to the internal field
97  //- and a patch type
99  (
100  const BoundaryMesh& bmesh,
102  const word& patchFieldType = PatchField<Type>::calculatedType()
103  );
104 
105  //- Construct from a BoundaryMesh, reference to the internal field
106  //- and a wordList of patch types and optional the actual patch
107  //- types (to override constraint patches)
109  (
110  const BoundaryMesh& bmesh,
112  const wordList& wantedPatchTypes,
113  const wordList& actualPatchTypes = wordList()
114  );
115 
116  //- Construct from a BoundaryMesh, reference to the internal field
117  //- and a PtrList<PatchField<Type>> (to be cloned)
119  (
120  const BoundaryMesh& bmesh,
122  const PtrList<PatchField<Type>>& ptfl
123  );
124 
125  //- Construct as copy, setting the reference to the internal field
127  (
130  );
131 
132  //- Construct as copy, setting the reference to the internal field
133  //- and resetting type of field for given patch IDs
135  (
138  const labelList& patchIDs,
139  const word& patchFieldName
140  );
141 
142  //- Copy construct
143  // Dangerous because Field may be set to a field which gets deleted
144  // Need new type of BoundaryField, one which is part of a geometric
145  // field for which snGrad etc. may be called and a free standing
146  // BoundaryField for which such operations are unavailable.
148 
149  //- Construct from dictionary
151  (
152  const BoundaryMesh& bmesh,
154  const dictionary& dict
155  );
156 
157 
158  // Member Functions
159 
160  //- Read the boundary field
161  void readField
162  (
164  const dictionary& dict
165  );
166 
167  //- Update the boundary condition coefficients
168  void updateCoeffs();
169 
170  //- Evaluate boundary conditions
171  void evaluate();
172 
173  //- Evaluate boundary conditions on a subset of coupled patches
174  template<class CoupledPatchType>
175  void evaluateCoupled();
176 
177  //- Return a list of the patch types
178  wordList types() const;
179 
180  //- Return boundary field of values neighbouring the boundary
182 
183  //- Return a list of pointers for each patch field with only those
184  //- pointing to interfaces being set
186 
187  //- Return a list of pointers for each patch field with only those
188  //- pointing to interfaces being set
190 
191  //- Write boundary field as dictionary entry
192  void writeEntry(const word& keyword, Ostream& os) const;
193 
194  //- Write dictionary entries of the individual boundary fields.
195  void writeEntries(Ostream& os) const;
196 
197 
198  // Member Operators
199 
200  //- Copy assignment from GeometricBoundaryField
201  void operator=(const GeometricBoundaryField& bf);
202 
203  //- Copy assignment from FieldField<PatchField, Type>
204  void operator=(const FieldField<PatchField, Type>& bf);
205 
206  //- Assignment to uniform value
207  void operator=(const Type& val);
208 
209  //- Forced assignment from GeometricBoundaryField
210  void operator==(const GeometricBoundaryField& bf);
211 
212  //- Forced assignment from FieldField<PatchField, Type>
214 
215  //- Forced assignment to uniform value
216  void operator==(const Type& val);
217 };
218 
219 
220 template<class Type, template<class> class PatchField, class GeoMesh>
221 Ostream& operator<<
222 (
223  Ostream&,
225 );
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #ifdef NoRepository
235  #include "GeometricBoundaryField.C"
236 #endif
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
dictionary dict
PatchField< Type > Patch
The patch field type for the boundary fields.
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
rDeltaTY field()
GeometricBoundaryField(const BoundaryMesh &bmesh)
Construct from a BoundaryMesh, setting patches later.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
MESH::BoundaryMesh BoundaryMesh
Definition: GeoMesh.H:59
lduInterfaceFieldPtrsList scalarInterfaces() const
Return a list of pointers for each patch field with only those pointing to interfaces being set...
wordList types() const
Return a list of the patch types.
const word calculatedType
A calculated patch field type.
void evaluate()
Evaluate boundary conditions.
GeoMesh::BoundaryMesh BoundaryMesh
The boundary mesh type for the boundary fields.
A class for handling words, derived from Foam::string.
Definition: word.H:63
void operator==(const GeometricBoundaryField &bf)
Forced assignment from GeometricBoundaryField.
void operator=(const GeometricBoundaryField &bf)
Copy assignment from GeometricBoundaryField.
void evaluateCoupled()
Evaluate boundary conditions on a subset of coupled patches.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:100
void updateCoeffs()
Update the boundary condition coefficients.
DimensionedField< Type, GeoMesh > Internal
The internal field type associated with the boundary fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
OBJstream os(runTime.globalPath()/outputName)
Generic GeometricBoundaryField class.
Definition: areaFieldsFwd.H:46
List< word > wordList
List of word.
Definition: fileName.H:58
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
void writeEntry(const word &keyword, Ostream &os) const
Write boundary field as dictionary entry.
void readField(const DimensionedField< Type, GeoMesh > &field, const dictionary &dict)
Read the boundary field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
LduInterfaceFieldPtrsList< Type > interfaces() const
Return a list of pointers for each patch field with only those pointing to interfaces being set...
GeometricBoundaryField boundaryInternalField() const
Return boundary field of values neighbouring the boundary.
void writeEntries(Ostream &os) const
Write dictionary entries of the individual boundary fields.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
Definition: GeoMesh.H:42
List of coupled interface fields to be used in coupling.
Namespace for OpenFOAM.