OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

outletInletFvPatchField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "outletInletFvPatchField.H"
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00035 
00036 template<class Type>
00037 outletInletFvPatchField<Type>::outletInletFvPatchField
00038 (
00039     const fvPatch& p,
00040     const DimensionedField<Type, volMesh>& iF
00041 )
00042 :
00043     mixedFvPatchField<Type>(p, iF)
00044 {
00045     this->refValue() = *this;
00046     this->refGrad() = pTraits<Type>::zero;
00047     this->valueFraction() = 0.0;
00048 }
00049 
00050 
00051 template<class Type>
00052 outletInletFvPatchField<Type>::outletInletFvPatchField
00053 (
00054     const outletInletFvPatchField<Type>& ptf,
00055     const fvPatch& p,
00056     const DimensionedField<Type, volMesh>& iF,
00057     const fvPatchFieldMapper& mapper
00058 )
00059 :
00060     mixedFvPatchField<Type>(ptf, p, iF, mapper)
00061 {}
00062 
00063 
00064 template<class Type>
00065 outletInletFvPatchField<Type>::outletInletFvPatchField
00066 (
00067     const fvPatch& p,
00068     const DimensionedField<Type, volMesh>& iF,
00069     const dictionary& dict
00070 )
00071 :
00072     mixedFvPatchField<Type>(p, iF)
00073 {
00074     this->refValue() = Field<Type>("outletValue", dict, p.size());
00075 
00076     if (dict.found("value"))
00077     {
00078         fvPatchField<Type>::operator=
00079         (
00080             Field<Type>("value", dict, p.size())
00081         );
00082     }
00083     else
00084     {
00085         fvPatchField<Type>::operator=(this->refValue());
00086     }
00087 
00088     this->refGrad() = pTraits<Type>::zero;
00089     this->valueFraction() = 0.0;
00090 }
00091 
00092 
00093 template<class Type>
00094 outletInletFvPatchField<Type>::outletInletFvPatchField
00095 (
00096     const outletInletFvPatchField<Type>& ptf
00097 )
00098 :
00099     mixedFvPatchField<Type>(ptf)
00100 {}
00101 
00102 
00103 template<class Type>
00104 outletInletFvPatchField<Type>::outletInletFvPatchField
00105 (
00106     const outletInletFvPatchField<Type>& ptf,
00107     const DimensionedField<Type, volMesh>& iF
00108 )
00109 :
00110     mixedFvPatchField<Type>(ptf, iF)
00111 {}
00112 
00113 
00114 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00115 
00116 template<class Type>
00117 void outletInletFvPatchField<Type>::updateCoeffs()
00118 {
00119     if (this->updated())
00120     {
00121         return;
00122     }
00123 
00124     const fvsPatchField<scalar>& phip = this->patch().lookupPatchField
00125     (
00126         "phi",
00127         reinterpret_cast<const surfaceScalarField*>(0),
00128         reinterpret_cast<const scalar*>(0)
00129     );
00130 
00131     this->valueFraction() = pos(phip);
00132 
00133     mixedFvPatchField<Type>::updateCoeffs();
00134 }
00135 
00136 
00137 template<class Type>
00138 void outletInletFvPatchField<Type>::write(Ostream& os) const
00139 {
00140     fvPatchField<Type>::write(os);
00141     this->refValue().writeEntry("outletValue", os);
00142     this->writeEntry("value", os);
00143 }
00144 
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 } // End namespace Foam
00149 
00150 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd