freestreamFvPatchField.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) 2011-2023 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::freestreamFvPatchField
26 
27 Description
28  This boundary condition provides a free-stream condition. It is a 'mixed'
29  condition derived from the \c inletOutlet condition, whereby the mode of
30  operation switches between fixed (free stream) value and zero gradient
31  based on the sign of the flux.
32 
33 Usage
34  \table
35  Property | Description | Required | Default value
36  freestreamValue | freestream velocity | yes |
37  phi | flux field name | no | phi
38  \endtable
39 
40  Example of the boundary condition specification:
41  \verbatim
42  <patchName>
43  {
44  type freestream;
45  freestreamValue uniform (300 0 0);
46  }
47  \endverbatim
48 
49 See also
50  Foam::mixedFvPatchField
51  Foam::inletOutletFvPatchField
52 
53 SourceFiles
54  freestreamFvPatchField.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef freestreamFvPatchField_H
59 #define freestreamFvPatchField_H
60 
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class freestreamFvPatchField Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 template<class Type>
73 class freestreamFvPatchField
74 :
75  public inletOutletFvPatchField<Type>
76 {
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("freestream");
82 
83 
84  // Constructors
85 
86  //- Construct from patch, internal field and dictionary
88  (
89  const fvPatch&,
91  const dictionary&
92  );
93 
94  //- Construct by mapping given freestreamFvPatchField onto a new patch
96  (
98  const fvPatch&,
100  const fvPatchFieldMapper&
101  );
102 
103  //- Disallow copy without setting internal field reference
105  (
107  ) = delete;
108 
109  //- Copy constructor setting internal field reference
111  (
114  );
115 
116  //- Construct and return a clone setting internal field reference
118  (
120  ) const
121  {
122  return tmp<fvPatchField<Type>>
123  (
124  new freestreamFvPatchField<Type>(*this, iF)
125  );
126  }
127 
128 
129  // Member Functions
130 
131  // Return defining fields
132 
133  const Field<Type>& freestreamValue() const
134  {
135  return this->refValue();
136  }
137 
139  {
140  return this->refValue();
141  }
142 
143 
144  //- Write
145  virtual void write(Ostream&) const;
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #ifdef NoRepository
156  #include "freestreamFvPatchField.C"
157 #endif
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:82
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition provides a free-stream condition. It is a 'mixed' condition derived from the ...
virtual void write(Ostream &) const
Write.
TypeName("freestream")
Runtime type information.
freestreamFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
const Field< Type > & freestreamValue() const
Foam::fvPatchFieldMapper.
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
virtual Field< Type > & refValue()
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.