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.txx
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  typedef timeVaryingMappedFixedValuePointPatchField<Type> this_bctype;
76  typedef fixedValuePointPatchField<Type> parent_bctype;
77 
78  // Private Data
79 
80  //- If true adjust the mapped field to maintain average value
81  bool setAverage_;
82 
83  //- Fraction of perturbation (fraction of bounding box) to add
84  scalar perturb_;
85 
86  //- Name of the field data table, defaults to the name of the field
87  word fieldTableName_;
88 
89  //- Name of points file (default: "points")
90  word pointsName_;
91 
92  //- Interpolation scheme to use (default is empty == "planar")
93  word mapMethod_;
94 
95  //- 2D interpolation (for 'planar' mapMethod)
96  autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
97 
98  //- List of boundaryData time directories
99  instantList sampleTimes_;
100 
101  //- The first/second sample indices in sampleTimes
102  labelPair sampleIndex_;
103 
104  //- The average values at first/second sampleIndex_ (if setAverage)
105  Pair<Type> sampleAverage_;
106 
107  //- The interpolated values at first/second sampleIndex_
108  Pair<Field<Type>> sampleValues_;
109 
110  //- Time varying offset values to interpolated data
111  autoPtr<Function1<Type>> offset_;
112 
113 
114  // Private Member Functions
115 
116  //- Find boundary data between time 't' and interpolate
117  void checkTable(const scalar t);
118 
119  //- Update field and average value using interpolation at
120  //- given instant index
121  void updateSampledValues
122  (
123  const label sampleIndex,
125  Type& avg
126  ) const;
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("timeVaryingMappedFixedValue");
133 
134 
135  // Constructors
136 
137  //- Construct from patch and internal field
139  (
140  const pointPatch&,
142  );
143 
144  //- Construct from patch, internal field and dictionary
146  (
147  const pointPatch&,
149  const dictionary&
150  );
151 
152  //- Construct by mapping onto a new patch
154  (
155  const this_bctype&,
156  const pointPatch&,
158  const pointPatchFieldMapper&
159  );
160 
161  //- Construct as copy setting internal field reference
163  (
164  const this_bctype&,
166  );
167 
168  //- No copy without an internal field
170 
171  //- Clone with an internal field reference
173  (
175  ) const
176  {
177  return pointPatchField<Type>::Clone(*this, iF);
178  }
179 
180 
181  // Member Functions
182 
183  // Mapping functions
184 
185  //- Map (and resize as needed) from self given a mapping object
186  virtual void autoMap
187  (
188  const pointPatchFieldMapper&
189  );
190 
191  //- Reverse map the given PointPatchField onto
192  // this PointPatchField
193  virtual void rmap
194  (
195  const pointPatchField<Type>&,
196  const labelList&
197  );
198 
199 
200  // Evaluation functions
201 
202  //- Update the coefficients associated with the patch field
203  virtual void updateCoeffs();
204 
205 
206  //- Write
207  virtual void write(Ostream&) const;
208 
209 
210  // Member Operators
211 
212  //- Inherit assignment
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #ifdef NoRepository
224  #include "timeVaryingMappedFixedValuePointPatchField.txx"
225 #endif
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
virtual void write(Ostream &) const
Write.
rDeltaTY field()
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:130
Foam::pointPatchFieldMapper.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
timeVaryingMappedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Abstract base class for point-mesh patch fields.
friend Ostream & operator(Ostream &, const Field< Type > &)
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition: Field.H:69
tmp< Field< Type > > clone() const
Clone.
Definition: FieldI.H:140
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
TypeName("timeVaryingMappedFixedValue")
Runtime type information.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:64
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
List< instant > instantList
List of instants.
Definition: instantList.H:41
Namespace for OpenFOAM.