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

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