mappedInternalValueFvPatchField.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) 2022-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::mappedInternalValueFvPatchField
26 
27 Description
28  This boundary condition maps the values from a internal cells to this
29  patch.
30 
31 Usage
32  \table
33  Property | Description | Required | Default value
34  field | name of field to be mapped | no | this field name
35  setAverage | set the average value? | no | yes if average \\
36  is specified, \\
37  no otherwise
38  average | average value to apply | if setAverage is true |
39  interplolationScheme | the interpolation scheme to use | yes |
40  \endtable
41 
42  Example of the boundary condition specification:
43  \verbatim
44  <patchName>
45  {
46  type mappedInternalValue;
47  field T;
48  average 300;
49  interpolationScheme cellPoint;
50  value uniform 300;
51  }
52  \endverbatim
53 
54  This boundary condition will usually be applied to a patch which is of
55  mappedInternalPatchBase type, and which holds all the necessary mapping
56  information. It can also create its own mapping data which overrides that
57  in the mapped patch, or so that it can be applied to a non-mapped patch.
58  This is triggered by the presence of controls relating to
59  mappedInternalPatchBase (i.e., neighbourRegion, offset, distance, etc ...).
60 
61 See also
62  Foam::mappedInternalPatchBase
63  Foam::interpolation
64  Foam::fixedValueFvPatchField
65 
66 SourceFiles
67  mappedInternalValueFvPatchField.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef mappedInternalValueFvPatchField_H
72 #define mappedInternalValueFvPatchField_H
73 
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class mappedInternalValueFvPatchField Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 template<class Type>
87 class mappedInternalValueFvPatchField
88 :
89  public fixedValueFvPatchField<Type>
90 {
91 protected:
92 
93  // Protected Member Data
94 
95  //- Name of the field to map
96  const word fieldName_;
97 
98  //- If true adjust the mapped field to maintain an average value
99  const bool setAverage_;
100 
101  //- Average value the mapped field is adjusted to
102  const Type average_;
103 
104  //- Interpolation scheme to use
105  const word interpolationScheme_;
106 
107  //- Sampling engine
108  autoPtr<mappedInternalPatchBase> mapperPtr_;
109 
110 
111  // Protected Member Functions
112 
113  //- Return the mapping engine
114  const mappedInternalPatchBase& mapper() const;
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("mappedInternalValue");
121 
122 
123  // Constructors
124 
125  //- Construct from patch, internal field and dictionary
127  (
128  const fvPatch&,
130  const dictionary&
131  );
132 
133  //- Construct by mapping given mappedInternalValueFvPatchField
134  // onto a new patch
136  (
138  const fvPatch&,
140  const fieldMapper&
141  );
142 
143  //- Disallow copy without setting internal field reference
145  (
147  ) = delete;
148 
149  //- Copy constructor setting internal field reference
151  (
154  );
155 
156  //- Construct and return a clone setting internal field reference
158  (
160  ) const
161  {
162  return tmp<fvPatchField<Type>>
163  (
165  );
166  }
167 
168 
169  // Member Functions
170 
171  // Mapping functions
172 
173  //- Map the given fvPatchField onto this fvPatchField
174  virtual void map(const fvPatchField<Type>&, const fieldMapper&);
175 
176  //- Reset the fvPatchField to the given fvPatchField
177  // Used for mesh to mesh mapping
178  virtual void reset(const fvPatchField<Type>&);
179 
180 
181  // Evaluation functions
182 
183  //- Update the coefficients associated with the patch field
184  virtual void updateCoeffs();
185 
186 
187  //- Write
188  virtual void write(Ostream&) const;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #ifdef NoRepository
200 #endif
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
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
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Engine which provides mapping from cells to patch faces.
This boundary condition maps the values from a internal cells to this patch.
const Type average_
Average value the mapped field is adjusted to.
mappedInternalValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const word interpolationScheme_
Interpolation scheme to use.
virtual void reset(const fvPatchField< Type > &)
Reset the fvPatchField to the given fvPatchField.
TypeName("mappedInternalValue")
Runtime type information.
autoPtr< mappedInternalPatchBase > mapperPtr_
Sampling engine.
const word fieldName_
Name of the field to map.
const bool setAverage_
If true adjust the mapped field to maintain an average value.
const mappedInternalPatchBase & mapper() const
Return the mapping engine.
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.