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-2012 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  \heading Patch usage
51 
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 | psi
57  gamma | ratio of specific heats (Cp/Cv) | yes |
58  \endtable
59 
60  Example of the boundary condition specification:
61  \verbatim
62  myPatch
63  {
64  type waveTransmissive;
65  phi phi;
66  psi psi;
67  gamma 1.4;
68  }
69  \endverbatim
70 
71 SeeAlso
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
164  virtual tmp<fvPatchField<Type> > clone
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 
192 
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #ifdef NoRepository
212 #endif
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
Foam::waveTransmissiveFvPatchField::psiName_
word psiName_
Name of the compressibility field used to calculate the wave speed.
Definition: waveTransmissiveFvPatchField.H:146
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
waveTransmissiveFvPatchField.C
advectiveFvPatchFields.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::waveTransmissiveFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: waveTransmissiveFvPatchField.C:138
Foam::waveTransmissiveFvPatchField::waveTransmissiveFvPatchField
waveTransmissiveFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: waveTransmissiveFvPatchField.C:38
Foam::waveTransmissiveFvPatchField::gamma
scalar gamma() const
Return the heat capacity ratio.
Definition: waveTransmissiveFvPatchField.H:225
Foam::waveTransmissiveFvPatchField::advectionSpeed
virtual tmp< scalarField > advectionSpeed() const
Calculate and return the advection speed at the boundary.
Definition: waveTransmissiveFvPatchField.C:107
Foam::waveTransmissiveFvPatchField::gamma
scalar & gamma()
Return reference to the heat capacity ratio to allow adjustment.
Definition: waveTransmissiveFvPatchField.H:231
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::waveTransmissiveFvPatchField::gamma_
scalar gamma_
Heat capacity ratio.
Definition: waveTransmissiveFvPatchField.H:149
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::waveTransmissiveFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: waveTransmissiveFvPatchField.H:192
Foam::waveTransmissiveFvPatchField::TypeName
TypeName("waveTransmissive")
Runtime type information.
Foam::waveTransmissiveFvPatchField
This boundary condition provides a wave transmissive outflow condition, based onsolving DDt(psi,...
Definition: waveTransmissiveFvPatchField.H:138
Foam::advectiveFvPatchField
This boundary condition provides an advective outflow condition, based on solving DDt(psi,...
Definition: advectiveFvPatchField.H:118
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51