freestreamFvPatchField.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) 2018 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::freestreamFvPatchField
29 
30 Group
31  grpInletBoundaryConditions grpOutletBoundaryConditions
32 
33 Description
34  This boundary condition provides a free-stream condition. It is a 'mixed'
35  condition derived from the \c inletOutlet condition, whereby the mode of
36  operation switches between fixed (free stream) value and zero gradient
37  based on the sign of the flux.
38 
39 Usage
40  \table
41  Property | Description | Required | Default value
42  freestreamValue | freestream velocity | no |
43  freestreamBC | patchField providing the inlet field | no |
44  phi | flux field name | no | phi
45  \endtable
46 
47  Example of the boundary condition specification using a fixed value
48  inlet condition:
49  \verbatim
50  <patchName>
51  {
52  type freestream;
53  freestreamValue uniform (300 0 0);
54  }
55  \endverbatim
56 
57  Example of the boundary condition specification using a separate condition
58  to proveide the inlet condition:
59  \verbatim
60  <patchName>
61  {
62  type freestream;
63  freestreamBC
64  {
65  type atmBoundaryLayerInletVelocity;
66  flowDir (1 0 0);
67  zDir (0 0 1);
68  Uref 20;
69  Zref 20;
70  z0 uniform 0.1;
71  zGround uniform 935;
72  }
73  }
74  \endverbatim
75 
76 
77 See also
78  Foam::mixedFvPatchField
79  Foam::inletOutletFvPatchField
80 
81 SourceFiles
82  freestreamFvPatchField.C
83 
84 \*---------------------------------------------------------------------------*/
85 
86 #ifndef Foam_freestreamFvPatchField_H
87 #define Foam_freestreamFvPatchField_H
88 
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class freestreamFvPatchField Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 template<class Type>
101 class freestreamFvPatchField
102 :
103  public inletOutletFvPatchField<Type>
104 {
105  // Private Data
106 
107  //- BC to supply the freestream value
108  tmp<fvPatchField<Type>> freestreamBCPtr_;
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("freestream");
115 
117  // Constructors
118 
119  //- Construct from patch and internal field
121  (
122  const fvPatch&,
124  );
125 
126  //- Construct from patch, internal field and dictionary
128  (
129  const fvPatch&,
131  const dictionary&
132  );
133 
134  //- Construct by mapping given freestreamFvPatchField onto a new patch
136  (
138  const fvPatch&,
140  const fvPatchFieldMapper&
141  );
142 
143  //- Construct as copy
145  (
147  );
148 
149  //- Construct and return a clone
150  virtual tmp<fvPatchField<Type>> clone() const
151  {
152  return tmp<fvPatchField<Type>>
153  (
155  );
156  }
157 
158  //- Construct as copy setting internal field reference
160  (
163  );
164 
165  //- Construct and return a clone setting internal field reference
167  (
169  ) const
170  {
171  return tmp<fvPatchField<Type>>
172  (
173  new freestreamFvPatchField<Type>(*this, iF)
174  );
175  }
176 
177 
178  // Member Functions
180  //- Same as refValue()
181  const Field<Type>& freestreamValue() const { return this->refValue(); }
182 
183  //- Same as refValue()
184  Field<Type>& freestreamValue() { return this->refValue(); }
185 
186 
187  // Mapping Functions
188 
189  //- Map (and resize as needed) from self given a mapping object
190  virtual void autoMap(const fvPatchFieldMapper& mapper);
191 
192  //- Reverse map the given fvPatchField onto this fvPatchField
193  virtual void rmap
194  (
195  const fvPatchField<Type>& ptf,
196  const labelList& addr
197  );
198 
199 
200  //- Update the coefficients associated with the patch field
201  virtual void updateCoeffs();
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #ifdef NoRepository
215  #include "freestreamFvPatchField.C"
216 #endif
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
222 // ************************************************************************* //
This boundary condition provides a free-stream condition. It is a &#39;mixed&#39; condition derived from the ...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void write(Ostream &) const
Write.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
freestreamFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const Field< Type > & freestreamValue() const
Same as refValue()
virtual void rmap(const fvPatchField< Type > &ptf, const labelList &addr)
Reverse map the given fvPatchField onto this fvPatchField.
virtual Field< Type > & refValue()
Generic templated field type.
Definition: Field.H:62
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A FieldMapper for finite-volume patch fields.
virtual void autoMap(const fvPatchFieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
TypeName("freestream")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.