00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::advectiveFvPatchField 00026 00027 Description 00028 Advective outflow boundary condition based on solving DDt(psi, U) = 0 00029 at the boundary. 00030 00031 The standard (Euler, backward, CrankNicholson) time schemes are 00032 supported. Additionally an optional mechanism to relax the value at 00033 the boundary to a specified far-field value is provided which is 00034 switched on by specifying the relaxation length-scale lInf and the 00035 far-field value fieldInf. 00036 00037 The flow/wave speed at the outlet is provided by the virtual function 00038 advectionSpeed() the default implementation of which requires the name of 00039 flux field a the outlet (phi) and optionally the density (rho) if the 00040 mass-flux rather than the volumetric-flux is given. 00041 @verbatim 00042 outlet 00043 { 00044 type advective; 00045 phi phi; 00046 // rho rho; // Not needed, phi volumetric 00047 // fieldInf 1e5; // Optional 00048 // lInf 0.1; // Optional 00049 } 00050 @endverbatim 00051 00052 The flow/wave speed at the outlet can be changed by deriving a specialised 00053 BC fron this class and overriding advectionSpeed() e.g. in 00054 waveTransmissiveFvPatchField the advectionSpeed() calculates and returns 00055 the flow-speed plus the acoustic wave speed creating an acoustic wave 00056 transmissive boundary condition. 00057 00058 SourceFiles 00059 advectiveFvPatchField.C 00060 00061 \*---------------------------------------------------------------------------*/ 00062 00063 #ifndef advectiveFvPatchField_H 00064 #define advectiveFvPatchField_H 00065 00066 #include <finiteVolume/mixedFvPatchFields.H> 00067 00068 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00069 00070 namespace Foam 00071 { 00072 00073 /*---------------------------------------------------------------------------*\ 00074 Class advectiveFvPatch Declaration 00075 \*---------------------------------------------------------------------------*/ 00076 00077 template<class Type> 00078 class advectiveFvPatchField 00079 : 00080 public mixedFvPatchField<Type> 00081 { 00082 protected: 00083 00084 // Private data 00085 00086 //- Name of the flux transporting the field 00087 word phiName_; 00088 00089 //- Name of the density field used to normalise the mass flux 00090 // if neccessary 00091 word rhoName_; 00092 00093 //- Field value of the far-field 00094 Type fieldInf_; 00095 00096 //- Relaxation length-scale 00097 scalar lInf_; 00098 00099 00100 public: 00101 00102 //- Runtime type information 00103 TypeName("advective"); 00104 00105 00106 // Constructors 00107 00108 //- Construct from patch and internal field 00109 advectiveFvPatchField 00110 ( 00111 const fvPatch&, 00112 const DimensionedField<Type, volMesh>& 00113 ); 00114 00115 //- Construct from patch, internal field and dictionary 00116 advectiveFvPatchField 00117 ( 00118 const fvPatch&, 00119 const DimensionedField<Type, volMesh>&, 00120 const dictionary& 00121 ); 00122 00123 //- Construct by mapping given advectiveFvPatchField 00124 // onto a new patch 00125 advectiveFvPatchField 00126 ( 00127 const advectiveFvPatchField<Type>&, 00128 const fvPatch&, 00129 const DimensionedField<Type, volMesh>&, 00130 const fvPatchFieldMapper& 00131 ); 00132 00133 //- Construct as copy 00134 advectiveFvPatchField 00135 ( 00136 const advectiveFvPatchField& 00137 ); 00138 00139 //- Construct and return a clone 00140 virtual tmp<fvPatchField<Type> > clone() const 00141 { 00142 return tmp<fvPatchField<Type> > 00143 ( 00144 new advectiveFvPatchField<Type>(*this) 00145 ); 00146 } 00147 00148 //- Construct as copy setting internal field reference 00149 advectiveFvPatchField 00150 ( 00151 const advectiveFvPatchField&, 00152 const DimensionedField<Type, volMesh>& 00153 ); 00154 00155 //- Construct and return a clone setting internal field reference 00156 virtual tmp<fvPatchField<Type> > clone 00157 ( 00158 const DimensionedField<Type, volMesh>& iF 00159 ) const 00160 { 00161 return tmp<fvPatchField<Type> > 00162 ( 00163 new advectiveFvPatchField<Type>(*this, iF) 00164 ); 00165 } 00166 00167 00168 // Member functions 00169 00170 // Access 00171 00172 //- Return the field at infinity 00173 const Type& fieldInf() const 00174 { 00175 return fieldInf_; 00176 } 00177 00178 //- Return reference to the field at infinity to allow adjustment 00179 Type& fieldInf() 00180 { 00181 return fieldInf_; 00182 } 00183 00184 //- Return the relaxation length-scale 00185 scalar lInf() const 00186 { 00187 return lInf_; 00188 } 00189 00190 //- Return reference to the relaxation length-scale 00191 // to allow adjustment 00192 scalar& lInf() 00193 { 00194 return lInf_; 00195 } 00196 00197 00198 // Evaluation functions 00199 00200 //- Calculate and return the advection speed at the boundary 00201 virtual tmp<scalarField> advectionSpeed() const; 00202 00203 //- Update the coefficients associated with the patch field 00204 virtual void updateCoeffs(); 00205 00206 00207 //- Write 00208 virtual void write(Ostream&) const; 00209 }; 00210 00211 00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00213 00214 } // End namespace Foam 00215 00216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00217 00218 #ifdef NoRepository 00219 # include <finiteVolume/advectiveFvPatchField.C> 00220 #endif 00221 00222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00223 00224 #endif 00225 00226 // ************************ vim: set sw=4 sts=4 et: ************************ //