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

fixedNormalSlipFvPatchField.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 "fixedNormalSlipFvPatchField.H"
00027 #include <OpenFOAM/symmTransformField.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00035 
00036 template<class Type>
00037 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
00038 (
00039     const fvPatch& p,
00040     const DimensionedField<Type, volMesh>& iF
00041 )
00042 :
00043     transformFvPatchField<Type>(p, iF),
00044     fixedValue_(p.size(), pTraits<Type>::zero)
00045 {}
00046 
00047 
00048 template<class Type>
00049 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
00050 (
00051     const fixedNormalSlipFvPatchField<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     fixedValue_(ptf.fixedValue_, mapper)
00059 {}
00060 
00061 
00062 template<class Type>
00063 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
00064 (
00065     const fvPatch& p,
00066     const DimensionedField<Type, volMesh>& iF,
00067     const dictionary& dict
00068 )
00069 :
00070     transformFvPatchField<Type>(p, iF),
00071     fixedValue_("fixedValue", dict, p.size())
00072 {
00073     evaluate();
00074 }
00075 
00076 
00077 template<class Type>
00078 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
00079 (
00080     const fixedNormalSlipFvPatchField<Type>& ptf
00081 )
00082 :
00083     transformFvPatchField<Type>(ptf),
00084     fixedValue_(ptf.fixedValue_)
00085 {}
00086 
00087 
00088 template<class Type>
00089 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
00090 (
00091     const fixedNormalSlipFvPatchField<Type>& ptf,
00092     const DimensionedField<Type, volMesh>& iF
00093 )
00094 :
00095     transformFvPatchField<Type>(ptf, iF),
00096     fixedValue_(ptf.fixedValue_)
00097 {}
00098 
00099 
00100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00101 
00102 template<class Type>
00103 void fixedNormalSlipFvPatchField<Type>::autoMap
00104 (
00105     const fvPatchFieldMapper& m
00106 )
00107 {
00108     transformFvPatchField<Type>::autoMap(m);
00109     fixedValue_.autoMap(m);
00110 }
00111 
00112 
00113 template<class Type>
00114 void fixedNormalSlipFvPatchField<Type>::rmap
00115 (
00116     const fvPatchField<Type>& ptf,
00117     const labelList& addr
00118 )
00119 {
00120     transformFvPatchField<Type>::rmap(ptf, addr);
00121 
00122     const fixedNormalSlipFvPatchField<Type>& dmptf =
00123         refCast<const fixedNormalSlipFvPatchField<Type> >(ptf);
00124 
00125     fixedValue_.rmap(dmptf.fixedValue_, addr);
00126 }
00127 
00128 
00129 template<class Type>
00130 tmp<Field<Type> > fixedNormalSlipFvPatchField<Type>::snGrad() const
00131 {
00132     vectorField nHat = this->patch().nf();
00133     Field<Type> pif = this->patchInternalField();
00134 
00135     return
00136     (
00137         (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
00138     )*this->patch().deltaCoeffs();
00139 }
00140 
00141 
00142 template<class Type>
00143 void fixedNormalSlipFvPatchField<Type>::evaluate(const Pstream::commsTypes)
00144 {
00145     if (!this->updated())
00146     {
00147         this->updateCoeffs();
00148     }
00149 
00150     vectorField nHat = this->patch().nf();
00151 
00152     Field<Type>::operator=
00153     (
00154         nHat*(nHat & fixedValue_)
00155       + transform(I - sqr(nHat), this->patchInternalField())
00156     );
00157 
00158     transformFvPatchField<Type>::evaluate();
00159 }
00160 
00161 
00162 template<class Type>
00163 tmp<Field<Type> > fixedNormalSlipFvPatchField<Type>::snGradTransformDiag() const
00164 {
00165     vectorField nHat = this->patch().nf();
00166     vectorField diag(nHat.size());
00167 
00168     diag.replace(vector::X, mag(nHat.component(vector::X)));
00169     diag.replace(vector::Y, mag(nHat.component(vector::Y)));
00170     diag.replace(vector::Z, mag(nHat.component(vector::Z)));
00171 
00172     return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
00173 }
00174 
00175 
00176 template<class Type>
00177 void fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
00178 {
00179     transformFvPatchField<Type>::write(os);
00180     fixedValue_.writeEntry("fixedValue", os);
00181 }
00182 
00183 
00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00185 
00186 } // End namespace Foam
00187 
00188 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines