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