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