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-2020 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::Function1s
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  //- Disallow copy without setting internal field reference
160  (
162  ) = delete;
163 
164  //- Copy constructor setting internal field reference
166  (
169  );
170 
171  //- Construct and return a clone setting internal field reference
173  (
175  ) const
176  {
177  return tmp<fvPatchField<Type>>
178  (
180  );
181  }
182 
183 
184  // Member Functions
185 
186  // Mapping functions
187 
188  //- Map (and resize as needed) from self given a mapping object
189  // Used to update fields following mesh topology change
190  virtual void autoMap(const fvPatchFieldMapper&);
191 
192  //- Reverse map the given fvPatchField onto this fvPatchField
193  // Used to reconstruct fields
194  virtual void rmap(const fvPatchField<Type>&, const labelList&);
195 
196 
197  // Evaluation functions
198 
199  //- Update the coefficients associated with the patch field
200  virtual void updateCoeffs();
201 
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #ifdef NoRepository
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
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 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:54
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
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:199
Namespace for OpenFOAM.