advectiveFvPatchField.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::advectiveFvPatchField
28
29Group
30 grpOutletBoundaryConditions
31
32Description
33 This boundary condition provides an advective outflow condition, based on
34 solving DDt(W, field) = 0 at the boundary where \c W is the wave velocity
35 and \c field is the field to which this boundary condition is applied.
36
37 The standard (Euler, backward, CrankNicolson, localEuler) time schemes are
38 supported. Additionally an optional mechanism to relax the value at
39 the boundary to a specified far-field value is provided which is
40 switched on by specifying the relaxation length-scale \c lInf and the
41 far-field value \c fieldInf.
42
43 The flow/wave speed \c (w) at the outlet is provided by the virtual function
44 advectionSpeed() the default implementation of which requires the name of
45 the flux field \c (phi) and optionally the density \c (rho) if the
46 mass-flux rather than the volumetric-flux is given.
47
48 The flow/wave speed at the outlet can be changed by deriving a specialised
49 BC from this class and over-riding advectionSpeed() e.g. in
50 waveTransmissiveFvPatchField the advectionSpeed() calculates and returns
51 the flow-speed plus the acoustic wave speed creating an acoustic wave
52 transmissive boundary condition.
53
54Usage
55 \table
56 Property | Description | Required | Default value
57 phi | flux field name | no | phi
58 rho | density field name | no | rho
59 fieldInf | value of field beyond patch | no |
60 lInf | distance beyond patch for \c fieldInf | no |
61 \endtable
62
63 Example of the boundary condition specification:
64 \verbatim
65 <patchName>
66 {
67 type advective;
68 phi phi;
69 }
70 \endverbatim
71
72Note
73 If \c lInf is specified, \c fieldInf will be required; \c rho is only
74 required in the case of a mass-based flux.
75
76SourceFiles
77 advectiveFvPatchField.C
78
79\*---------------------------------------------------------------------------*/
80
81#ifndef advectiveFvPatchField_H
82#define advectiveFvPatchField_H
83
84#include "mixedFvPatchFields.H"
85
86// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87
88namespace Foam
89{
90
91/*---------------------------------------------------------------------------*\
92 Class advectiveFvPatchField Declaration
93\*---------------------------------------------------------------------------*/
94
95template<class Type>
96class advectiveFvPatchField
97:
98 public mixedFvPatchField<Type>
99{
100protected:
101
102 // Private data
103
104 //- Name of the flux transporting the field
105 word phiName_;
106
107 //- Name of the density field used to normalise the mass flux
108 //- if necessary
109 word rhoName_;
110
111 //- Field value of the far-field
112 Type fieldInf_;
113
114 //- Relaxation length-scale
115 scalar lInf_;
116
117
118public:
119
120 //- Runtime type information
121 TypeName("advective");
122
123
124 // Constructors
125
126 //- Construct from patch and internal field
128 (
129 const fvPatch&,
131 );
132
133 //- Construct from patch, internal field and dictionary
135 (
136 const fvPatch&,
138 const dictionary&
139 );
140
141 //- Construct by mapping given advectiveFvPatchField
142 // onto a new patch
144 (
146 const fvPatch&,
148 const fvPatchFieldMapper&
149 );
150
151 //- Construct as copy
153 (
155 );
156
157 //- Construct and return a clone
158 virtual tmp<fvPatchField<Type>> clone() const
159 {
161 (
163 );
164 }
165
166 //- Construct as copy setting internal field reference
168 (
171 );
172
173 //- Construct and return a clone setting internal field reference
175 (
177 ) const
178 {
180 (
181 new advectiveFvPatchField<Type>(*this, iF)
182 );
183 }
184
185
186 // Member functions
187
188 // Access
189
190 //- Return the field at infinity
191 const Type& fieldInf() const
192 {
193 return fieldInf_;
194 }
195
196 //- Return reference to the field at infinity to allow adjustment
197 Type& fieldInf()
199 return fieldInf_;
200 }
201
202 //- Return the relaxation length-scale
203 scalar lInf() const
204 {
205 return lInf_;
206 }
207
208 //- Return reference to the relaxation length-scale
209 // to allow adjustment
210 scalar& lInf()
211 {
212 return lInf_;
213 }
214
216 // Evaluation functions
217
218 //- Calculate and return the advection speed at the boundary
219 virtual tmp<scalarField> advectionSpeed() const;
220
221 //- Update the coefficients associated with the patch field
222 virtual void updateCoeffs();
223
224
225 //- Write
226 virtual void write(Ostream&) const;
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232} // End namespace Foam
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#ifdef NoRepository
237 #include "advectiveFvPatchField.C"
238#endif
239
240// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241
242#endif
243
244// ************************************************************************* //
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:62
This boundary condition provides an advective outflow condition, based on solving DDt(W,...
TypeName("advective")
Runtime type information.
const Type & fieldInf() const
Return the field at infinity.
scalar lInf_
Relaxation length-scale.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
word phiName_
Name of the flux transporting the field.
Type fieldInf_
Field value of the far-field.
virtual tmp< scalarField > advectionSpeed() const
Calculate and return the advection speed at the boundary.
Type & fieldInf()
Return reference to the field at infinity to allow adjustment.
scalar lInf() const
Return the relaxation length-scale.
virtual tmp< fvPatchField< Type > > clone() const
Construct and return a clone.
advectiveFvPatchField(const advectiveFvPatchField< Type > &, const fvPatch &, const DimensionedField< Type, volMesh > &, const fvPatchFieldMapper &)
Construct by mapping given advectiveFvPatchField.
virtual tmp< fvPatchField< Type > > clone(const DimensionedField< Type, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a base class for 'mixed' type boundary conditions,...
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73