fixedGradientFvPatchField.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-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::fixedGradientFvPatchField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 This boundary condition supplies a fixed gradient condition, such that
34 the patch values are calculated using:
35
36 \f[
37 x_p = x_c + \frac{\nabla(x)}{\Delta}
38 \f]
39
40 where
41 \vartable
42 x_p | patch values
43 x_c | internal field values
44 \nabla(x)| gradient (user-specified)
45 \Delta | inverse distance from patch face centre to cell centre
46 \endvartable
47
48Usage
49 \table
50 Property | Description | Required | Default value
51 gradient | gradient | yes |
52 \endtable
53
54 Example of the boundary condition specification:
55 \verbatim
56 <patchName>
57 {
58 type fixedGradient;
59 gradient uniform 0;
60 }
61 \endverbatim
62
63SourceFiles
64 fixedGradientFvPatchField.C
65
66\*---------------------------------------------------------------------------*/
67
68#ifndef fixedGradientFvPatchField_H
69#define fixedGradientFvPatchField_H
70
71#include "fvPatchField.H"
72
73// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74
75namespace Foam
76{
77
78/*---------------------------------------------------------------------------*\
79 Class fixedGradientFvPatchField Declaration
80\*---------------------------------------------------------------------------*/
81
82template<class Type>
83class fixedGradientFvPatchField
84:
85 public fvPatchField<Type>
86{
87 // Private data
88
89 Field<Type> gradient_;
90
91
92public:
93
94 //- Runtime type information
95 TypeName("fixedGradient");
96
97
98 // Constructors
99
100 //- Construct from patch and internal field
102 (
103 const fvPatch&,
104 const DimensionedField<Type, volMesh>&
105 );
106
107 //- Construct from patch, internal field and dictionary
109 (
110 const fvPatch&,
112 const dictionary&
113 );
114
115 //- Construct by mapping the given fixedGradientFvPatchField
116 // onto a new patch
118 (
120 const fvPatch&,
122 const fvPatchFieldMapper&
123 );
124
125 //- Construct as copy
127 (
129 );
130
131 //- Construct and return a clone
132 virtual tmp<fvPatchField<Type>> clone() const
133 {
135 (
137 );
138 }
139
140 //- Construct as copy setting internal field reference
142 (
145 );
146
147 //- Construct and return a clone setting internal field reference
149 (
151 ) const
152 {
154 (
156 );
158
159
160 // Member functions
161
162 // Return defining fields
163
164 //- Return gradient at boundary
165 virtual Field<Type>& gradient()
166 {
167 return gradient_;
168 }
169
170 virtual const Field<Type>& gradient() const
171 {
172 return gradient_;
174
175
176 // Mapping functions
177
178 //- Map (and resize as needed) from self given a mapping object
179 virtual void autoMap
180 (
181 const fvPatchFieldMapper&
182 );
183
184 //- Reverse map the given fvPatchField onto this fvPatchField
185 virtual void rmap
186 (
187 const fvPatchField<Type>&,
188 const labelList&
189 );
191
192 // Evaluation functions
193
194 //- Return gradient at boundary
195 virtual tmp<Field<Type>> snGrad() const
196 {
197 return gradient_;
198 }
199
200 //- Evaluate the patch field
201 virtual void evaluate
202 (
203 const Pstream::commsTypes commsType =
205 );
206
207 //- Return the matrix diagonal coefficients corresponding to the
208 // evaluation of the value of this patchField with given weights
210 (
211 const tmp<scalarField>&
212 ) const;
213
214 //- Return the matrix source coefficients corresponding to the
215 // evaluation of the value of this patchField with given weights
217 (
218 const tmp<scalarField>&
219 ) const;
221 //- Return the matrix diagonal coefficients corresponding to the
222 // evaluation of the gradient of this patchField
224
225 //- Return the matrix source coefficients corresponding to the
226 // evaluation of the gradient of this patchField
228
229
230 //- Write
231 virtual void write(Ostream&) const;
232};
233
234
235// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236
237} // End namespace Foam
238
239// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240
241#ifdef NoRepository
243#endif
244
245// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246
247#endif
248
249// ************************************************************************* //
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
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
This boundary condition supplies a fixed gradient condition, such that the patch values are calculate...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual Field< Type > & gradient()
Return gradient at boundary.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
TypeName("fixedGradient")
Runtime type information.
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
fixedGradientFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual const Field< Type > & gradient() const
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Construct and return a clone setting internal field reference.
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
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73