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 freestreamFvPatchField_H
87 #define 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 
116 
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
179 
180  // Mapping functions
181 
182  //- Map (and resize as needed) from self given a mapping object
183  virtual void autoMap(const fvPatchFieldMapper& mapper);
184 
185  //- Reverse map the given fvPatchField onto this fvPatchField
186  virtual void rmap
187  (
188  const fvPatchField<Type>& ptf,
189  const labelList& addr
190  );
191 
192 
193  //- Update the coefficients associated with the patch field
194  virtual void updateCoeffs();
195 
196  // Return defining fields
197 
198  const Field<Type>& freestreamValue() const
199  {
200  return this->refValue();
201  }
202 
204  {
205  return this->refValue();
206  }
207 
208 
209  //- Write
210  virtual void write(Ostream&) const;
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #ifdef NoRepository
221  #include "freestreamFvPatchField.C"
222 #endif
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::freestreamFvPatchField::TypeName
TypeName("freestream")
Runtime type information.
Foam::freestreamFvPatchField::freestreamFvPatchField
freestreamFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: freestreamFvPatchField.C:35
Foam::freestreamFvPatchField::freestreamValue
const Field< Type > & freestreamValue() const
Definition: freestreamFvPatchField.H:217
Foam::mixedFvPatchField::refValue
virtual Field< Type > & refValue()
Definition: mixedFvPatchField.H:230
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
freestreamFvPatchField.C
Foam::freestreamFvPatchField
This boundary condition provides a free-stream condition. It is a 'mixed' condition derived from the ...
Definition: freestreamFvPatchField.H:120
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::inletOutletFvPatchField
This boundary condition provides a generic outflow condition, with specified inflow for the case of r...
Definition: inletOutletFvPatchField.H:101
Foam::freestreamFvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &ptf, const labelList &addr)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: freestreamFvPatchField.C:161
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::freestreamFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: freestreamFvPatchField.C:196
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::freestreamFvPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: freestreamFvPatchField.C:178
Foam::freestreamFvPatchField::autoMap
virtual void autoMap(const fvPatchFieldMapper &mapper)
Map (and resize as needed) from self given a mapping object.
Definition: freestreamFvPatchField.C:149
inletOutletFvPatchField.H
Foam::freestreamFvPatchField::freestreamValue
Field< Type > & freestreamValue()
Definition: freestreamFvPatchField.H:222
Foam::List< label >
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::freestreamFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: freestreamFvPatchField.H:169
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54