faePatchField.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-2017 Wikki Ltd
9 Copyright (C) 2019-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::faePatchField
29
30Description
31 faePatchField<Type> abstract base class. This class gives a fat-interface
32 to all derived classes covering all possible ways in which they might be
33 used. The first level of derivation is to basic patchFields which cover
34 zero-gradient, fixed-gradient, fixed-value and mixed conditions. The next
35 level of derivation covers all the specialised typed with specific
36 evaluation procedures, particularly with respect to specific fields.
37
38Author
39 Zeljko Tukovic, FMENA
40 Hrvoje Jasak, Wikki Ltd.
41
42SourceFiles
43 faePatchField.C
44 newPatchField.C
45
46\*---------------------------------------------------------------------------*/
47
48#ifndef Foam_faePatchField_H
49#define Foam_faePatchField_H
50
51#include "faPatch.H"
52#include "DimensionedField.H"
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55
56namespace Foam
57{
58
59// Forward Declarations
60
61class objectRegistry;
62class dictionary;
63class faPatchFieldMapper;
64class edgeMesh;
65
66template<class Type>
67class faePatchField;
68
69template<class Type>
70class calculatedFaePatchField;
71
72template<class Type>
74
75
76/*---------------------------------------------------------------------------*\
77 Class faePatchField Declaration
78\*---------------------------------------------------------------------------*/
79
80template<class Type>
81class faePatchField
82:
83 public Field<Type>
84{
85 // Private Data
86
87 //- Reference to a patch
88 const faPatch& patch_;
89
90 //- Reference to internal field
91 const DimensionedField<Type, edgeMesh>& internalField_;
92
93
94public:
95
96 //- The internal field type associated with the patch field
98
99 //- The patch type for the patch field
100 typedef faPatch Patch;
101
102 //- Type for a \em calculated patch
104
105
106 //- Runtime type information
107 TypeName("faePatchField");
108
109 //- Debug switch to disallow the use of
111
112
113 // Declare run-time constructor selection tables
116 (
117 tmp,
119 patch,
120 (
121 const faPatch& p,
123 ),
124 (p, iF)
125 );
128 (
129 tmp,
131 patchMapper,
132 (
133 const faePatchField<Type>& ptf,
134 const faPatch& p,
136 const faPatchFieldMapper& m
137 ),
138 (dynamic_cast<const faePatchFieldType&>(ptf), p, iF, m)
139 );
142 (
143 tmp,
146 (
147 const faPatch& p,
149 const dictionary& dict
150 ),
151 (p, iF, dict)
152 );
153
154
155 // Constructors
156
157 //- Construct from patch and internal field
159 (
160 const faPatch&,
162 );
163
164 //- Construct from patch and internal field and patch field
166 (
167 const faPatch&,
169 const Field<Type>&
170 );
171
172 //- Construct from patch, internal field and dictionary
174 (
175 const faPatch&,
177 const dictionary&
178 );
179
180 //- Construct by mapping the given faePatchField onto a new patch
182 (
183 const faePatchField<Type>&,
184 const faPatch&,
186 const faPatchFieldMapper&
187 );
188
189 //- Construct as copy
191
192 //- Construct and return a clone
193 virtual tmp<faePatchField<Type>> clone() const
194 {
196 }
197
198 //- Construct as copy setting internal field reference
200 (
201 const faePatchField<Type>&,
203 );
204
205 //- Construct and return a clone setting internal field reference
207 (
209 ) const
210 {
212 (
213 new faePatchField<Type>(*this, iF)
214 );
215 }
216
217
218 //- Destructor
219 virtual ~faePatchField() = default;
220
221
222 // Selectors
223
224 //- Return a pointer to a new patchField created on freestore given
225 // patch and internal field
226 // (does not set the patch field values)
228 (
229 const word& patchFieldType,
230 const faPatch&,
232 );
233
234 //- Return a pointer to a new patchField created on freestore given
235 // patch and internal field
236 // (does not set the patch field values)
237 // Allows override of constraint type
239 (
240 const word& patchFieldType,
241 const word& actualPatchType,
242 const faPatch&,
244 );
245
246 //- Return a pointer to a new patchField created on freestore from
247 // a given faePatchField mapped onto a new patch
249 (
250 const faePatchField<Type>&,
251 const faPatch&,
253 const faPatchFieldMapper&
254 );
255
256 //- Return a pointer to a new patchField created on freestore
257 // from dictionary
259 (
260 const faPatch&,
262 const dictionary&
263 );
264
265 //- Return a pointer to a new calculatedFaePatchField created on
266 // freestore without setting patchField values
267 template<class Type2>
269 (
271 );
272
273
274 // Member functions
275
276 // Access
277
278 //- Return local objectRegistry
279 const objectRegistry& db() const;
280
281 //- Return patch
282 const faPatch& patch() const
283 {
284 return patch_;
285 }
286
287 //- Return dimensioned internal field reference
289 {
290 return internalField_;
291 }
292
293 //- Return internal field reference
294 const Field<Type>& primitiveField() const
295 {
296 return internalField_;
297 }
298
299 //- Return the type of the calculated for of faePatchField
300 static const word& calculatedType();
301
302 //- Return true if this patch field fixes a value.
303 // Needed to check if a level has to be specified while solving
304 // Poissons equations.
305 virtual bool fixesValue() const
306 {
307 return false;
308 }
309
310 //- Return true if this patch field is coupled
311 virtual bool coupled() const
312 {
313 return false;
314 }
315
316
317 // Mapping functions
318
319 //- Map (and resize as needed) from self given a mapping object
320 virtual void autoMap
321 (
322 const faPatchFieldMapper&
323 );
324
325 //- Reverse map the given faePatchField onto this faePatchField
326 virtual void rmap
327 (
328 const faePatchField<Type>&,
329 const labelList&
330 );
331
332
333 //- Write
334 virtual void write(Ostream&) const;
335
336
337 // Check
338
339 //- Check faePatchField<Type> against given faePatchField<Type>
340 void check(const faePatchField<Type>&) const;
341
342
343 // Member operators
344
345 virtual void operator=(const UList<Type>&);
346
347 virtual void operator=(const faePatchField<Type>&);
348 virtual void operator+=(const faePatchField<Type>&);
349 virtual void operator-=(const faePatchField<Type>&);
350 virtual void operator*=(const faePatchField<scalar>&);
351 virtual void operator/=(const faePatchField<scalar>&);
352
353 virtual void operator+=(const Field<Type>&);
354 virtual void operator-=(const Field<Type>&);
355
356 virtual void operator*=(const Field<scalar>&);
357 virtual void operator/=(const Field<scalar>&);
358
359 virtual void operator=(const Type&);
360 virtual void operator+=(const Type&);
361 virtual void operator-=(const Type&);
362 virtual void operator*=(const scalar);
363 virtual void operator/=(const scalar);
364
365
366 // Force an assignment irrespective of form of patch
367
368 virtual void operator==(const faePatchField<Type>&);
369 virtual void operator==(const Field<Type>&);
370 virtual void operator==(const Type&);
371
372
373 // Ostream operator
375 friend Ostream& operator<< <Type>(Ostream&, const faePatchField<Type>&);
376};
377
378
379// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
380
381} // End namespace Foam
382
383// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
384
385#ifdef NoRepository
386 #include "faePatchField.C"
388#endif
389
391#define makeFaePatchTypeFieldTypeName(typePatchTypeField) \
392 \
393defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0);
395#define makeFaePatchFieldsTypeName(typePatchField) \
396 \
397makeFaePatchTypeFieldTypeName(typePatchField##FaePatchScalarField); \
398makeFaePatchTypeFieldTypeName(typePatchField##FaePatchVectorField); \
399makeFaePatchTypeFieldTypeName(typePatchField##FaePatchSphericalTensorField); \
400makeFaePatchTypeFieldTypeName(typePatchField##FaePatchSymmTensorField); \
401makeFaePatchTypeFieldTypeName(typePatchField##FaePatchTensorField);
402
404#define makeFaePatchTypeField(PatchTypeField, typePatchTypeField) \
405 \
406defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \
407 \
408addToRunTimeSelectionTable \
409( \
410 PatchTypeField, typePatchTypeField, patch \
411); \
412 \
413addToRunTimeSelectionTable \
414( \
415 PatchTypeField, \
416 typePatchTypeField, \
417 patchMapper \
418); \
419 \
420addToRunTimeSelectionTable \
421( \
422 PatchTypeField, typePatchTypeField, dictionary \
423);
424
426#define makeFaePatchFields(type) \
427 \
428makeFaePatchTypeField(faePatchScalarField, type##FaePatchScalarField); \
429makeFaePatchTypeField(faePatchVectorField, type##FaePatchVectorField); \
430makeFaePatchTypeField \
431( \
432 faePatchSphericalTensorField, \
433 type##FaePatchSphericalTensorField \
434); \
435makeFaePatchTypeField(faePatchSymmTensorField, type##FaePatchSymmTensorField); \
436makeFaePatchTypeField(faePatchTensorField, type##FaePatchTensorField);
437
439#define makeFaePatchTypeFieldTypedefs(type) \
440 \
441typedef type##FaePatchField<scalar> type##FaePatchScalarField; \
442typedef type##FaePatchField<vector> type##FaePatchVectorField; \
443typedef type##FaePatchField<sphericalTensor> \
444 type##FaePatchSphericalTensorField; \
445typedef type##FaePatchField<symmTensor> type##FaePatchSymmTensorField; \
446typedef type##FaePatchField<tensor> type##FaePatchTensorField;
447
448
449// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
450
451#endif
452
453// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-area patch fields.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
Definition: faePatchField.H:83
virtual void operator+=(const faePatchField< Type > &)
virtual bool fixesValue() const
Return true if this patch field fixes a value.
declareRunTimeSelectionTable(tmp, faePatchField, patch,(const faPatch &p, const DimensionedField< Type, edgeMesh > &iF),(p, iF))
calculatedFaePatchField< Type > Calculated
Type for a calculated patch.
declareRunTimeSelectionTable(tmp, faePatchField, patchMapper,(const faePatchField< Type > &ptf, const faPatch &p, const DimensionedField< Type, edgeMesh > &iF, const faPatchFieldMapper &m),(dynamic_cast< const faePatchFieldType & >(ptf), p, iF, m))
TypeName("faePatchField")
Runtime type information.
virtual bool coupled() const
Return true if this patch field is coupled.
virtual void operator*=(const faePatchField< scalar > &)
const DimensionedField< Type, edgeMesh > & internalField() const
Return dimensioned internal field reference.
faPatch Patch
The patch type for the patch field.
Definition: faePatchField.H:99
const faPatch & patch() const
Return patch.
virtual void operator==(const faePatchField< Type > &)
virtual tmp< faePatchField< Type > > clone(const DimensionedField< Type, edgeMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual ~faePatchField()=default
Destructor.
const objectRegistry & db() const
Return local objectRegistry.
virtual void operator=(const UList< Type > &)
const Field< Type > & primitiveField() const
Return internal field reference.
void check(const faePatchField< Type > &) const
Check faePatchField<Type> against given faePatchField<Type>
DimensionedField< Type, edgeMesh > Internal
The internal field type associated with the patch field.
Definition: faePatchField.H:96
virtual tmp< faePatchField< Type > > clone() const
Construct and return a clone.
static tmp< faePatchField< Type > > New(const word &patchFieldType, const faPatch &, const DimensionedField< Type, edgeMesh > &)
Return a pointer to a new patchField created on freestore given.
virtual void operator/=(const faePatchField< scalar > &)
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void operator-=(const faePatchField< Type > &)
virtual void rmap(const faePatchField< Type > &, const labelList &)
Reverse map the given faePatchField onto this faePatchField.
static tmp< faePatchField< Type > > NewCalculatedType(const faePatchField< Type2 > &)
Return a pointer to a new calculatedFaePatchField created on.
declareRunTimeSelectionTable(tmp, faePatchField, dictionary,(const faPatch &p, const DimensionedField< Type, edgeMesh > &iF, const dictionary &dict),(p, iF, dict))
static const word & calculatedType()
Return the type of the calculated for of faePatchField.
static int disallowGenericFaePatchField
Debug switch to disallow the use of.
Registry of regIOobjects.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
runTime write()
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73