timeVaryingMappedFixedValuePointPatchField.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2022 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::timeVaryingMappedFixedValuePointPatchField
29 
30 Description
31  A time-varying form of a mapped fixed value boundary condition.
32 
33 Usage
34  \table
35  Property | Description | Required | Default
36  setAverage | Use average value | no | false
37  perturb | Perturb points for regular geometries | no | 1e-5
38  points | Name of points file | no | points
39  fieldTable | Alternative field name to sample | no | this field name
40  mapMethod | Type of mapping | no | planar
41  offset | Offset to mapped values | no | Zero
42  \endtable
43 
44 See also
45  Foam::timeVaryingMappedFixedValueFvPatchField
46 
47 SourceFiles
48  timeVaryingMappedFixedValuePointPatchField.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef Foam_timeVaryingMappedFixedValuePointPatchField_H
53 #define Foam_timeVaryingMappedFixedValuePointPatchField_H
54 
56 #include "Function1.H"
57 #include "Pair.H"
58 #include "instantList.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class timeVaryingMappedFixedValuePointPatchField Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class Type>
71 class timeVaryingMappedFixedValuePointPatchField
72 :
73  public fixedValuePointPatchField<Type>
74 {
75  // Private Data
76 
77  //- If true adjust the mapped field to maintain average value
78  bool setAverage_;
79 
80  //- Fraction of perturbation (fraction of bounding box) to add
81  scalar perturb_;
82 
83  //- Name of the field data table, defaults to the name of the field
84  word fieldTableName_;
85 
86  //- Name of points file (default: "points")
87  word pointsName_;
88 
89  //- Interpolation scheme to use (default is empty == "planar")
90  word mapMethod_;
91 
92  //- 2D interpolation (for 'planar' mapMethod)
93  autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
94 
95  //- List of boundaryData time directories
96  instantList sampleTimes_;
97 
98  //- The first/second sample indices in sampleTimes
99  labelPair sampleIndex_;
100 
101  //- The average values at first/second sampleIndex_ (if setAverage)
102  Pair<Type> sampleAverage_;
103 
104  //- The interpolated values at first/second sampleIndex_
105  Pair<Field<Type>> sampleValues_;
106 
107  //- Time varying offset values to interpolated data
108  autoPtr<Function1<Type>> offset_;
109 
110 
111  // Private Member Functions
112 
113  //- Find boundary data between time 't' and interpolate
114  void checkTable(const scalar t);
115 
116  //- Update field and average value using interpolation at
117  //- given instant index
118  void updateSampledValues
119  (
120  const label sampleIndex,
122  Type& avg
123  ) const;
124 
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("timeVaryingMappedFixedValue");
130 
131 
132  // Constructors
133 
134  //- Construct from patch and internal field
136  (
137  const pointPatch&,
139  );
140 
141  //- Construct from patch, internal field and dictionary
143  (
144  const pointPatch&,
146  const dictionary&
147  );
148 
149  //- Construct by mapping given patch field onto a new patch
151  (
153  const pointPatch&,
155  const pointPatchFieldMapper&
156  );
157 
158  //- Construct as copy
160  (
162  );
163 
164  //- Construct and return a clone
165  virtual autoPtr<pointPatchField<Type>> clone() const
166  {
168  (
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  {
187  (
189  );
190  }
191 
192 
193  // Member Functions
194 
195  // Mapping functions
196 
197  //- Map (and resize as needed) from self given a mapping object
198  virtual void autoMap
199  (
200  const pointPatchFieldMapper&
201  );
202 
203  //- Reverse map the given PointPatchField onto
204  // this PointPatchField
205  virtual void rmap
206  (
207  const pointPatchField<Type>&,
208  const labelList&
209  );
210 
211 
212  // Evaluation functions
213 
214  //- Update the coefficients associated with the patch field
215  virtual void updateCoeffs();
216 
217 
218  //- Write
219  virtual void write(Ostream&) const;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #ifdef NoRepository
231 #endif
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
rDeltaTY field()
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
A time-varying form of a mapped fixed value boundary condition.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Foam::pointPatchFieldMapper.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
timeVaryingMappedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Generic templated field type.
Definition: Field.H:62
Pair< label > labelPair
A pair of labels.
Definition: Pair.H:51
TypeName("timeVaryingMappedFixedValue")
Runtime type information.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
List< label > labelList
A List of labels.
Definition: List.H:62
List< instant > instantList
List of instants.
Definition: instantList.H:41
virtual autoPtr< pointPatchField< Type > > clone() const
Construct and return a clone.
Namespace for OpenFOAM.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.