mappedFieldFvPatchField.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 | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::mappedFieldFvPatchField
26 
27 Group
28  grpGenericBoundaryConditions grpCoupledBoundaryConditions
29 
30 Description
31  This boundary condition provides a self-contained version of the \c mapped
32  condition. It does not use information on the patch; instead it holds
33  thr data locally.
34 
35 Usage
36  \table
37  Property | Description | Required | Default value
38  fieldName | name of field to be mapped | no | this field name
39  setAverage | flag to activate setting of average value | yes |
40  average | average value to apply if \c setAverage = yes | yes |
41  \endtable
42 
43  Example of the boundary condition specification:
44  \verbatim
45  <patchName>
46  {
47  type mappedField;
48  fieldName T; // optional field name
49  setAverage no; // apply an average value
50  average 0; // average to apply if setAverage
51  value uniform 0; // place holder
52  }
53  \endverbatim
54 
55 Note
56  Since this condition can be applied on a per-field and per-patch basis,
57  it is possible to duplicate the mapping information. If possible, employ
58  the \c mapped condition in preference to avoid this situation, and only
59  employ this condition if it is not possible to change the underlying
60  geometric (poly) patch type to \c mapped.
61 
62 See also
63  Foam::mappedPatchBase
64  Foam::mappedPolyPatch
65  Foam::mappedFvPatch
66  Foam::fixedValueFvPatchField
67 
68 SourceFiles
69  mappedFieldFvPatchField.C
70 
71 \*---------------------------------------------------------------------------*/
72 
73 #ifndef mappedFieldFvPatchField_H
74 #define mappedFieldFvPatchField_H
75 
76 #include "mappedPatchBase.H"
77 #include "mappedPatchFieldBase.H"
79 #include "interpolation.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class mappedFieldFvPatchField Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 template<class Type>
91 class mappedFieldFvPatchField
92 :
93  public fixedValueFvPatchField<Type>,
94  public mappedPatchBase,
95  public mappedPatchFieldBase<Type>
96 {
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("mappedField");
102 
103 
104  // Constructors
105 
106  //- Construct from patch and internal field
108  (
109  const fvPatch&,
111  );
112 
113  //- Construct from patch, internal field and dictionary
115  (
116  const fvPatch&,
118  const dictionary&
119  );
120 
121  //- Construct from patch, internal field and distance for normal type
122  // sampling
124  (
125  const fvPatch&,
127 
128  // mappedPatchBase
129  const word& sampleRegion,
130  const sampleMode sampleMode,
131  const word& samplePatch,
132  const scalar distance,
133 
134  // My settings
135  const word& fieldName,
136  const bool setAverage,
137  const Type average,
138  const word& interpolationScheme
139  );
140 
141  //- Construct by mapping given
142  // mappedFieldFvPatchField
143  // onto a new patch
145  (
147  const fvPatch&,
149  const fvPatchFieldMapper&
150  );
151 
152  //- Construct as copy
154  (
156  );
157 
158  //- Construct and return a clone
159  virtual tmp<fvPatchField<Type>> clone() const
160  {
161  return tmp<fvPatchField<Type>>
162  (
164  (
165  *this
166  )
167  );
168  }
169 
170  //- Construct as copy setting internal field reference
172  (
175  );
176 
177  //- Construct and return a clone setting internal field reference
179  (
181  ) const
182  {
183  return tmp<fvPatchField<Type>>
184  (
186  (
187  *this,
188  iF
189  )
190  );
191  }
192 
193 
194  // Member functions
195 
196  // Mapping functions
197 
198  //- Map (and resize as needed) from self given a mapping object
199  virtual void autoMap
200  (
201  const fvPatchFieldMapper&
202  );
203 
204  //- Reverse map the given fvPatchField onto this fvPatchField
205  virtual void rmap
206  (
207  const fvPatchField<Type>&,
208  const labelList&
209  );
210 
211 
212  // Evaluation functions
213 
214  //- Update the coefficients associated with the patch field
215  virtual void updateCoeffs();
216 
217 
218  //- Write
219  virtual void write(Ostream&) const;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
230  #include "mappedFieldFvPatchField.C"
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
TypeName("mappedField")
Runtime type information.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
sampleMode
Mesh items to sample.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
This boundary condition provides a self-contained version of the mapped condition. It does not use information on the patch; instead it holds thr data locally.
virtual void write(Ostream &) const
Write.
A class for managing temporary objects.
Definition: PtrList.H:53
mappedFieldFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const word & sampleRegion() const
Region to sample.
Namespace for OpenFOAM.