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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::waveTransmissiveFvPatchField
28 
29 Group
30  grpOutletBoundaryConditions
31 
32 Description
33  This boundary condition provides a wave transmissive outflow condition,
34  based on solving DDt(W, field) = 0 at the boundary \c W is the wave velocity
35  and \c field is the field to which this boundary condition is applied.
36 
37  The wave speed is calculated using:
38 
39  \f[
40  w_p = \frac{\phi_p}{|Sf|} + \sqrt{\frac{\gamma}{\psi_p}}
41  \f]
42 
43  where
44 
45  \vartable
46  w_p | patch wave speed
47  \phi_p | patch face flux
48  \psi_p | patch compressibility
49  Sf | patch face area vector
50  \gamma | ratio of specific heats
51  \endvartable
52 
53 Usage
54  \table
55  Property | Description | Required | Default value
56  phi | flux field name | no | phi
57  rho | density field name | no | rho
58  psi | compressibility field name | no | thermo:psi
59  gamma | ratio of specific heats (Cp/Cv) | yes |
60  \endtable
61 
62  Example of the boundary condition specification:
63  \verbatim
64  <patchName>
65  {
66  type waveTransmissive;
67  phi phi;
68  psi psi;
69  gamma 1.4;
70  }
71  \endverbatim
72 
73 See also
74  Foam::advectiveFvPatchField
75 
76 SourceFiles
77  waveTransmissiveFvPatchField.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef waveTransmissiveFvPatchField_H
82 #define waveTransmissiveFvPatchField_H
83 
84 #include "advectiveFvPatchFields.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class waveTransmissiveFvPatchField Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 template<class Type>
96 class waveTransmissiveFvPatchField
97 :
98  public advectiveFvPatchField<Type>
99 {
100 
101  // Private data
102 
103  //- Name of the compressibility field used to calculate the wave speed
104  word psiName_;
105 
106  //- Heat capacity ratio
107  scalar gamma_;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("waveTransmissive");
114 
115 
116  // Constructors
117 
118  //- Construct from patch and internal field
120  (
121  const fvPatch&,
122  const DimensionedField<Type, volMesh>&
123  );
124 
125  //- Construct from patch, internal field and dictionary
127  (
128  const fvPatch&,
129  const DimensionedField<Type, volMesh>&,
130  const dictionary&
131  );
132 
133  //- Construct by mapping given waveTransmissiveFvPatchField
134  // onto a new patch
136  (
138  const fvPatch&,
140  const fvPatchFieldMapper&
141  );
142 
143  //- Construct as copy
145  (
147  );
148 
149  //- Construct as copy setting internal field reference
151  (
154  );
155 
156  //- Return a clone
157  virtual tmp<fvPatchField<Type>> clone() const
158  {
159  return fvPatchField<Type>::Clone(*this);
160  }
161 
162  //- Clone with an internal field reference
164  (
166  ) const
167  {
168  return fvPatchField<Type>::Clone(*this, iF);
169  }
170 
171 
172  // Member functions
173 
174  // Access
175 
176  //- Return the heat capacity ratio
177  scalar gamma() const
178  {
179  return gamma_;
180  }
181 
182  //- Return reference to the heat capacity ratio to allow adjustment
183  scalar& gamma()
184  {
185  return gamma_;
186  }
187 
188 
189  // Evaluation functions
190 
191  //- Calculate and return the advection speed at the boundary
192  virtual tmp<scalarField> advectionSpeed() const;
193 
194 
195  //- Write
196  virtual void write(Ostream&) const;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
TypeName("waveTransmissive")
Runtime type information.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
waveTransmissiveFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
A FieldMapper for finite-volume patch fields.
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
Return a clone.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
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...