Loading...
Searching...
No Matches
fixedGradientFaPatchField.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::fixedGradientFaPatchField
29
30Description
31 This boundary condition supplies a fixed gradient condition, such that
32 the patch values are calculated using:
33
34 \f[
35 x_p = x_c + \frac{\nabla(x)}{\Delta}
36 \f]
37
38 where
39 \vartable
40 x_p | patch values
41 x_c | internal field values
42 \nabla(x)| gradient (user-specified)
43 \Delta | inverse distance from patch face centre to cell centre
44 \endvartable
45
46Usage
47 \table
48 Property | Description | Required | Default value
49 gradient | gradient | yes |
50 \endtable
51
52 Example of the boundary condition specification:
53 \verbatim
54 <patchName>
55 {
56 type fixedGradient;
57 gradient uniform 0;
58 }
59 \endverbatim
60
61Author
62 Zeljko Tukovic, FMENA
63 Hrvoje Jasak, Wikki Ltd.
64
65SourceFiles
66 fixedGradientFaPatchField.C
67
68\*---------------------------------------------------------------------------*/
69
70#ifndef Foam_fixedGradientFaPatchField_H
71#define Foam_fixedGradientFaPatchField_H
72
73#include "faPatchField.H"
74
75// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76
77namespace Foam
78{
79
80/*---------------------------------------------------------------------------*\
81 Class fixedGradientFaPatch Declaration
82\*---------------------------------------------------------------------------*/
83
84template<class Type>
86:
87 public faPatchField<Type>
88{
89 // Private Data
90
91 Field<Type> gradient_;
92
93protected:
94
95 // Protected Member Functions
96
97 //- Read the "gradient" entry into corresponding member
98 // The reading can be optional (default), mandatory etc.
99 // \returns True on success
101 (
102 const dictionary& dict,
104 );
105
106public:
107
108 //- Runtime type information
109 TypeName("fixedGradient");
110
111
112 // Constructors
113
114 //- Construct from patch and internal field
116 (
117 const faPatch&,
119 );
120
121 //- Construct from patch, internal field and dictionary.
123 (
124 const faPatch&,
126 const dictionary& dict,
129 );
130
131 //- Construct by mapping the given fixedGradient patch field
132 //- 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 //- The reference gradient at boundary
173 virtual Field<Type>& gradient() noexcept
174 {
175 return gradient_;
176 }
177
178 //- The reference gradient at boundary
179 virtual const Field<Type>& gradient() const noexcept
180 {
181 return gradient_;
182 }
183
184
185 // Mapping functions
186
187 //- Map (and resize as needed) from self given a mapping object
188 virtual void autoMap
189 (
190 const faPatchFieldMapper&
191 );
192
193 //- Reverse map the given faPatchField onto this faPatchField
194 virtual void rmap
195 (
196 const faPatchField<Type>&,
197 const labelList&
198 );
199
200
201 // Evaluation functions
202
203 //- Return gradient at boundary
204 virtual tmp<Field<Type>> snGrad() const
205 {
206 return gradient_;
207 }
208
209 //- Evaluate the patch field
210 virtual void evaluate
211 (
212 const Pstream::commsTypes commsType =
214 );
216
217 //- Return the matrix diagonal coefficients corresponding to the
218 // evaluation of the value of this patchField with given weights
220 (
221 const tmp<scalarField>&
222 ) const;
224 //- Return the matrix source coefficients corresponding to the
225 // evaluation of the value of this patchField with given weights
227 (
228 const tmp<scalarField>&
229 ) const;
230
231 //- Return the matrix diagonal coefficients corresponding to the
232 // evaluation of the gradient of this patchField
234
235 //- Return the matrix source coefficients corresponding to the
236 // evaluation of the gradient of this patchField
238
239
240 //- Write
241 virtual void write(Ostream&) const;
242};
243
244
245// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246
247} // End namespace Foam
248
249// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250
251#ifdef NoRepository
253#endif
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257#endif
258
259// ************************************************************************* //
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
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 supplies a fixed gradient condition, such that the patch values are calculate...
virtual tmp< faPatchField< Type > > clone() const
Return clone.
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
virtual Field< Type > & gradient() noexcept
The reference gradient at boundary.
virtual void rmap(const faPatchField< Type > &, const labelList &)
Reverse map the given faPatchField onto this faPatchField.
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
fixedGradientFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
TypeName("fixedGradient")
Runtime type information.
bool readGradientEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "gradient" entry into corresponding member.
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.
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 Field< Type > & gradient() const noexcept
The reference gradient at boundary.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68