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

wedgePointPatchField.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 "wedgePointPatchField.H"
00028 #include "transformField.H"
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00036 
00037 template<class Type>
00038 wedgePointPatchField<Type>::wedgePointPatchField
00039 (
00040     const pointPatch& p,
00041     const DimensionedField<Type, pointMesh>& iF
00042 )
00043 :
00044     pointPatchField<Type>(p, iF)
00045 {}
00046 
00047 
00048 template<class Type>
00049 wedgePointPatchField<Type>::wedgePointPatchField
00050 (
00051     const pointPatch& p,
00052     const DimensionedField<Type, pointMesh>& iF,
00053     const dictionary& dict
00054 )
00055 :
00056     pointPatchField<Type>(p, iF, dict)
00057 {
00058     if (!isType<wedgePointPatch>(p))
00059     {
00060         FatalIOErrorIn
00061         (
00062             "wedgePointPatchField<Type>::wedgePointPatchField\n"
00063             "(\n"
00064             "    const pointPatch& p,\n"
00065             "    const Field<Type>& field,\n"
00066             "    const dictionary& dict\n"
00067             ")\n",
00068             dict
00069         )   << "patch " << this->patch().index() << " not wedge type. "
00070             << "Patch type = " << p.type()
00071             << exit(FatalIOError);
00072     }
00073 }
00074 
00075 
00076 template<class Type>
00077 wedgePointPatchField<Type>::wedgePointPatchField
00078 (
00079     const wedgePointPatchField<Type>& ptf,
00080     const pointPatch& p,
00081     const DimensionedField<Type, pointMesh>& iF,
00082     const pointPatchFieldMapper&
00083 )
00084 :
00085     pointPatchField<Type>(p, iF)
00086 {
00087     if (!isType<wedgePointPatch>(this->patch()))
00088     {
00089         FatalErrorIn
00090         (
00091             "wedgePointPatchField<Type>::wedgePointPatchField\n"
00092             "(\n"
00093             "    const wedgePointPatchField<Type>& ptf,\n"
00094             "    const pointPatch& p,\n"
00095             "    const DimensionedField<Type, pointMesh>& iF,\n"
00096             "    const pointPatchFieldMapper& mapper\n"
00097             ")\n"
00098         )   << "Field type does not correspond to patch type for patch "
00099             << this->patch().index() << "." << endl
00100             << "Field type: " << typeName << endl
00101             << "Patch type: " << this->patch().type()
00102             << exit(FatalError);
00103     }
00104 }
00105 
00106 
00107 template<class Type>
00108 wedgePointPatchField<Type>::wedgePointPatchField
00109 (
00110     const wedgePointPatchField<Type>& ptf,
00111     const DimensionedField<Type, pointMesh>& iF
00112 )
00113 :
00114     pointPatchField<Type>(ptf, iF)
00115 {}
00116 
00117 
00118 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00119 
00120 template<class Type>
00121 void wedgePointPatchField<Type>::evaluate(const Pstream::commsTypes)
00122 {
00123     // In order to ensure that the wedge patch is always flat, take the
00124     // normal vector from the first point
00125     const vector& nHat = this->patch().pointNormals()[0];
00126 
00127     tmp<Field<Type> > tvalues =
00128         transform(I - nHat*nHat, this->patchInternalField());
00129 
00130     // Get internal field to insert values into
00131     Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
00132 
00133     setInInternalField(iF, tvalues());
00134 }
00135 
00136 
00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00138 
00139 } // End namespace Foam
00140 
00141 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd