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 as copy setting internal field reference
151  (
154  );
155 
156  //- Return a clone
157  virtual tmp<fvPatchField<Type>> clone() const
158  {
159  return fvPatchField<Type>::Clone(*this);
160  }
161 
162  //- Clone with an internal field reference
164  (
166  ) const
167  {
168  return fvPatchField<Type>::Clone(*this, iF);
169  }
170 
171 
172  // Member Functions
173 
174  //- Same as refValue()
175  const Field<Type>& freestreamValue() const { return this->refValue(); }
176 
177  //- Same as refValue()
178  Field<Type>& freestreamValue() { return this->refValue(); }
179 
180 
181  // Mapping Functions
182 
183  //- Map (and resize as needed) from self given a mapping object
184  virtual void autoMap(const fvPatchFieldMapper& mapper);
185 
186  //- Reverse map the given fvPatchField onto this fvPatchField
187  virtual void rmap
188  (
189  const fvPatchField<Type>& ptf,
190  const labelList& addr
191  );
192 
193 
194  //- Update the coefficients associated with the patch field
195  virtual void updateCoeffs();
196 
197  //- Write
198  virtual void write(Ostream&) const;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #ifdef NoRepository
209  #include "freestreamFvPatchField.C"
210 #endif
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
216 // ************************************************************************* //
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
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
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()
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.
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
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...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.