waveTransmissiveFvPatchField.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-2020 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::waveTransmissiveFvPatchField
26 
27 Description
28  This boundary condition provides a wave transmissive outflow condition,
29  based on solving DDt(W, field) = 0 at the boundary \c W is the wave velocity
30  and \c field is the field to which this boundary condition is applied.
31 
32  The wave speed is calculated using:
33 
34  \f[
35  w_p = \frac{\phi_p}{|Sf|} + \sqrt{\frac{\gamma}{\psi_p}}
36  \f]
37 
38  where
39 
40  \vartable
41  w_p | patch wave speed
42  \phi_p | patch face flux
43  \psi_p | patch compressibility
44  Sf | patch face area vector
45  \gamma | ratio of specific heats
46  \endvartable
47 
48 Usage
49  \table
50  Property | Description | Required | Default value
51  phi | flux field name | no | phi
52  rho | density field name | no | rho
53  psi | compressibility field name | no | thermo:psi
54  gamma | ratio of specific heats (Cp/Cv) | yes |
55  \endtable
56 
57  Example of the boundary condition specification:
58  \verbatim
59  <patchName>
60  {
61  type waveTransmissive;
62  phi phi;
63  psi psi;
64  gamma 1.4;
65  }
66  \endverbatim
67 
68 See also
69  Foam::advectiveFvPatchField
70 
71 SourceFiles
72  waveTransmissiveFvPatchField.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef waveTransmissiveFvPatchField_H
77 #define waveTransmissiveFvPatchField_H
78 
79 #include "advectiveFvPatchFields.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class waveTransmissiveFvPatchField Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 template<class Type>
91 class waveTransmissiveFvPatchField
92 :
93  public advectiveFvPatchField<Type>
94 {
95 
96  // Private Data
97 
98  //- Name of the compressibility field used to calculate the wave speed
99  word psiName_;
100 
101  //- Heat capacity ratio
102  scalar gamma_;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("waveTransmissive");
109 
110 
111  // Constructors
112 
113  //- Construct from patch and internal field
115  (
116  const fvPatch&,
117  const DimensionedField<Type, volMesh>&
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
124  const DimensionedField<Type, volMesh>&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping given waveTransmissiveFvPatchField
129  // onto a new patch
131  (
132  const waveTransmissiveFvPatchField<Type>&,
133  const fvPatch&,
134  const DimensionedField<Type, volMesh>&,
136  );
137 
138  //- Disallow copy without setting internal field reference
140  (
142  ) = delete;
143 
144  //- Copy constructor setting internal field reference
146  (
149  );
150 
151  //- Construct and return a clone setting internal field reference
153  (
155  ) const
156  {
157  return tmp<fvPatchField<Type>>
158  (
160  );
161  }
162 
163 
164  // Member Functions
165 
166  // Access
167 
168  //- Return the heat capacity ratio
169  scalar gamma() const
170  {
171  return gamma_;
172  }
173 
174  //- Return reference to the heat capacity ratio to allow adjustment
175  scalar& gamma()
176  {
177  return gamma_;
178  }
179 
180 
181  // Evaluation functions
182 
183  //- Calculate and return the advection speed at the boundary
184  virtual tmp<scalarField> advectionSpeed() const;
185 
186 
187  //- Write
188  virtual void write(Ostream&) const;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 #ifdef NoRepository
200 #endif
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
TypeName("waveTransmissive")
Runtime type information.
waveTransmissiveFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual void write(Ostream &) const
Write.
virtual tmp< scalarField > advectionSpeed() const
Calculate and return the advection speed at the boundary.
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: PtrList.H:53
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:199
scalar gamma() const
Return the heat capacity ratio.
Namespace for OpenFOAM.
This boundary condition provides a wave transmissive outflow condition, based on solving DDt(W...