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

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