timeVaryingMappedFixedValueFvPatchField.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-2016 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::timeVaryingMappedFixedValueFvPatchField
26 
27 Group
28  grpInletBoundaryConditions grpCoupledBoundaryConditions
29 
30 Description
31  This boundary conditions interpolates the values from a set of supplied
32  points in space and time.
33 
34  Supplied data should be specified in constant/boundaryData/<patchname>/
35  - points : pointField of locations
36  - <time>/<field> : field of values at time <time>
37 
38  The default mode of operation (mapMethod planarInterpolation) is to project
39  the points onto a plane (constructed from the first threee points) and
40  construct a 2D triangulation and finds for the face centres the triangle it
41  is in and the weights to the 3 vertices.
42 
43  The optional mapMethod nearest will avoid all projection and triangulation
44  and just use the value at the nearest vertex.
45 
46  Values are interpolated linearly between times.
47 
48 Usage
49  \table
50  Property | Description | Required | Default value
51  setAverage | Switch to activate setting of average value | no | false
52  perturb | Perturb points for regular geometries | no | 1e-5
53  fieldTableName | Alternative field name to sample | no| this field name
54  mapMethod | Type of mapping | no | planarInterpolation
55  offset | Offset to mapped values | no | Zero
56  \endtable
57 
58  \verbatim
59  <patchName>
60  {
61  type timeVaryingMappedFixedValue;
62  }
63  \endverbatim
64 
65 See also
66  Foam::fixedValueFvPatchField
67  Foam::Function1Types
68 
69 SourceFiles
70  timeVaryingMappedFixedValueFvPatchField.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef timeVaryingMappedFixedValueFvPatchField_H
75 #define timeVaryingMappedFixedValueFvPatchField_H
76 
78 #include "FixedList.H"
79 #include "instantList.H"
81 #include "Function1.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class timeVaryingMappedFixedValueFvPatchField Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 template<class Type>
93 class timeVaryingMappedFixedValueFvPatchField
94 :
95  public fixedValueFvPatchField<Type>
96 {
97  // Private data
98 
99  //- Name of the field data table, defaults to the name of the field
100  word fieldTableName_;
101 
102  //- If true adjust the mapped field to maintain average value
103  Switch setAverage_;
104 
105  //- Fraction of perturbation (fraction of bounding box) to add
106  scalar perturb_;
107 
108  //- Interpolation scheme to use
109  word mapMethod_;
110 
111  //- 2D interpolation (for 'planarInterpolation' mapMethod)
112  autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
113 
114  //- List of boundaryData time directories
115  instantList sampleTimes_;
116 
117  //- Current starting index in sampleTimes
118  label startSampleTime_;
119 
120  //- Interpolated values from startSampleTime
121  Field<Type> startSampledValues_;
123  //- If setAverage: starting average value
124  Type startAverage_;
125 
126  //- Current end index in sampleTimes
127  label endSampleTime_;
128 
129  //- Interpolated values from endSampleTime
130  Field<Type> endSampledValues_;
131 
132  //- If setAverage: end average value
133  Type endAverage_;
134 
135  //- Time varying offset values to interpolated data
136  autoPtr<Function1<Type>> offset_;
137 
138 
139 public:
140 
141  //- Runtime type information
142  TypeName("timeVaryingMappedFixedValue");
143 
144 
145  // Constructors
146 
147  //- Construct from patch and internal field
149  (
150  const fvPatch&,
152  );
153 
154  //- Construct from patch, internal field and dictionary
156  (
157  const fvPatch&,
159  const dictionary&
160  );
161 
162  //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
163  // onto a new patch
165  (
167  const fvPatch&,
169  const fvPatchFieldMapper&
170  );
171 
172  //- Construct as copy
174  (
176  );
177 
178  //- Construct and return a clone
179  virtual tmp<fvPatchField<Type>> clone() const
180  {
181  return tmp<fvPatchField<Type>>
182  (
184  );
185  }
186 
187  //- Construct as copy setting internal field reference
189  (
192  );
193 
194  //- Construct and return a clone setting internal field reference
196  (
198  ) const
199  {
200  return tmp<fvPatchField<Type>>
201  (
203  );
204  }
205 
206 
207  // Member functions
209  // Access
210 
211  //- Return startSampledValues
213  {
214  return startSampledValues_;
215  }
216 
217 
218  // Mapping functions
219 
220  //- Map (and resize as needed) from self given a mapping object
221  virtual void autoMap
222  (
223  const fvPatchFieldMapper&
224  );
226  //- Reverse map the given fvPatchField onto this fvPatchField
227  virtual void rmap
228  (
229  const fvPatchField<Type>&,
230  const labelList&
231  );
232 
233 
234  // Utility functions
235 
236  //- Find boundary data inbetween current time and interpolate
237  void checkTable();
238 
239 
240  // Evaluation functions
242  //- Update the coefficients associated with the patch field
243  virtual void updateCoeffs();
244 
245 
246  //- Write
247  virtual void write(Ostream&) const;
248 };
249 
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 } // End namespace Foam
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #ifdef NoRepository
259 #endif
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #endif
264 
265 // ************************************************************************* //
List< instant > instantList
List of instants.
Definition: instantList.H:42
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
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 tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
This boundary conditions interpolates the values from a set of supplied points in space and time...
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatchFieldMapper.
void checkTable()
Find boundary data inbetween current time and interpolate.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TypeName("timeVaryingMappedFixedValue")
Runtime type information.
const Field< Type > startSampledValues()
Return startSampledValues.
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.