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-2018 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  //- Construct as copy
140  (
142  );
143 
144  //- Construct and return a clone
145  virtual tmp<fvPatchField<Type>> clone() const
146  {
147  return tmp<fvPatchField<Type>>
148  (
150  );
151  }
152 
153  //- Construct as copy setting internal field reference
155  (
158  );
159 
160  //- Construct and return a clone setting internal field reference
162  (
164  ) const
165  {
166  return tmp<fvPatchField<Type>>
167  (
169  );
170  }
171 
172 
173  // Member functions
174 
175  // Access
176 
177  //- Return the heat capacity ratio
178  scalar gamma() const
179  {
180  return gamma_;
181  }
182 
183  //- Return reference to the heat capacity ratio to allow adjustment
184  scalar& gamma()
185  {
186  return gamma_;
187  }
188 
190  // Evaluation functions
191 
192  //- Calculate and return the advection speed at the boundary
193  virtual tmp<scalarField> advectionSpeed() const;
194 
195 
196  //- Write
197  virtual void write(Ostream&) const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 #ifdef NoRepository
209 #endif
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
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:53
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...
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
A class for managing temporary objects.
Definition: PtrList.H:53
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...