outletMappedUniformInletFvPatchField.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) 2011-2018 OpenFOAM Foundation
9  Copyright (C) 2020-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::outletMappedUniformInletFvPatchField
29 
30 Group
31  grpInletBoundaryConditions
32 
33 Description
34  The \c outletMappedUniformInlet is an inlet boundary condition that
35  - averages patch fields of specified "outlet" patches
36  and uniformly applies the averaged value over a specified inlet patch.
37  - optionally, the averaged value can be scaled
38  and/or offset by a specified value,
39  and/or mapped by a specified time delay.
40 
41  The governing equation of the boundary condition is:
42 
43  \f[
44  \phi_{inlet} =
45  \sum_i \left( f_i \phi_{{outlet}_i} + \phi_{{offset}_i} \right)
46  \f]
47 
48  where
49  \vartable
50  \phi_{inlet} | Spatially-uniform patch-field value at an inlet patch
51  \phi_{outlet} | Averaged patch-field value at an outlet patch
52  f | User-defined fraction value
53  \phi_{offset} | User-defined offset value
54  i | Outlet-patch index
55  \endvartable
56 
57 Usage
58  Example of the boundary condition specification:
59  \verbatim
60  <patchName>
61  {
62  // Mandatory entries
63  type outletMappedUniformInlet;
64 
65  outlets
66  {
67  <outletName.1>
68  {
69  fraction <Function1<scalar>>;
70  offset <Function1<Type>>;
71  timeDelay <Function1<scalar>>;
72  }
73  <outletName.2>
74  {
75  fraction <Function1<scalar>>;
76  offset <Function1<Type>>;
77  timeDelay <Function1<scalar>>;
78  }
79  ...
80  }
81 
82  // Optional entries
83  uniformValue <PatchFunction1<Type>>;
84  phi phi;
85 
86  // Inherited entries
87  ...
88  }
89  \endverbatim
90 
91  where the entries mean:
92  \table
93  Property | Description | Type | Reqd | Deflt
94  type | Type name: outletMappedUniformInlet | word | yes | -
95  outlets | Dictionary name: outlets | dict | yes | -
96  fraction | Fraction value | Function1<scalar> | no | 1
97  offset | Offset value | Function1<Type> | no | Zero
98  timeDelay | Time delay | Function1<scalar> | no | 0
99  uniformValue | Base inlet patch field | PatchFunction1<Type> | no | Zero
100  phi | Name of operand flux field | word | no | phi
101  \endtable
102 
103  The inherited entries are elaborated in:
104  - \link fixedValueFvPatchFields.H \endlink
105  - \link PatchFunction1.H \endlink
106  - \link Function1.H \endlink
107 
108 Note
109  - Any negative input of \c timeDelay entry
110  is forced to be zero without emitting any warnings.
111 
112 See also
113  - Foam::fixedValueFvPatchField
114  - Foam::outletMappedUniformInletHeatAdditionFvPatchField
115  - Foam::outletMappedUniformInletTemperatureFvPatchField
116 
117 SourceFiles
118  outletMappedUniformInletFvPatchField.C
119  outletMappedUniformInletFvPatchFields.C
120 
121 \*---------------------------------------------------------------------------*/
122 
123 #ifndef outletMappedUniformInletFvPatchField_H
124 #define outletMappedUniformInletFvPatchField_H
125 
126 #include "fixedValueFvPatchFields.H"
127 #include "PatchFunction1.H"
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 namespace Foam
132 {
133 
134 /*---------------------------------------------------------------------------*\
135  Class outletMappedUniformInletFvPatchField Declaration
136 \*---------------------------------------------------------------------------*/
137 
138 template<class Type>
139 class outletMappedUniformInletFvPatchField
140 :
141  public fixedValueFvPatchField<Type>
142 {
143  // Private Data
144 
145  //- Base inlet patch field
146  autoPtr<PatchFunction1<Type>> uniformValuePtr_;
147 
148  //- List of outlet-patch names
149  wordList outletNames_;
150 
151  //- List of outlet-patch field offsets
152  PtrList<Function1<Type>> offsets_;
153 
154  //- List of outlet-patch field fractions
155  PtrList<Function1<scalar>> fractions_;
156 
157  //- List of outlet-patch field time delays
158  PtrList<Function1<scalar>> timeDelays_;
159 
160  //- List of outlet-patch mapping fields
161  List<DynamicList<Type>> mapFields_;
162 
163  //- List of outlet-patch mapping times
164  List<DynamicList<scalar>> mapTimes_;
165 
166  //- Name of operand flux field
167  word phiName_;
168 
169  //- Current time index
170  label curTimeIndex_;
171 
172 
173 public:
174 
175  //- Runtime type information
176  TypeName("outletMappedUniformInlet");
177 
178 
179  // Constructors
180 
181  //- Construct from patch and internal field
183  (
184  const fvPatch&,
185  const DimensionedField<Type, volMesh>&
186  );
187 
188  //- Construct from patch, internal field and dictionary
190  (
191  const fvPatch&,
192  const DimensionedField<Type, volMesh>&,
193  const dictionary&
194  );
195 
196  //- Construct by mapping given outletMappedUniformInletFvPatchField
197  //- onto a new patch
199  (
200  const outletMappedUniformInletFvPatchField<Type>&,
201  const fvPatch&,
203  const fvPatchFieldMapper&
204  );
205 
206  //- Construct as copy
208  (
210  );
211 
212  //- Construct and return a clone
213  virtual tmp<fvPatchField<Type>> clone() const
214  {
215  return tmp<fvPatchField<Type>>
216  (
218  );
219  }
220 
221  //- Construct as copy setting internal field reference
223  (
226  );
227 
228  //- Construct and return a clone setting internal field reference
230  (
232  ) const
233  {
234  return tmp<fvPatchField<Type>>
235  (
237  );
238  }
239 
240 
241  // Member Functions
242 
243  // Mapping
244 
245  //- Map (and resize as needed) from self given a mapping object
246  virtual void autoMap
247  (
248  const fvPatchFieldMapper&
249  );
250 
251  //- Reverse map the given fvPatchField onto this fvPatchField
252  virtual void rmap
253  (
254  const fvPatchField<Type>&,
255  const labelList&
256  );
257 
258 
259  // Evaluation
260 
261  //- Update the coefficients associated with the patch field
262  virtual void updateCoeffs();
263 
264 
265  //- Write
266  virtual void write(Ostream&) const;
267 };
268 
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 } // End namespace Foam
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #ifdef NoRepository
278 #endif
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************************************************************* //
The outletMappedUniformInlet is an inlet boundary condition that.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
TypeName("outletMappedUniformInlet")
Runtime type information.
A FieldMapper for finite-volume patch fields.
outletMappedUniformInletFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
List< word > wordList
List of word.
Definition: fileName.H:59
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Namespace for OpenFOAM.