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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::fixedGradientFaPatchField
28 
29 Description
30 
31 Author
32  Zeljko Tukovic, FMENA
33  Hrvoje Jasak, Wikki Ltd.
34 
35 SourceFiles
36  fixedGradientFaPatchField.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef fixedGradientFaPatchField_H
41 #define fixedGradientFaPatchField_H
42 
43 #include "faPatchField.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class fixedGradientFaPatch Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
56 :
57  public faPatchField<Type>
58 {
59  // Private data
60 
61  Field<Type> gradient_;
62 
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("fixedGradient");
68 
69 
70  // Constructors
71 
72  //- Construct from patch and internal field
74  (
75  const faPatch&,
77  );
78 
79  //- Construct from patch, internal field and dictionary
81  (
82  const faPatch&,
84  const dictionary&
85  );
86 
87  //- Construct by mapping the given fixedGradientFaPatchField<Type>
88  // onto a new patch
90  (
92  const faPatch&,
94  const faPatchFieldMapper&
95  );
96 
97  //- Construct as copy
99  (
101  );
102 
103  //- Construct and return a clone
104  virtual tmp<faPatchField<Type>> clone() const
105  {
106  return tmp<faPatchField<Type>>
107  (
109  );
110  }
111 
112  //- Construct as copy setting internal field reference
114  (
117  );
118 
119  //- Construct and return a clone setting internal field reference
121  (
123  ) const
124  {
125  return tmp<faPatchField<Type>>
126  (
127  new fixedGradientFaPatchField<Type>(*this, iF)
128  );
129  }
130 
131 
132  // Member functions
133 
134  // Return defining fields
135 
136  //- Return gradient at boundary
137  virtual Field<Type>& gradient()
138  {
139  return gradient_;
140  }
141 
142  virtual const Field<Type>& gradient() const
143  {
144  return gradient_;
145  }
146 
147 
148  // Mapping functions
149 
150  //- Map (and resize as needed) from self given a mapping object
151  virtual void autoMap
152  (
153  const faPatchFieldMapper&
154  );
155 
156  //- Reverse map the given faPatchField onto this faPatchField
157  virtual void rmap
158  (
159  const faPatchField<Type>&,
160  const labelList&
161  );
162 
163 
164  // Evaluation functions
165 
166  //- Return gradient at boundary
167  virtual tmp<Field<Type>> snGrad() const
168  {
169  return gradient_;
170  }
171 
172  //- Evaluate the patch field
173  virtual void evaluate
174  (
175  const Pstream::commsTypes commsType =
177  );
178 
179 
180  //- Return the matrix diagonal coefficients corresponding to the
181  // evaluation of the value of this patchField with given weights
183  (
184  const tmp<scalarField>&
185  ) const;
186 
187  //- Return the matrix source coefficients corresponding to the
188  // evaluation of the value of this patchField with given weights
190  (
191  const tmp<scalarField>&
192  ) const;
193 
194  //- Return the matrix diagonal coefficients corresponding to the
195  // evaluation of the gradient of this patchField
196  virtual tmp<Field<Type>> gradientInternalCoeffs() const;
197 
198  //- Return the matrix source coefficients corresponding to the
199  // evaluation of the gradient of this patchField
200  virtual tmp<Field<Type>> gradientBoundaryCoeffs() const;
201 
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #ifdef NoRepository
215  #include "fixedGradientFaPatchField.C"
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
Foam::fixedGradientFaPatchField::gradientInternalCoeffs
virtual tmp< Field< Type > > gradientInternalCoeffs() const
Return the matrix diagonal coefficients corresponding to the.
Definition: fixedGradientFaPatchField.C:166
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
fixedGradientFaPatchField.C
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fixedGradientFaPatchField::TypeName
TypeName("fixedGradient")
Runtime type information.
Foam::fixedGradientFaPatchField::write
virtual void write(Ostream &) const
Write.
Definition: fixedGradientFaPatchField.C:181
Foam::fixedGradientFaPatchField::fixedGradientFaPatchField
fixedGradientFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Definition: fixedGradientFaPatchField.C:34
faPatchField.H
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
Foam::fixedGradientFaPatchField::gradient
virtual const Field< Type > & gradient() const
Definition: fixedGradientFaPatchField.H:141
Foam::fixedGradientFaPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
Definition: fixedGradientFaPatchField.C:126
Foam::fixedGradientFaPatchField::gradient
virtual Field< Type > & gradient()
Return gradient at boundary.
Definition: fixedGradientFaPatchField.H:136
Foam::fixedGradientFaPatchField::valueBoundaryCoeffs
virtual tmp< Field< Type > > valueBoundaryCoeffs(const tmp< scalarField > &) const
Return the matrix source coefficients corresponding to the.
Definition: fixedGradientFaPatchField.C:156
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::fixedGradientFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: fixedGradientFaPatchField.H:54
Foam::fixedGradientFaPatchField::autoMap
virtual void autoMap(const faPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fixedGradientFaPatchField.C:100
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::fixedGradientFaPatchField::valueInternalCoeffs
virtual tmp< Field< Type > > valueInternalCoeffs(const tmp< scalarField > &) const
Return the matrix diagonal coefficients corresponding to the.
Definition: fixedGradientFaPatchField.C:145
Foam::fixedGradientFaPatchField::clone
virtual tmp< faPatchField< Type > > clone() const
Construct and return a clone.
Definition: fixedGradientFaPatchField.H:103
Foam::List< label >
Foam::fixedGradientFaPatchField::rmap
virtual void rmap(const faPatchField< Type > &, const labelList &)
Reverse map the given faPatchField onto this faPatchField.
Definition: fixedGradientFaPatchField.C:111
Foam::fixedGradientFaPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
Definition: fixedGradientFaPatchField.H:166
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::UPstream::commsTypes::blocking
Foam::fixedGradientFaPatchField::gradientBoundaryCoeffs
virtual tmp< Field< Type > > gradientBoundaryCoeffs() const
Return the matrix source coefficients corresponding to the.
Definition: fixedGradientFaPatchField.C:174