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-2013 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  \heading Patch usage
36 
37  \table
38  Property | Description | Required | Default value
39  fieldName | name of field to be mapped | no | this field name
40  setAverage | flag to activate setting of average value | yes |
41  average | average value to apply if \c setAverage = yes | yes |
42  \endtable
43 
44  Example of the boundary condition specification:
45  \verbatim
46  myPatch
47  {
48  type mappedField;
49  fieldName T; // optional field name
50  setAverage no; // apply an average value
51  average 0; // average to apply if setAverage
52  value uniform 0; // place holder
53  }
54  \endverbatim
55 
56 Note
57  Since this condition can be applied on a per-field and per-patch basis,
58  it is possible to duplicate the mapping information. If possible, employ
59  the \c mapped condition in preference to avoid this situation, and only
60  employ this condition if it is not possible to change the underlying
61  geometric (poly) patch type to \c mapped.
62 
63 SeeAlso
64  Foam::mappedPatchBase
65  Foam::mappedPolyPatch
66  Foam::mappedFvPatch
67  Foam::fixedValueFvPatchField
68 
69 SourceFiles
70  mappedFieldFvPatchField.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef mappedFieldFvPatchField_H
75 #define mappedFieldFvPatchField_H
76 
77 #include "mappedPatchBase.H"
78 #include "mappedPatchFieldBase.H"
80 #include "interpolation.H"
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 
87 /*---------------------------------------------------------------------------*\
88  Class mappedFieldFvPatchField Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 template<class Type>
92 class mappedFieldFvPatchField
93 :
94  public fixedValueFvPatchField<Type>,
95  public mappedPatchBase,
96  public mappedPatchFieldBase<Type>
97 {
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("mappedField");
103 
104 
105  // Constructors
106 
107  //- Construct from patch and internal field
109  (
110  const fvPatch&,
112  );
113 
114  //- Construct from patch, internal field and dictionary
116  (
117  const fvPatch&,
119  const dictionary&
120  );
121 
122  //- Construct from patch, internal field and distance for normal type
123  // sampling
125  (
126  const fvPatch&,
128 
129  // mappedPatchBase
130  const word& sampleRegion,
131  const sampleMode sampleMode,
132  const word& samplePatch,
133  const scalar distance,
134 
135  // My settings
136  const word& fieldName,
137  const bool setAverage,
138  const Type average,
139  const word& interpolationScheme
140  );
141 
142  //- Construct by mapping given
143  // mappedFieldFvPatchField
144  // onto a new patch
146  (
148  const fvPatch&,
150  const fvPatchFieldMapper&
151  );
152 
153  //- Construct as copy
155  (
157  );
158 
159  //- Construct and return a clone
160  virtual tmp<fvPatchField<Type> > clone() const
161  {
162  return tmp<fvPatchField<Type> >
163  (
165  (
166  *this
167  )
168  );
169  }
170 
171  //- Construct as copy setting internal field reference
173  (
176  );
177 
178  //- Construct and return a clone setting internal field reference
180  (
182  ) const
183  {
184  return tmp<fvPatchField<Type> >
185  (
187  (
188  *this,
189  iF
190  )
191  );
192  }
193 
194 
195  // Member functions
196 
197  // Evaluation functions
198 
199  //- Update the coefficients associated with the patch field
200  virtual void updateCoeffs();
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 "mappedFieldFvPatchField.C"
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
virtual void write(Ostream &) const
Write.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
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)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
const word & sampleRegion() const
Region to sample.
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
sampleMode
Mesh items to sample.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
TypeName("mappedField")
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:118
mappedFieldFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.