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

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