Loading...
Searching...
No Matches
mixedFaPatchField.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) 2023 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::mixedFaPatchField
29
30Description
31 This boundary condition provides a base class for 'mixed' type boundary
32 conditions, i.e. conditions that mix fixed value and patch-normal gradient
33 conditions.
34
35Usage
36 \table
37 Property | Description | Required | Default
38 refValue | fixed value | yes |
39 refGradient | patch normal gradient | yes |
40 valueFraction | value weighting (0-1) | yes |
41 \endtable
42
43Author
44 Zeljko Tukovic, FMENA
45 Hrvoje Jasak, Wikki Ltd.
46
47SourceFiles
48 mixedFaPatchField.C
49
50\*---------------------------------------------------------------------------*/
51
52#ifndef Foam_mixedFaPatchField_H
53#define Foam_mixedFaPatchField_H
54
55#include "faPatchField.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61
62/*---------------------------------------------------------------------------*\
63 Class mixedFaPatchField Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class Type>
68:
69 public faPatchField<Type>
70{
71 // Private Data
72
73 //- Value field
74 Field<Type> refValue_;
75
76 //- Normal gradient field
77 Field<Type> refGrad_;
78
79 //- Fraction (0-1) of value used for boundary condition
80 scalarField valueFraction_;
81
82protected:
83
84 //- Read the "refValue", "refGradient" and "valueFraction" entries
85 //- into their respective places.
86 // The reading can be optional (default), mandatory etc.
87 // If refValue is to be read, refGradient and valueFraction must
88 // also exist.
89 // \returns True on success
91 (
92 const dictionary& dict,
94 );
95
96
97public:
98
99 //- Runtime type information
100 TypeName("mixed");
101
102
103 // Constructors
104
105 //- Construct from patch and internal field
107 (
108 const faPatch&,
110 );
111
112 //- Construct from patch and internal field,
113 //- initialise as zero-gradient
115 (
116 const faPatch&,
118 const Foam::zero
119 );
120
121 //- Construct from patch, internal field and dictionary
123 (
124 const faPatch&,
130 );
131
132 //- Construct by mapping the given mixedFaPatchField onto a new patch
134 (
136 const faPatch&,
138 const faPatchFieldMapper&
139 );
140
141 //- Construct as copy
143 (
145 );
146
147 //- Construct as copy setting internal field reference
149 (
152 );
153
154 //- Return clone
155 virtual tmp<faPatchField<Type>> clone() const
156 {
157 return faPatchField<Type>::Clone(*this);
158 }
159
160 //- Clone with an internal field reference
162 (
164 ) const
165 {
166 return faPatchField<Type>::Clone(*this, iF);
167 }
168
169
170 // Member Functions
171
172 //- True: the patch field fixes a value.
173 virtual bool fixesValue() const { return true; }
174
175
176 // Return defining fields
177
178 virtual Field<Type>& refValue()
179 {
180 return refValue_;
181 }
182
183 virtual const Field<Type>& refValue() const
184 {
185 return refValue_;
186 }
187
188 virtual Field<Type>& refGrad()
189 {
190 return refGrad_;
191 }
192
193 virtual const Field<Type>& refGrad() const
194 {
195 return refGrad_;
196 }
197
198 virtual scalarField& valueFraction()
199 {
200 return valueFraction_;
201 }
202
203 virtual const scalarField& valueFraction() const
204 {
205 return valueFraction_;
206 }
207
208
209 // Mapping functions
210
211 //- Map (and resize as needed) from self given a mapping object
212 virtual void autoMap
213 (
214 const faPatchFieldMapper&
215 );
216
217 //- Reverse map the given faPatchField onto this faPatchField
218 virtual void rmap
219 (
220 const faPatchField<Type>&,
221 const labelList&
222 );
223
224
225 // Evaluation functions
226
227 //- Return gradient at boundary
228 virtual tmp<Field<Type>> snGrad() const;
229
230 //- Evaluate the patch field
231 virtual void evaluate
233 const Pstream::commsTypes commsType =
235 );
236
237 //- Return the matrix diagonal coefficients corresponding to the
238 // evaluation of the value of this patchField with given weights
240 (
241 const tmp<scalarField>&
242 ) const;
243
244 //- Return the matrix source coefficients corresponding to the
245 // evaluation of the value of this patchField with given weights
248 const tmp<scalarField>&
249 ) const;
250
251 //- Return the matrix diagonal coefficients corresponding to the
252 // evaluation of the gradient of this patchField
254
255 //- Return the matrix source coefficients corresponding to the
256 // evaluation of the gradient of this patchField
258
259
260 //- Write
261 virtual void write(Ostream&) const;
262
263
264 // Member Operators
265
266 virtual void operator=(const UList<Type>&) {}
267
268 virtual void operator=(const faPatchField<Type>&) {}
269 virtual void operator+=(const faPatchField<Type>&) {}
270 virtual void operator-=(const faPatchField<Type>&) {}
271 virtual void operator*=(const faPatchField<scalar>&) {}
272 virtual void operator/=(const faPatchField<scalar>&) {}
273
274 virtual void operator+=(const Field<Type>&) {}
275 virtual void operator-=(const Field<Type>&) {}
276
277 virtual void operator*=(const Field<scalar>&) {}
278 virtual void operator/=(const Field<scalar>&) {}
279
280 virtual void operator=(const Type&) {}
281 virtual void operator+=(const Type&) {}
282 virtual void operator-=(const Type&) {}
283 virtual void operator*=(const scalar) {}
284 virtual void operator/=(const scalar) {}
285};
286
287
288// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289
290} // End namespace Foam
291
292// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293
294#ifdef NoRepository
295 #include "mixedFaPatchField.C"
296#endif
297
298// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299
300#endif
301
302// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
constexpr Field() noexcept
Default construct.
Definition FieldI.H:24
readOption
Enumeration defining read preferences.
@ MUST_READ
Reading required.
@ LAZY_READ
Reading is optional [identical to READ_IF_PRESENT].
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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:89
commsTypes
Communications types.
Definition UPstream.H:81
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
Definition UPstream.H:82
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FieldMapper for finite-area patch fields.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
faPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
static tmp< faPatchField< Type > > Clone(const DerivedPatchField &pf)
Clone a patch field with its own internal field reference.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition faPatch.H:76
This boundary condition provides a base class for 'mixed' type boundary conditions,...
virtual tmp< faPatchField< Type > > clone() const
Return clone.
virtual void operator/=(const Field< scalar > &)
virtual bool fixesValue() const
True: the patch field fixes a value.
virtual const Field< Type > & refGrad() const
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator+=(const Field< Type > &)
virtual void operator-=(const faPatchField< Type > &)
virtual void rmap(const faPatchField< Type > &, const labelList &)
Reverse map the given faPatchField onto this faPatchField.
mixedFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
virtual void operator=(const Type &)
virtual void operator+=(const faPatchField< Type > &)
virtual void operator*=(const Field< scalar > &)
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator/=(const scalar)
virtual Field< Type > & refGrad()
virtual void operator=(const UList< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void operator-=(const Type &)
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual tmp< faPatchField< Type > > clone(const DimensionedField< Type, areaMesh > &iF) const
Clone with an internal field reference.
virtual const scalarField & valueFraction() const
virtual void operator=(const faPatchField< Type > &)
bool readMixedEntries(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "refValue", "refGradient" and "valueFraction" entries into their respective places.
virtual const Field< Type > & refValue() const
virtual Field< Type > & refValue()
TypeName("mixed")
Runtime type information.
virtual void operator*=(const scalar)
virtual void operator-=(const Field< Type > &)
virtual void operator+=(const Type &)
virtual scalarField & valueFraction()
virtual void operator*=(const faPatchField< scalar > &)
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
virtual void operator/=(const faPatchField< scalar > &)
A class for managing temporary objects.
Definition tmp.H:75
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68