Loading...
Searching...
No Matches
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>
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_;
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&,
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 as copy setting internal field reference
159 (
162 );
163
164 //- Return a clone
165 virtual tmp<fvPatchField<Type>> clone() const
166 {
167 return fvPatchField<Type>::Clone(*this);
168 }
169
170 //- Clone with an internal field reference
172 (
174 ) const
175 {
176 return fvPatchField<Type>::Clone(*this, iF);
177 }
178
179
180 // Member functions
181
182 // Access
183
184 //- Return the field at infinity
185 const Type& fieldInf() const
186 {
187 return fieldInf_;
188 }
189
190 //- Return reference to the field at infinity to allow adjustment
191 Type& fieldInf()
192 {
193 return fieldInf_;
194 }
195
196 //- Return the relaxation length-scale
197 scalar lInf() const
198 {
199 return lInf_;
200 }
201
202 //- Return reference to the relaxation length-scale
203 // to allow adjustment
204 scalar& lInf()
205 {
206 return lInf_;
207 }
209
210 // Evaluation functions
211
212 //- Calculate and return the advection speed at the boundary
213 virtual tmp<scalarField> advectionSpeed() const;
214
215 //- Update the coefficients associated with the patch field
216 virtual void updateCoeffs();
217
218
219 //- Write
220 virtual void write(Ostream&) const;
221};
222
223
224// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225
226} // End namespace Foam
227
228// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229
230#ifdef NoRepository
231 #include "advectiveFvPatchField.C"
232#endif
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
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:59
This boundary condition provides an advective outflow condition, based on solving DDt(W,...
TypeName("advective")
Runtime type information.
advectiveFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
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.
word rhoName_
Name of the density field used to normalise the mass flux if necessary.
virtual tmp< scalarField > advectionSpeed() const
Calculate and return the advection speed at the boundary.
scalar & lInf()
Return reference to the relaxation length-scale.
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
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
Clone with an internal field reference.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FieldMapper for finite-volume patch fields.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
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,...
mixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68