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-2023 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, internal field and dictionary
135  (
136  const fvPatch&,
137  const DimensionedField<Type, volMesh>&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given timeVaryingMappedFixedValueFvPatchField
142  // onto a new patch
144  (
145  const timeVaryingMappedFixedValueFvPatchField<Type>&,
146  const fvPatch&,
147  const DimensionedField<Type, volMesh>&,
148  const fieldMapper&
149  );
150 
151  //- Disallow copy without setting internal field reference
153  (
154  const timeVaryingMappedFixedValueFvPatchField<Type>&
155  ) = delete;
156 
157  //- Copy constructor setting internal field reference
159  (
162  );
163 
164  //- Construct and return a clone setting internal field reference
166  (
168  ) const
169  {
170  return tmp<fvPatchField<Type>>
171  (
173  );
174  }
175 
176 
177  // Member Functions
178 
179  // Mapping functions
180 
181  //- Map the given fvPatchField onto this fvPatchField
182  virtual void map(const fvPatchField<Type>&, const fieldMapper&);
183 
184  //- Reset the fvPatchField to the given fvPatchField
185  // Used for mesh to mesh mapping
186  virtual void reset(const fvPatchField<Type>&);
187 
188 
189  // Evaluation functions
190 
191  //- Update the coefficients associated with the patch field
192  virtual void updateCoeffs();
193 
194 
195  //- Write
196  virtual void write(Ostream&) const;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:204
This boundary conditions interpolates the values from a set of supplied points in space and time.
TypeName("timeVaryingMappedFixedValue")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void map(const fvPatchField< Type > &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.