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&,
113  const DimensionedField<Type, volMesh>&
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 and return a clone
162  virtual tmp<fvPatchField<Type>> clone() const
163  {
164  return tmp<fvPatchField<Type>>
165  (
167  (
168  *this
169  )
170  );
171  }
172 
173  //- Construct as copy setting internal field reference
175  (
178  );
179 
180  //- Construct and return a clone setting internal field reference
182  (
184  ) const
185  {
186  return tmp<fvPatchField<Type>>
187  (
189  (
190  *this,
191  iF
192  )
193  );
194  }
195 
196 
197  // Member functions
198 
199  // Mapping functions
200 
201  //- Map (and resize as needed) from self given a mapping object
202  virtual void autoMap
203  (
204  const fvPatchFieldMapper&
205  );
206 
207  //- Reverse map the given fvPatchField onto this fvPatchField
208  virtual void rmap
209  (
210  const fvPatchField<Type>&,
211  const labelList&
212  );
213 
214 
215  // Evaluation functions
216 
217  //- Update the coefficients associated with the patch field
218  virtual void updateCoeffs();
219 
220 
221  //- Write
222  virtual void write(Ostream&) const;
223 };
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #ifdef NoRepository
233  #include "mappedFieldFvPatchField.C"
234 #endif
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::mappedFieldFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: mappedFieldFvPatchField.C:145
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
mappedPatchFieldBase.H
interpolation.H
Foam::mappedFieldFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: mappedFieldFvPatchField.C:167
Foam::mappedPatchBase
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
Definition: mappedPatchBase.H:112
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
Foam::mappedFieldFvPatchField::TypeName
TypeName("mappedField")
Runtime type information.
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::mappedFieldFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: mappedFieldFvPatchField.H:182
Foam::mappedPatchFieldBase
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
Definition: mappedPatchFieldBase.H:105
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::mappedPatchBase::sampleRegion
const word & sampleRegion() const
Region to sample.
Definition: mappedPatchBaseI.H:42
Foam::distance
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
mappedFieldFvPatchField.C
Foam::mappedFieldFvPatchField
This boundary condition provides a self-contained version of the mapped condition....
Definition: mappedFieldFvPatchField.H:114
Foam::List< label >
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::mappedFieldFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: mappedFieldFvPatchField.C:191
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::mappedFieldFvPatchField::mappedFieldFvPatchField
mappedFieldFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: mappedFieldFvPatchField.C:36
Foam::mappedPatchBase::sampleMode
sampleMode
Mesh items to sample.
Definition: mappedPatchBase.H:119
Foam::mappedFieldFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: mappedFieldFvPatchField.C:156
Foam::average
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:328
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
mappedPatchBase.H
Foam::mappedPatchBase::samplePatch
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
Definition: mappedPatchBaseI.H:68