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

wedgeFvPatchField.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 "wedgeFvPatch.H"
00028 #include "wedgeFvPatchField.H"
00029 #include "transformField.H"
00030 #include "symmTransform.H"
00031 #include "diagTensor.H"
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 template<class Type>
00041 wedgeFvPatchField<Type>::wedgeFvPatchField
00042 (
00043     const fvPatch& p,
00044     const DimensionedField<Type, volMesh>& iF
00045 )
00046 :
00047     transformFvPatchField<Type>(p, iF)
00048 {}
00049 
00050 
00051 template<class Type>
00052 wedgeFvPatchField<Type>::wedgeFvPatchField
00053 (
00054     const wedgeFvPatchField<Type>& ptf,
00055     const fvPatch& p,
00056     const DimensionedField<Type, volMesh>& iF,
00057     const fvPatchFieldMapper& mapper
00058 )
00059 :
00060     transformFvPatchField<Type>(ptf, p, iF, mapper)
00061 {
00062     if (!isType<wedgeFvPatch>(this->patch()))
00063     {
00064         FatalErrorIn
00065         (
00066             "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
00067             "(\n"
00068             "    const wedgeFvPatchField<Type>& ptf,\n"
00069             "    const fvPatch& p,\n"
00070             "    const DimensionedField<Type, volMesh>& iF,\n"
00071             "    const fvPatchFieldMapper& mapper\n"
00072             ")\n"
00073         )   << "\n    patch type '" << p.type()
00074             << "' not constraint type '" << typeName << "'"
00075             << "\n    for patch " << p.name()
00076             << " of field " << this->dimensionedInternalField().name()
00077             << " in file " << this->dimensionedInternalField().objectPath()
00078             << exit(FatalIOError);
00079     }
00080 }
00081 
00082 
00083 template<class Type>
00084 wedgeFvPatchField<Type>::wedgeFvPatchField
00085 (
00086     const fvPatch& p,
00087     const DimensionedField<Type, volMesh>& iF,
00088     const dictionary& dict
00089 )
00090 :
00091     transformFvPatchField<Type>(p, iF, dict)
00092 {
00093     if (!isType<wedgeFvPatch>(p))
00094     {
00095         FatalIOErrorIn
00096         (
00097             "wedgeFvPatchField<Type>::wedgeFvPatchField\n"
00098             "(\n"
00099             "    const fvPatch& p,\n"
00100             "    const Field<Type>& field,\n"
00101             "    dictionary& dict\n"
00102             ")\n",
00103             dict
00104         )   << "\n    patch type '" << p.type()
00105             << "' not constraint type '" << typeName << "'"
00106             << "\n    for patch " << p.name()
00107             << " of field " << this->dimensionedInternalField().name()
00108             << " in file " << this->dimensionedInternalField().objectPath()
00109             << exit(FatalIOError);
00110     }
00111 
00112     evaluate();
00113 }
00114 
00115 
00116 template<class Type>
00117 wedgeFvPatchField<Type>::wedgeFvPatchField
00118 (
00119     const wedgeFvPatchField<Type>& ptf
00120 )
00121 :
00122     transformFvPatchField<Type>(ptf)
00123 {}
00124 
00125 
00126 template<class Type>
00127 wedgeFvPatchField<Type>::wedgeFvPatchField
00128 (
00129     const wedgeFvPatchField<Type>& ptf,
00130     const DimensionedField<Type, volMesh>& iF
00131 )
00132 :
00133     transformFvPatchField<Type>(ptf, iF)
00134 {}
00135 
00136 
00137 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00138 
00139 template<class Type>
00140 tmp<Field<Type> > wedgeFvPatchField<Type>::snGrad() const
00141 {
00142     Field<Type> pif = this->patchInternalField();
00143     return
00144     (
00145         transform(refCast<const wedgeFvPatch>(this->patch()).cellT(), pif) - pif
00146     )*(0.5*this->patch().deltaCoeffs());
00147 }
00148 
00149 
00150 template<class Type>
00151 void wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
00152 {
00153     if (!this->updated())
00154     {
00155         this->updateCoeffs();
00156     }
00157 
00158     fvPatchField<Type>::operator==
00159     (
00160         transform
00161         (
00162             refCast<const wedgeFvPatch>(this->patch()).faceT(),
00163             this->patchInternalField()
00164         )
00165     );
00166 }
00167 
00168 
00169 template<class Type>
00170 tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
00171 {
00172     diagTensor diagT = 
00173         0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
00174 
00175     return tmp<Field<Type> >
00176     (
00177         new Field<Type>
00178         (
00179             this->size(),
00180             transformMask<Type>
00181             (
00182                 pow
00183                 (
00184                     reinterpret_cast<const vector&>(diagT),
00185                     pTraits<typename powProduct<vector, pTraits<Type>::rank>
00186                     ::type>::zero
00187                 )
00188             )
00189         )
00190     );
00191 }
00192 
00193 
00194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00195 
00196 } // End namespace Foam
00197 
00198 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd