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

basicSymmetryFvPatchField.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 "basicSymmetryFvPatchField.H"
00027 #include <OpenFOAM/symmTransformField.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00035 
00036 template<class Type>
00037 basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
00038 (
00039     const fvPatch& p,
00040     const DimensionedField<Type, volMesh>& iF
00041 )
00042 :
00043     transformFvPatchField<Type>(p, iF)
00044 {}
00045 
00046 
00047 template<class Type>
00048 basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
00049 (
00050     const basicSymmetryFvPatchField<Type>& ptf,
00051     const fvPatch& p,
00052     const DimensionedField<Type, volMesh>& iF,
00053     const fvPatchFieldMapper& mapper
00054 )
00055 :
00056     transformFvPatchField<Type>(ptf, p, iF, mapper)
00057 {}
00058 
00059 
00060 template<class Type>
00061 basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
00062 (
00063     const fvPatch& p,
00064     const DimensionedField<Type, volMesh>& iF,
00065     const dictionary& dict
00066 )
00067 :
00068     transformFvPatchField<Type>(p, iF, dict)
00069 {
00070     this->evaluate();
00071 }
00072 
00073 
00074 template<class Type>
00075 basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
00076 (
00077     const basicSymmetryFvPatchField<Type>& ptf
00078 )
00079 :
00080     transformFvPatchField<Type>(ptf)
00081 {}
00082 
00083 
00084 template<class Type>
00085 basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
00086 (
00087     const basicSymmetryFvPatchField<Type>& ptf,
00088     const DimensionedField<Type, volMesh>& iF
00089 )
00090 :
00091     transformFvPatchField<Type>(ptf, iF)
00092 {}
00093 
00094 
00095 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00096 
00097 // return gradient at boundary
00098 template<class Type>
00099 tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const
00100 {
00101     vectorField nHat = this->patch().nf();
00102     return
00103     (
00104         transform(I - 2.0*sqr(nHat), this->patchInternalField())
00105       - this->patchInternalField()
00106     )*(this->patch().deltaCoeffs()/2.0);
00107 }
00108 
00109 
00110 // Evaluate the field on the patch
00111 template<class Type>
00112 void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
00113 {
00114     if (!this->updated())
00115     {
00116         this->updateCoeffs();
00117     }
00118 
00119     vectorField nHat = this->patch().nf();
00120     Field<Type>::operator=
00121     (
00122         (
00123             this->patchInternalField()
00124           + transform(I - 2.0*sqr(nHat), this->patchInternalField())
00125         )/2.0
00126     );
00127 
00128     transformFvPatchField<Type>::evaluate();
00129 }
00130 
00131 
00132 // Return defining fields
00133 template<class Type>
00134 tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGradTransformDiag() const
00135 {
00136     vectorField nHat = this->patch().nf();
00137     vectorField diag(nHat.size());
00138 
00139     diag.replace(vector::X, mag(nHat.component(vector::X)));
00140     diag.replace(vector::Y, mag(nHat.component(vector::Y)));
00141     diag.replace(vector::Z, mag(nHat.component(vector::Z)));
00142 
00143     return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
00144 }
00145 
00146 
00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00148 
00149 } // End namespace Foam
00150 
00151 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines