FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

coupledFvPatchField.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-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 \*---------------------------------------------------------------------------*/
00025 
00026 #include <finiteVolume/coupledFvPatchField.H>
00027 
00028 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00029 
00030 namespace Foam
00031 {
00032 
00033 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00034 
00035 template<class Type>
00036 coupledFvPatchField<Type>::coupledFvPatchField
00037 (
00038     const fvPatch& p,
00039     const DimensionedField<Type, volMesh>& iF
00040 )
00041 :
00042     lduInterfaceField(refCast<const lduInterface>(p)),
00043     fvPatchField<Type>(p, iF)
00044 {}
00045 
00046 
00047 template<class Type>
00048 coupledFvPatchField<Type>::coupledFvPatchField
00049 (
00050     const fvPatch& p,
00051     const DimensionedField<Type, volMesh>& iF,
00052     const Field<Type>& f
00053 )
00054 :
00055     lduInterfaceField(refCast<const lduInterface>(p)),
00056     fvPatchField<Type>(p, iF, f)
00057 {}
00058 
00059 
00060 template<class Type>
00061 coupledFvPatchField<Type>::coupledFvPatchField
00062 (
00063     const coupledFvPatchField<Type>& ptf,
00064     const fvPatch& p,
00065     const DimensionedField<Type, volMesh>& iF,
00066     const fvPatchFieldMapper& mapper
00067 )
00068 :
00069     lduInterfaceField(refCast<const lduInterface>(p)),
00070     fvPatchField<Type>(ptf, p, iF, mapper)
00071 {}
00072 
00073 
00074 template<class Type>
00075 coupledFvPatchField<Type>::coupledFvPatchField
00076 (
00077     const fvPatch& p,
00078     const DimensionedField<Type, volMesh>& iF,
00079     const dictionary& dict
00080 )
00081 :
00082     lduInterfaceField(refCast<const lduInterface>(p)),
00083     fvPatchField<Type>(p, iF, dict)
00084 {}
00085 
00086 
00087 template<class Type>
00088 coupledFvPatchField<Type>::coupledFvPatchField
00089 (
00090     const coupledFvPatchField<Type>& ptf
00091 )
00092 :
00093     lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
00094     fvPatchField<Type>(ptf)
00095 {}
00096 
00097 
00098 template<class Type>
00099 coupledFvPatchField<Type>::coupledFvPatchField
00100 (
00101     const coupledFvPatchField<Type>& ptf,
00102     const DimensionedField<Type, volMesh>& iF
00103 )
00104 :
00105     lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
00106     fvPatchField<Type>(ptf, iF)
00107 {}
00108 
00109 
00110 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00111 
00112 template<class Type>
00113 tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const
00114 {
00115     return
00116         (this->patchNeighbourField() - this->patchInternalField())
00117        *this->patch().deltaCoeffs();
00118 }
00119 
00120 
00121 template<class Type>
00122 void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
00123 {
00124     if (!this->updated())
00125     {
00126         this->updateCoeffs();
00127     }
00128 }
00129 
00130 
00131 template<class Type>
00132 void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
00133 {
00134     if (!this->updated())
00135     {
00136         this->updateCoeffs();
00137     }
00138 
00139     Field<Type>::operator=
00140     (
00141         this->patch().weights()*this->patchInternalField()
00142       + (1.0 - this->patch().weights())*this->patchNeighbourField()
00143     );
00144 
00145     fvPatchField<Type>::evaluate();
00146 }
00147 
00148 
00149 template<class Type>
00150 tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
00151 (
00152     const tmp<scalarField>& w
00153 ) const
00154 {
00155     return Type(pTraits<Type>::one)*w;
00156 }
00157 
00158 template<class Type>
00159 tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
00160 (
00161     const tmp<scalarField>& w
00162 ) const
00163 {
00164     return Type(pTraits<Type>::one)*(1.0 - w);
00165 }
00166 
00167 template<class Type>
00168 tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs() const
00169 {
00170     return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
00171 }
00172 
00173 
00174 template<class Type>
00175 tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
00176 {
00177     return -this->gradientInternalCoeffs();
00178 }
00179 
00180 
00181 template<class Type>
00182 void coupledFvPatchField<Type>::write(Ostream& os) const
00183 {
00184     fvPatchField<Type>::write(os);
00185     this->writeEntry("value", os);
00186 }
00187 
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 } // End namespace Foam
00192 
00193 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines