mappedMixedFieldFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2019-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::mappedMixedFieldFvPatchField
28 
29 Group
30  grpGenericBoundaryConditions grpCoupledBoundaryConditions
31 
32 Description
33  This boundary condition provides a self-contained version of e.g. mapped
34  boundary conditions
35  - it expects two-way coupling (so the sampled field needs to run the
36  same bc)
37  - it does not use information on the patch; instead it holds the coupling
38  data locally.
39 
40 Usage
41  \table
42  Property | Description | Required | Default
43  field | Name of field to be mapped | no | this field name
44  weightField | Name of field to use as weight | no |
45  setAverage | Use average value | no | false |
46  average | Average value to use if \c setAverage = yes | partly |
47  \endtable
48 
49  Example of the boundary condition specification:
50  \verbatim
51  <patchName>
52  {
53  type mappedMixedField;
54  field T; // optional field name
55  setAverage no; // apply an average value
56  average 0; // average to apply if setAverage
57  value uniform 0; // place holder
58  }
59  \endverbatim
60 
61 Note
62  Supports multi-world operation:
63 
64  +----+ +----+
65  | | | |
66  | | | |
67  +----+ +----+
68  worldA worldB
69  regionA regionB
70  patchA patchB
71 
72 
73 See also
74  Foam::mappedPatchBase
75  Foam::mappedPolyPatch
76  Foam::mappedFvPatch
77  Foam::mappedFieldFvPatchField
78  Foam::mixedFvPatchField
79 
80 SourceFiles
81  mappedMixedFieldFvPatchField.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef mappedMixedFieldFvPatchField_H
86 #define mappedMixedFieldFvPatchField_H
87 
88 #include "mappedPatchBase.H"
89 #include "mappedPatchFieldBase.H"
90 #include "mixedFvPatchFields.H"
91 #include "interpolation.H"
92 #include "volFieldsFwd.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class mappedMixedFieldFvPatchField Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 template<class Type>
104 class mappedMixedFieldFvPatchField
105 :
106  public mixedFvPatchField<Type>,
107  public mappedPatchBase,
108  public mappedPatchFieldBase<Type>
109 {
110 
111  //- Name of weight field to sample
112  word weightFieldName_;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("mappedMixedField");
119 
120 
121  // Constructors
122 
123  //- Construct from patch and internal field
125  (
126  const fvPatch&,
128  );
129 
130  //- Construct from patch, internal field and dictionary
132  (
133  const fvPatch&,
135  const dictionary&
136  );
137 
138  //- Construct by mapping given
139  // mappedMixedFieldFvPatchField
140  // onto a new patch
142  (
144  const fvPatch&,
146  const fvPatchFieldMapper&
147  );
148 
149  //- Construct as copy
151  (
153  );
154 
155  //- Construct as copy setting internal field reference
157  (
160  );
161 
162  //- Return a clone
163  virtual tmp<fvPatchField<Type>> clone() const
164  {
165  return fvPatchField<Type>::Clone(*this);
166  }
167 
168  //- Clone with an internal field reference
170  (
172  ) const
173  {
174  return fvPatchField<Type>::Clone(*this, iF);
175  }
176 
177 
178  // Member functions
179 
180  // Mapping functions
181 
182  //- Map (and resize as needed) from self given a mapping object
183  virtual void autoMap
184  (
185  const fvPatchFieldMapper&
186  );
187 
188  //- Reverse map the given fvPatchField onto this fvPatchField
189  virtual void rmap
190  (
191  const fvPatchField<Type>&,
192  const labelList&
193  );
194 
195 
196  // Evaluation functions
197 
198  //- Update the coefficients associated with the patch field
199  virtual void updateCoeffs();
200 
202  //- Write
203  virtual void write(Ostream&) const;
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #ifdef NoRepository
215 #endif
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
Forwards and collection of common volume field types.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A FieldMapper for finite-volume patch fields.
mappedMixedFieldFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void write(Ostream &) const
Write.
This boundary condition provides a self-contained version of e.g. mapped boundary conditions...
TypeName("mappedMixedField")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< fvPatchField< Type > > clone() const
Return a clone.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Namespace for OpenFOAM.