timeVaryingMappedFixedValueFvPatchField.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-2019 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 Description
28  This boundary conditions interpolates the values from a set of supplied
29  points in space and time.
30 
31  By default the data files should be provide in
32  constant/boundaryData/<patch name>/ directory:
33  - points : pointField of locations
34  - <time>/<field> : field of values at time <time>
35 
36  Alternatively the names and locations of the points and field files may be
37  specified explicitly via the optional dictionary entries:
38  - dataDir <optional top-level directory of the points and field data>;
39  - points <optional path including name of points file relative to
40  dataDir>;
41  - sample <optional name of the sub-directory in the time directories
42  containing the fields>;
43  This is particularly useful when mapping data from another case for which
44  the \c sample \c functionObject is used to obtain the patch field data for
45  mapping.
46 
47  The default mode of operation (mapMethod planarInterpolation) is to project
48  the points onto a plane (constructed from the first three points) and
49  construct a 2D triangulation and finds for the face centres the triangle it
50  is in and the weights to the 3 vertices.
51 
52  The optional mapMethod nearest will avoid all projection and triangulation
53  and just use the value at the nearest vertex.
54 
55  Values are interpolated linearly between times.
56 
57 Usage
58  \table
59  Property | Description | Required | Default value
60  setAverage | Switch to activate setting of average value | no | false
61  perturb | Perturb points for regular geometries | no | 1e-5
62  fieldTable | Alternative field name to sample | no| this field name
63  mapMethod | Type of mapping | no | planarInterpolation
64  offset | Offset to mapped values | no | Zero
65  dataDir | Top-level directory of the points and field data \\
66  | no | constant/boundaryData/<patch name>
67  points | Path including name of points file relative to dataDir \\
68  | no | points
69  sample | Name of the sub-directory in the time directories \\
70  containing the fields | no | ""
71  \endtable
72 
73  \verbatim
74  <patch name>
75  {
76  type timeVaryingMappedFixedValue;
77  }
78  \endverbatim
79 
80  \verbatim
81  <patch name>
82  {
83  type timeVaryingMappedFixedValue;
84  dataDir "../<source case name>/postProcessing/sample";
85  points "0/<sample name>/faceCentres";
86  sample <sample name>;
87  }
88  \endverbatim
89 
90 See also
91  Foam::fixedValueFvPatchField
92  Foam::timeVaryingMappedFvPatchField
93  Foam::Function1Types
94 
95 SourceFiles
96  timeVaryingMappedFixedValueFvPatchField.C
97 
98 \*---------------------------------------------------------------------------*/
99 
100 #ifndef timeVaryingMappedFixedValueFvPatchField_H
101 #define timeVaryingMappedFixedValueFvPatchField_H
102 
103 #include "fixedValueFvPatchFields.H"
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 namespace Foam
109 {
110 
111 /*---------------------------------------------------------------------------*\
112  Class timeVaryingMappedFixedValueFvPatchField Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 template<class Type>
116 class timeVaryingMappedFixedValueFvPatchField
117 :
118  public fixedValueFvPatchField<Type>
119 {
120  // Private Data
121 
122  timeVaryingMappedFvPatchField<Type> fieldMapper_;
123 
124 
125 public:
126 
127  //- Runtime type information
128  TypeName("timeVaryingMappedFixedValue");
129 
130 
131  // Constructors
132 
133  //- Construct from patch and internal field
135  (
136  const fvPatch&,
137  const DimensionedField<Type, volMesh>&
138  );
139 
140  //- Construct from patch, internal field and dictionary
142  (
143  const fvPatch&,
144  const DimensionedField<Type, volMesh>&,
145  const dictionary&
146  );
147 
148  //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
149  // onto a new patch
151  (
152  const timeVaryingMappedFixedValueFvPatchField<Type>&,
153  const fvPatch&,
154  const DimensionedField<Type, volMesh>&,
155  const fvPatchFieldMapper&
156  );
158  //- Copy constructor
160  (
162  );
163 
164  //- Construct and return a clone
165  virtual tmp<fvPatchField<Type>> clone() const
166  {
167  return tmp<fvPatchField<Type>>
168  (
170  );
171  }
172 
173  //- Copy constructor setting internal field reference
175  (
178  );
179 
180  //- Construct and return a clone setting internal field reference
182  (
184  ) const
185  {
186  return tmp<fvPatchField<Type>>
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  // Used to update fields following mesh topology change
199  virtual void autoMap(const fvPatchFieldMapper&);
200 
201  //- Reverse map the given fvPatchField onto this fvPatchField
202  // Used to reconstruct fields
203  virtual void rmap(const fvPatchField<Type>&, const labelList&);
204 
205 
206  // Evaluation functions
207 
208  //- Update the coefficients associated with the patch field
209  virtual void updateCoeffs();
210 
211 
212  //- Write
213  virtual void write(Ostream&) const;
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #ifdef NoRepository
225 #endif
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
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...
Foam::fvPatchFieldMapper.
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.
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...
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.