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  (
137  const waveTransmissiveFvPatchField<Type>&,
138  const fvPatch&,
139  const DimensionedField<Type, volMesh>&,
141  );
142 
143  //- Construct as copy
145  (
147  );
148 
149  //- Construct and return a clone
150  virtual tmp<fvPatchField<Type>> clone() const
151  {
152  return tmp<fvPatchField<Type>>
153  (
155  );
156  }
157 
158  //- Construct as copy setting internal field reference
160  (
163  );
164 
165  //- Construct and return a clone setting internal field reference
167  (
169  ) const
170  {
171  return tmp<fvPatchField<Type>>
172  (
174  );
175  }
176 
177 
178  // Member functions
179 
180  // Access
181 
182  //- Return the heat capacity ratio
183  scalar gamma() const
184  {
185  return gamma_;
186  }
187 
188  //- Return reference to the heat capacity ratio to allow adjustment
189  scalar& gamma()
190  {
191  return gamma_;
192  }
193 
194 
195  // Evaluation functions
196 
197  //- Calculate and return the advection speed at the boundary
198  virtual tmp<scalarField> advectionSpeed() const;
199 
200 
201  //- Write
202  virtual void write(Ostream&) const;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #ifdef NoRepository
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
waveTransmissiveFvPatchField.C
advectiveFvPatchFields.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::waveTransmissiveFvPatchField::write
virtual void write(Ostream &) const
Write.
Definition: waveTransmissiveFvPatchField.C:141
Foam::waveTransmissiveFvPatchField::waveTransmissiveFvPatchField
waveTransmissiveFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: waveTransmissiveFvPatchField.C:41
Foam::waveTransmissiveFvPatchField::gamma
scalar gamma() const
Return the heat capacity ratio.
Definition: waveTransmissiveFvPatchField.H:227
Foam::waveTransmissiveFvPatchField::advectionSpeed
virtual tmp< scalarField > advectionSpeed() const
Calculate and return the advection speed at the boundary.
Definition: waveTransmissiveFvPatchField.C:110
Foam::waveTransmissiveFvPatchField::gamma
scalar & gamma()
Return reference to the heat capacity ratio to allow adjustment.
Definition: waveTransmissiveFvPatchField.H:233
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::waveTransmissiveFvPatchField::clone
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
Definition: waveTransmissiveFvPatchField.H:194
Foam::waveTransmissiveFvPatchField::TypeName
TypeName("waveTransmissive")
Runtime type information.
Foam::waveTransmissiveFvPatchField
This boundary condition provides a wave transmissive outflow condition, based on solving DDt(W,...
Definition: waveTransmissiveFvPatchField.H:140
Foam::advectiveFvPatchField
This boundary condition provides an advective outflow condition, based on solving DDt(W,...
Definition: advectiveFvPatchField.H:120
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54