1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Foam::advectiveFvPatchField
28 Advective outflow boundary condition based on solving DDt(psi, U) = 0
31 The standard (Euler, backward, CrankNicholson) time schemes are
32 supported. Additionally an optional mechanism to relax the value at
33 the boundary to a specified far-field value is provided which is
34 switched on by specifying the relaxation length-scale lInf and the
35 far-field value fieldInf.
37 The flow/wave speed at the outlet is provided by the virtual function
38 advectionSpeed() the default implementation of which requires the name of
39 flux field a the outlet (phi) and optionally the density (rho) if the
40 mass-flux rather than the volumetric-flux is given.
46 // rho rho; // Not needed, phi volumetric
47 // fieldInf 1e5; // Optional
48 // lInf 0.1; // Optional
52 The flow/wave speed at the outlet can be changed by deriving a specialised
53 BC fron this class and overriding advectionSpeed() e.g. in
54 waveTransmissiveFvPatchField the advectionSpeed() calculates and returns
55 the flow-speed plus the acoustic wave speed creating an acoustic wave
56 transmissive boundary condition.
59 advectiveFvPatchField.C
61 \*---------------------------------------------------------------------------*/
63 #ifndef advectiveFvPatchField_H
64 #define advectiveFvPatchField_H
66 #include "mixedFvPatchFields.H"
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 /*---------------------------------------------------------------------------*\
74 Class advectiveFvPatch Declaration
75 \*---------------------------------------------------------------------------*/
78 class advectiveFvPatchField
80 public mixedFvPatchField<Type>
86 //- Name of the flux transporting the field
89 //- Name of the density field used to normalise the mass flux
93 //- Field value of the far-field
96 //- Relaxation length-scale
102 //- Runtime type information
103 TypeName("advective");
108 //- Construct from patch and internal field
109 advectiveFvPatchField
112 const DimensionedField<Type, volMesh>&
115 //- Construct from patch, internal field and dictionary
116 advectiveFvPatchField
119 const DimensionedField<Type, volMesh>&,
123 //- Construct by mapping given advectiveFvPatchField
125 advectiveFvPatchField
127 const advectiveFvPatchField<Type>&,
129 const DimensionedField<Type, volMesh>&,
130 const fvPatchFieldMapper&
133 //- Construct as copy
134 advectiveFvPatchField
136 const advectiveFvPatchField&
139 //- Construct and return a clone
140 virtual tmp<fvPatchField<Type> > clone() const
142 return tmp<fvPatchField<Type> >
144 new advectiveFvPatchField<Type>(*this)
148 //- Construct as copy setting internal field reference
149 advectiveFvPatchField
151 const advectiveFvPatchField&,
152 const DimensionedField<Type, volMesh>&
155 //- Construct and return a clone setting internal field reference
156 virtual tmp<fvPatchField<Type> > clone
158 const DimensionedField<Type, volMesh>& iF
161 return tmp<fvPatchField<Type> >
163 new advectiveFvPatchField<Type>(*this, iF)
172 //- Return the field at infinity
173 const Type& fieldInf() const
178 //- Return reference to the field at infinity to allow adjustment
184 //- Return the relaxation length-scale
190 //- Return reference to the relaxation length-scale
191 // to allow adjustment
198 // Evaluation functions
200 //- Calculate and return the advection speed at the boundary
201 virtual tmp<scalarField> advectionSpeed() const;
203 //- Update the coefficients associated with the patch field
204 virtual void updateCoeffs();
208 virtual void write(Ostream&) const;
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 } // End namespace Foam
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 # include "advectiveFvPatchField.C"
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 // ************************************************************************* //