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