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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::mappedFieldFvPatchField
29 
30 Group
31  grpGenericBoundaryConditions grpCoupledBoundaryConditions
32 
33 Description
34  This boundary condition provides a self-contained version of the \c mapped
35  condition. It does not use information on the patch; instead it holds
36  the data locally.
37 
38 Usage
39  \table
40  Property | Description | Required | Default
41  field | Name of field to be mapped | no | this field name
42  setAverage | Use average value | no | false |
43  average | Average value to use if \c setAverage = yes | partly |
44  \endtable
45 
46  Example of the boundary condition specification:
47  \verbatim
48  <patchName>
49  {
50  type mappedField;
51  field T; // optional field name
52  setAverage no; // apply an average value
53  average 0; // average to apply if setAverage
54  value uniform 0; // place holder
55  }
56  \endverbatim
57 
58 Note
59  Since this condition can be applied on a per-field and per-patch basis,
60  it is possible to duplicate the mapping information. If possible, employ
61  the \c mapped condition in preference to avoid this situation, and only
62  employ this condition if it is not possible to change the underlying
63  geometric (poly) patch type to \c mapped.
64 
65 See also
66  Foam::mappedPatchBase
67  Foam::mappedPolyPatch
68  Foam::mappedFvPatch
69  Foam::fixedValueFvPatchField
70 
71 SourceFiles
72  mappedFieldFvPatchField.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef mappedFieldFvPatchField_H
77 #define mappedFieldFvPatchField_H
78 
79 #include "mappedPatchBase.H"
80 #include "mappedPatchFieldBase.H"
82 #include "interpolation.H"
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class mappedFieldFvPatchField Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 template<class Type>
94 class mappedFieldFvPatchField
95 :
96  public fixedValueFvPatchField<Type>,
97  public mappedPatchBase,
98  public mappedPatchFieldBase<Type>
99 {
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("mappedField");
105 
106 
107  // Constructors
108 
109  //- Construct from patch and internal field
111  (
112  const fvPatch&,
114  );
115 
116  //- Construct from patch, internal field and dictionary
118  (
119  const fvPatch&,
121  const dictionary&
122  );
123 
124  //- Construct from patch, internal field and distance for normal type
125  // sampling
127  (
128  const fvPatch&,
130 
131  // mappedPatchBase
132  const word& sampleRegion,
133  const sampleMode sampleMode,
134  const word& samplePatch,
135  const scalar distance,
136 
137  // My settings
138  const word& fieldName,
139  const bool setAverage,
140  const Type average,
141  const word& interpolationScheme
142  );
143 
144  //- Construct by mapping given
145  // mappedFieldFvPatchField
146  // onto a new patch
148  (
150  const fvPatch&,
152  const fvPatchFieldMapper&
153  );
154 
155  //- Construct as copy
157  (
159  );
160 
161  //- Construct as copy setting internal field reference
163  (
166  );
167 
168  //- Return a clone
169  virtual tmp<fvPatchField<Type>> clone() const
170  {
171  return fvPatchField<Type>::Clone(*this);
172  }
173 
174  //- Clone with an internal field reference
176  (
178  ) const
179  {
180  return fvPatchField<Type>::Clone(*this, iF);
181  }
182 
183 
184  // Member functions
185 
186  // Mapping functions
187 
188  //- Map (and resize as needed) from self given a mapping object
189  virtual void autoMap
190  (
191  const fvPatchFieldMapper&
192  );
193 
194  //- Reverse map the given fvPatchField onto this fvPatchField
195  virtual void rmap
196  (
197  const fvPatchField<Type>&,
198  const labelList&
199  );
200 
201 
202  // Evaluation functions
204  //- Update the coefficients associated with the patch field
205  virtual void updateCoeffs();
206 
207 
208  //- Write
209  virtual void write(Ostream&) const;
210 };
211 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #ifdef NoRepository
220  #include "mappedFieldFvPatchField.C"
221 #endif
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
TypeName("mappedField")
Runtime type information.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
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
Return a clone.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
A class for handling words, derived from Foam::string.
Definition: word.H:63
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
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 the data locally.
virtual void write(Ostream &) const
Write.
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
mappedFieldFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const word & sampleRegion() const
Region to sample.
Namespace for OpenFOAM.