mappedFvPatchField.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::mappedFvPatchField
26 
27 Description
28  Base class for mapped patch fields
29 
30 Usage
31  \table
32  Property | Description | Required | Default value
33  field | name of field to be mapped | no | this field name
34  setAverage | set the average value? | no | yes if average \\
35  is specified, \\
36  no otherwise
37  average | average value to apply | if setAverage is true |
38  \endtable
39 
40  This boundary condition will usually be applied to a patch which is of
41  mappedPatchBase type, and which holds all the necessary mapping
42  information. It can also create its own mapping data which overrides that
43  in the mapped patch, or so that it can be applied to a non-mapped patch.
44  This is triggered by the presence of controls relating to mappedPatchBase
45  (i.e., neighbourRegion, neighbourPatch, etc ...).
46 
47 See also
48  Foam::mappedValueFvPatchField
49  Foam::mappedPatchBase
50  Foam::mappedPolyPatch
51  Foam::mappedFvPatch
52 
53 SourceFiles
54  mappedFvPatchField.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef mappedFvPatchField_H
59 #define mappedFvPatchField_H
60 
61 #include "mappedPatchBase.H"
62 #include "fvPatchField.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class mappedFvPatchField Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 template<class Type>
74 class mappedFvPatchField
75 {
76 protected:
77 
78  // Protected Member Data
79 
80  //- Reference to the patch
81  const fvPatch& p_;
82 
83  //- Reference to the internal field
84  const DimensionedField<Type, volMesh>& iF_;
85 
86  //- The field to map
87  const word fieldName_;
88 
89  //- If true adjust the sampled field to maintain an average value
90  const bool setAverage_;
91 
92  //- Average value the sampled field is adjusted to
93  const Type average_;
94 
95  //- The mapping engine
97 
98 
99  // Protected Member Functions
100 
101  //- Return the mapping engine
102  const mappedPatchBase& mapper() const;
103 
104  //- Return the neighbouring patch field
105  const fvPatchField<Type>& nbrPatchField() const;
106 
107  //- Return the mapped values, given the neighbouring field
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("mappedValue");
115 
116 
117  // Constructors
118 
119  //- Construct from patch, internal field and dictionary
121  (
122  const fvPatch&,
124  const dictionary&
125  );
126 
127  //- Construct by mapping given mappedFvPatchField
128  // onto a new patch
130  (
132  const fvPatch&,
134  const fvPatchFieldMapper&
135  );
136 
137  //- Disallow copy without setting internal field reference
139  (
141  ) = delete;
142 
143  //- Copy constructor setting internal field reference
145  (
148  );
149 
150 
151  //- Destructor
152  virtual ~mappedFvPatchField()
153  {}
154 
155 
156  // Member Functions
157 
158  //- Clear the mapper if present
159  virtual void clearOut();
160 
161  //- Write
162  virtual void write(Ostream&) const;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #ifdef NoRepository
173  #include "mappedFvPatchField.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:82
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Base class for mapped patch fields.
virtual ~mappedFvPatchField()
Destructor.
const mappedPatchBase & mapper() const
Return the mapping engine.
mappedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
const fvPatch & p_
Reference to the patch.
virtual void write(Ostream &) const
Write.
const Type average_
Average value the sampled field is adjusted to.
const DimensionedField< Type, volMesh > & iF_
Reference to the internal field.
autoPtr< mappedPatchBase > mapperPtr_
The mapping engine.
const word fieldName_
The field to map.
const bool setAverage_
If true adjust the sampled field to maintain an average value.
tmp< Field< Type > > mappedValues(const Field< Type > &nbrPatchField) const
Return the mapped values, given the neighbouring field.
const fvPatchField< Type > & nbrPatchField() const
Return the neighbouring patch field.
TypeName("mappedValue")
Runtime type information.
virtual void clearOut()
Clear the mapper if present.
Engine which provides mapping between two patches.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.