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

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