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-2020 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  //- Disallow copy without setting internal field reference
151 
152  //- Copy constructor setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
165  return tmp<fvPatchField<Type>>
166  (
168  (
169  *this,
170  iF
171  )
172  );
173  }
174 
175 
176  // Member Functions
177 
178  // Mapping functions
179 
180  //- Map (and resize as needed) from self given a mapping object
181  // Used to update fields following mesh topology change
182  virtual void autoMap(const fvPatchFieldMapper&);
183 
184  //- Reverse map the given fvPatchField onto this fvPatchField
185  // Used to reconstruct fields
186  virtual void rmap(const fvPatchField<Type>&, const labelList&);
187 
188 
189  // Evaluation functions
190 
191  //- Update the coefficients associated with the patch field
192  virtual void updateCoeffs();
193 
194 
195  //- Write
196  virtual void write(Ostream&) const;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
207  #include "mappedFieldFvPatchField.C"
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
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:54
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.
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:199
Namespace for OpenFOAM.