mappedFieldFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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 Description
28  This boundary condition provides a self-contained version of the \c mapped
29  condition. It does not use information on the patch; instead it holds
30  thr data locally.
31 
32 Usage
33  \table
34  Property | Description | Required | Default value
35  fieldName | name of field to be mapped | no | this field name
36  setAverage | flag to activate setting of average value | yes |
37  average | average value to apply if \c setAverage = yes | yes |
38  \endtable
39 
40  Example of the boundary condition specification:
41  \verbatim
42  <patchName>
43  {
44  type mappedField;
45  fieldName T; // optional field name
46  setAverage no; // apply an average value
47  average 0; // average to apply if setAverage
48  value uniform 0; // place holder
49  }
50  \endverbatim
51 
52 Note
53  Since this condition can be applied on a per-field and per-patch basis,
54  it is possible to duplicate the mapping information. If possible, employ
55  the \c mapped condition in preference to avoid this situation, and only
56  employ this condition if it is not possible to change the underlying
57  geometric (poly) patch type to \c mapped.
58 
59 See also
60  Foam::mappedPatchBase
61  Foam::mappedPolyPatch
62  Foam::mappedFvPatch
63  Foam::fixedValueFvPatchField
64 
65 SourceFiles
66  mappedFieldFvPatchField.C
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef mappedFieldFvPatchField_H
71 #define mappedFieldFvPatchField_H
72 
73 #include "mappedPatchBase.H"
74 #include "mappedPatchFieldBase.H"
76 #include "interpolation.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 
83 /*---------------------------------------------------------------------------*\
84  Class mappedFieldFvPatchField Declaration
85 \*---------------------------------------------------------------------------*/
86 
87 template<class Type>
88 class mappedFieldFvPatchField
89 :
90  public fixedValueFvPatchField<Type>,
91  public mappedPatchBase,
92  public mappedPatchFieldBase<Type>
93 {
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("mappedField");
99 
100 
101  // Constructors
102 
103  //- Construct from patch and internal field
105  (
106  const fvPatch&,
108  );
109 
110  //- Construct from patch, internal field and dictionary
112  (
113  const fvPatch&,
115  const dictionary&
116  );
117 
118  //- Construct from patch, internal field and distance for normal type
119  // sampling
121  (
122  const fvPatch&,
124 
125  // mappedPatchBase
126  const word& sampleRegion,
127  const sampleMode sampleMode,
128  const word& samplePatch,
129  const scalar distance,
130 
131  // My settings
132  const word& fieldName,
133  const bool setAverage,
134  const Type average,
135  const word& interpolationScheme
136  );
137 
138  //- Construct by mapping given
139  // mappedFieldFvPatchField
140  // onto a new patch
142  (
144  const fvPatch&,
146  const fvPatchFieldMapper&
147  );
148 
149  //- Construct as copy
151  (
153  );
154 
155  //- Construct and return a clone
156  virtual tmp<fvPatchField<Type>> clone() const
157  {
158  return tmp<fvPatchField<Type>>
159  (
161  (
162  *this
163  )
164  );
165  }
166 
167  //- Construct as copy setting internal field reference
169  (
172  );
173 
174  //- Construct and return a clone setting internal field reference
176  (
178  ) const
179  {
180  return tmp<fvPatchField<Type>>
181  (
183  (
184  *this,
185  iF
186  )
187  );
188  }
189 
190 
191  // Member functions
192 
193  // Mapping functions
194 
195  //- Map (and resize as needed) from self given a mapping object
196  virtual void autoMap
197  (
198  const fvPatchFieldMapper&
199  );
200 
201  //- Reverse map the given fvPatchField onto this fvPatchField
202  virtual void rmap
203  (
204  const fvPatchField<Type>&,
205  const labelList&
206  );
207 
208 
209  // Evaluation functions
210 
211  //- Update the coefficients associated with the patch field
212  virtual void updateCoeffs();
213 
214 
215  //- Write
216  virtual void write(Ostream&) const;
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #ifdef NoRepository
227  #include "mappedFieldFvPatchField.C"
228 #endif
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
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.