freestreamVelocityFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::freestreamVelocityFvPatchVectorField
26 
27 Description
28  This boundary condition provides a free-stream condition for velocity.
29 
30  It is an inlet-outlet condition that uses the velocity orientation to
31  continuously blend between fixed value for normal inlet and zero gradient
32  for normal outlet flow.
33 
34  The \c freestreamValue can be specified as a uniform value, a field or a
35  function.
36 
37 Usage
38  \table
39  Property | Description | Required | Default value
40  freestreamValue | freestream velocity | yes |
41  \endtable
42 
43  Example of the boundary condition specification with uniform freestream:
44  \verbatim
45  <patchName>
46  {
47  type freestreamVelocity;
48  freestreamValue uniform (300 0 0);
49  }
50  \endverbatim
51 
52  Example of the boundary condition specification for an
53  atmospheric boundary layer:
54  \verbatim
55  <patchName>
56  {
57  type freestreamVelocity;
58  freestreamValue
59  {
60  type atmosphericBoundaryLayerVelocity;
61  libs ("libatmosphericModels.so");
62  }
63  }
64  \endverbatim
65 
66  Note:
67  This condition is designed to operate with the freestreamPressure
68  condition
69 
70 See also
71  Foam::DimensionedFieldFunction
72  Foam::UFunctionalDimensionedField
73  Foam::mixedFvPatchField
74  Foam::freestreamFvPatchField
75 
76 SourceFiles
77  freestreamVelocityFvPatchVectorField.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef freestreamVelocityFvPatchVectorField_H
82 #define freestreamVelocityFvPatchVectorField_H
83 
84 #include "mixedFvPatchFields.H"
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class freestreamVelocityFvPatchVectorField Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class freestreamVelocityFvPatchVectorField
97 :
98  public mixedFvPatchVectorField
99 {
100  // Private Data
101 
102  //- DimensionedField and function for the freestream value
103  UFunctionalDimensionedField<vector, fvPatch>
104  dimensionedFreestreamValue_;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("freestreamVelocity");
111 
112 
113  // Constructors
114 
115  //- Construct from patch, internal field and dictionary
117  (
118  const fvPatch&,
120  const dictionary&
121  );
122 
123  //- Construct by mapping given freestreamVelocityFvPatchVectorField onto
124  // a new patch
126  (
128  const fvPatch&,
130  const fieldMapper&
131  );
132 
133  //- Disallow copy without setting internal field reference
135  (
137  ) = delete;
138 
139  //- Copy constructor setting internal field reference
141  (
144  );
145 
146  //- Construct and return a clone setting internal field reference
148  (
150  ) const
151  {
153  (
155  );
156  }
157 
158 
159  // Member Functions
160 
161  const vectorField& freestreamValue() const
162  {
163  return refValue();
164  }
165 
167  {
168  return refValue();
169  }
170 
171 
172  // Mapping functions
173 
174  //- Map the given fvPatchField onto this fvPatchField
175  virtual void map(const fvPatchVectorField&, const fieldMapper&);
176 
177  //- Reset the fvPatchField to the given fvPatchField
178  // Used for mesh to mesh mapping
179  virtual void reset(const fvPatchVectorField&);
180 
181 
182  // Evaluation functions
183 
184  //- Update the coefficients associated with the patch field
185  virtual void updateCoeffs();
186 
187 
188  //- Write
189  virtual void write(Ostream&) const;
190 
191 
192  // Member Operators
193 
194  //- Inherit assignment
195  using mixedFvPatchVectorField::operator=;
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
This boundary condition provides a free-stream condition for velocity.
TypeName("freestreamVelocity")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, fvMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual void map(const fvPatchVectorField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
freestreamVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, fvMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:90
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Field< vector > vectorField
Specialisation of Field<T> for vector.