mixedFvPatchField.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) 2019 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::mixedFvPatchField
29
30Group
31 grpGenericBoundaryConditions
32
33Description
34 This boundary condition provides a base class for 'mixed' type boundary
35 conditions, i.e. conditions that mix fixed value and patch-normal gradient
36 conditions.
37
38 The respective contributions from each is determined by a weight field:
39
40 \f[
41 x_p = w x_p + (1-w) \left(x_c + \frac{\nabla_\perp x}{\Delta}\right)
42 \f]
43
44 where
45 \vartable
46 x_p | patch values
47 x_c | patch internal cell values
48 \Delta| inverse distance from face centre to internal cell centre
49 w | weighting values (0-1)
50 \endvartable
51
52
53Usage
54 \table
55 Property | Description | Required | Default
56 refValue | fixed value | yes |
57 refGradient | patch normal gradient | yes |
58 valueFraction | value weighting (0-1) | yes |
59 \endtable
60
61Note
62 This condition is not usually applied directly; instead, use a derived
63 mixed condition such as \c inletOutlet
64
65See also
66 Foam::inletOutletFvPatchField
67
68SourceFiles
69 mixedFvPatchField.C
70
71\*---------------------------------------------------------------------------*/
72
73#ifndef mixedFvPatchField_H
74#define mixedFvPatchField_H
75
76#include "fvPatchField.H"
77
78// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79
80namespace Foam
81{
82
83/*---------------------------------------------------------------------------*\
84 Class mixedFvPatchField Declaration
85\*---------------------------------------------------------------------------*/
86
87template<class Type>
88class mixedFvPatchField
89:
90 public fvPatchField<Type>
91{
92 // Private data
93
94 //- Value field
95 Field<Type> refValue_;
96
97 //- Normal gradient field
98 Field<Type> refGrad_;
99
100 //- Fraction (0-1) of value used for boundary condition
101 scalarField valueFraction_;
102
103 //- Source field
104 Field<Type> source_;
105
106
107public:
108
109 //- Runtime type information
110 TypeName("mixed");
111
112
113 // Constructors
114
115 //- Construct from patch and internal field
117 (
118 const fvPatch&,
119 const DimensionedField<Type, volMesh>&
120 );
121
122 //- Construct from patch, internal field and dictionary
124 (
125 const fvPatch&,
127 const dictionary&
128 );
129
130 //- Construct by mapping the given mixedFvPatchField onto a new patch
132 (
134 const fvPatch&,
136 const fvPatchFieldMapper&
137 );
138
139 //- Construct as copy
141 (
143 );
144
145 //- Construct and return a clone
146 virtual tmp<fvPatchField<Type>> clone() const
147 {
149 (
150 new mixedFvPatchField<Type>(*this)
151 );
152 }
153
154 //- Construct as copy setting internal field reference
156 (
159 );
160
161 //- Construct and return a clone setting internal field reference
163 (
165 ) const
166 {
168 (
169 new mixedFvPatchField<Type>(*this, iF)
170 );
171 }
172
173
174 // Member functions
175
176 // Access
177
178 //- Return true if this patch field fixes a value.
179 // Needed to check if a level has to be specified while solving
180 // Poissons equations.
181 virtual bool fixesValue() const
182 {
183 return true;
184 }
185
186 //- Return false: this patch field is not altered by assignment
187 virtual bool assignable() const
188 {
189 return false;
190 }
191
192
193 // Return defining fields
194
195 virtual Field<Type>& refValue()
196 {
197 return refValue_;
198 }
199
200 virtual const Field<Type>& refValue() const
201 {
202 return refValue_;
203 }
204
205 virtual Field<Type>& refGrad()
206 {
207 return refGrad_;
208 }
209
210 virtual const Field<Type>& refGrad() const
211 {
212 return refGrad_;
213 }
214
215 virtual scalarField& valueFraction()
217 return valueFraction_;
218 }
219
220 virtual const scalarField& valueFraction() const
221 {
222 return valueFraction_;
223 }
224
225 virtual Field<Type>& source()
226 {
227 return source_;
228 }
229
230 virtual const Field<Type>& source() const
231 {
232 return source_;
233 }
234
236 // Mapping functions
237
238 //- Map (and resize as needed) from self given a mapping object
239 virtual void autoMap
241 const fvPatchFieldMapper&
242 );
243
244 //- Reverse map the given fvPatchField onto this fvPatchField
245 virtual void rmap
246 (
247 const fvPatchField<Type>&,
248 const labelList&
249 );
251
252 // Evaluation functions
253
254 //- Return gradient at boundary
255 virtual tmp<Field<Type>> snGrad() const;
256
257 //- Evaluate the patch field
258 virtual void evaluate
259 (
260 const Pstream::commsTypes commsType =
262 );
263
264 //- Return the matrix diagonal coefficients corresponding to the
265 // evaluation of the value of this patchField with given weights
267 (
268 const tmp<scalarField>&
269 ) const;
270
271 //- Return the matrix source coefficients corresponding to the
272 // evaluation of the value of this patchField with given weights
274 (
275 const tmp<scalarField>&
276 ) const;
277
278 //- Return the matrix diagonal coefficients corresponding to the
279 // evaluation of the gradient of this patchField
281
282 //- Return the matrix source coefficients corresponding to the
283 // evaluation of the gradient of this patchField
285
286
287 //- Write
288 virtual void write(Ostream&) const;
289
290
291 // Member operators
292
293 virtual void operator=(const UList<Type>&) {}
294
295 virtual void operator=(const fvPatchField<Type>&) {}
296 virtual void operator+=(const fvPatchField<Type>&) {}
297 virtual void operator-=(const fvPatchField<Type>&) {}
298 virtual void operator*=(const fvPatchField<scalar>&) {}
299 virtual void operator/=(const fvPatchField<scalar>&) {}
300
301 virtual void operator+=(const Field<Type>&) {}
302 virtual void operator-=(const Field<Type>&) {}
303
304 virtual void operator*=(const Field<scalar>&) {}
305 virtual void operator/=(const Field<scalar>&) {}
306
307 virtual void operator=(const Type&) {}
308 virtual void operator+=(const Type&) {}
309 virtual void operator-=(const Type&) {}
310 virtual void operator*=(const scalar) {}
311 virtual void operator/=(const scalar) {}
312};
313
314
315// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316
317} // End namespace Foam
318
319// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320
321#ifdef NoRepository
322 #include "mixedFvPatchField.C"
323#endif
324
325// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
326
327#endif
329// ************************************************************************* //
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
commsTypes
Types of communications.
Definition: UPstream.H:67
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a base class for 'mixed' type boundary conditions,...
virtual void operator/=(const Field< scalar > &)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual bool fixesValue() const
Return true if this patch field fixes a value.
mixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
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 Type &)
virtual void operator*=(const Field< scalar > &)
virtual void operator+=(const fvPatchField< Type > &)
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual void operator/=(const fvPatchField< scalar > &)
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
virtual void operator=(const fvPatchField< Type > &)
virtual void operator*=(const fvPatchField< scalar > &)
virtual void operator/=(const scalar)
virtual Field< Type > & refGrad()
virtual void operator-=(const fvPatchField< Type > &)
virtual void operator=(const UList< Type > &)
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual const Field< Type > & source() const
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
virtual void operator-=(const Type &)
virtual const scalarField & valueFraction() const
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual const Field< Type > & refValue() const
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual bool assignable() const
Return false: this patch field is not altered by assignment.
virtual Field< Type > & refValue()
TypeName("mixed")
Runtime type information.
virtual void operator*=(const scalar)
virtual Field< Type > & source()
virtual void operator-=(const Field< Type > &)
virtual void operator+=(const Type &)
virtual scalarField & valueFraction()
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73