waveTransmissiveFvPatchField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 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 Description
28  This boundary condition provides a wave transmissive outflow condition,
29  based on solving DDt(W, field) = 0 at the boundary \c W is the wave velocity
30  and \c field is the field to which this boundary condition is applied.
31 
32  The wave speed is calculated using:
33 
34  \f[
35  w_p = \frac{\phi_p}{|Sf|} + \sqrt{\frac{\gamma}{\psi_p}}
36  \f]
37 
38  where
39 
40  \vartable
41  w_p | patch wave speed
42  \phi_p | patch face flux
43  \psi_p | patch compressibility
44  Sf | patch face area vector
45  \gamma | ratio of specific heats
46  \endvartable
47 
48 Usage
49  \table
50  Property | Description | Required | Default value
51  phi | flux field name | no | phi
52  rho | density field name | no | rho
53  psi | compressibility field name | no | psi
54  gamma | ratio of specific heats (Cp/Cv) | yes |
55  \endtable
56 
57  Example of the boundary condition specification:
58  \verbatim
59  <patchName>
60  {
61  type waveTransmissive;
62  phi phi;
63  psi psi;
64  gamma 1.4;
65  }
66  \endverbatim
67 
68 See also
69  Foam::advectiveFvPatchField
70 
71 SourceFiles
72  waveTransmissiveFvPatchField.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef waveTransmissiveFvPatchField_H
77 #define waveTransmissiveFvPatchField_H
78 
79 #include "advectiveFvPatchFields.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class waveTransmissiveFvPatchField Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 template<class Type>
91 class waveTransmissiveFvPatchField
92 :
93  public advectiveFvPatchField<Type>
94 {
95 
96  // Private Data
97 
98  //- Name of the compressibility field used to calculate the wave speed
99  word psiName_;
100 
101  //- Heat capacity ratio
102  scalar gamma_;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("waveTransmissive");
109 
110 
111  // Constructors
112 
113  //- Construct from patch, internal field and dictionary
115  (
116  const fvPatch&,
117  const DimensionedField<Type, volMesh>&,
118  const dictionary&
119  );
120 
121  //- Construct by mapping given waveTransmissiveFvPatchField
122  // onto a new patch
124  (
125  const waveTransmissiveFvPatchField<Type>&,
126  const fvPatch&,
127  const DimensionedField<Type, volMesh>&,
128  const fvPatchFieldMapper&
129  );
130 
131  //- Disallow copy without setting internal field reference
133  (
135  ) = delete;
136 
137  //- Copy constructor setting internal field reference
139  (
142  );
143 
144  //- Construct and return a clone setting internal field reference
146  (
148  ) const
149  {
150  return tmp<fvPatchField<Type>>
151  (
153  );
154  }
155 
156 
157  // Member Functions
158 
159  // Access
160 
161  //- Return the heat capacity ratio
162  scalar gamma() const
163  {
164  return gamma_;
165  }
166 
167  //- Return reference to the heat capacity ratio to allow adjustment
168  scalar& gamma()
169  {
170  return gamma_;
171  }
172 
173 
174  // Evaluation functions
175 
176  //- Calculate and return the advection speed at the boundary
177  virtual tmp<scalarField> advectionSpeed() const;
178 
179 
180  //- Write
181  virtual void write(Ostream&) const;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
tmp< fvPatchField< Type > > clone() const
Disallow clone without setting internal field reference.
Definition: fvPatchField.H:203
A class for managing temporary objects.
Definition: tmp.H:55
This boundary condition provides a wave transmissive outflow condition, based on solving DDt(W,...
waveTransmissiveFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void write(Ostream &) const
Write.
virtual tmp< scalarField > advectionSpeed() const
Calculate and return the advection speed at the boundary.
scalar gamma() const
Return the heat capacity ratio.
TypeName("waveTransmissive")
Runtime type information.
Namespace for OpenFOAM.