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

translatingWallVelocityFvPatchVectorField.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 "translatingWallVelocityFvPatchVectorField.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/volFields.H>
00029 #include <finiteVolume/surfaceFields.H>
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00037 
00038 translatingWallVelocityFvPatchVectorField::
00039 translatingWallVelocityFvPatchVectorField
00040 (
00041     const fvPatch& p,
00042     const DimensionedField<vector, volMesh>& iF
00043 )
00044 :
00045     fixedValueFvPatchField<vector>(p, iF),
00046     U_(vector::zero)
00047 {}
00048 
00049 
00050 translatingWallVelocityFvPatchVectorField::
00051 translatingWallVelocityFvPatchVectorField
00052 (
00053     const translatingWallVelocityFvPatchVectorField& ptf,
00054     const fvPatch& p,
00055     const DimensionedField<vector, volMesh>& iF,
00056     const fvPatchFieldMapper& mapper
00057 )
00058 :
00059     fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
00060     U_(ptf.U_)
00061 {}
00062 
00063 
00064 translatingWallVelocityFvPatchVectorField::
00065 translatingWallVelocityFvPatchVectorField
00066 (
00067     const fvPatch& p,
00068     const DimensionedField<vector, volMesh>& iF,
00069     const dictionary& dict
00070 )
00071 :
00072     fixedValueFvPatchField<vector>(p, iF),
00073     U_(dict.lookup("U"))
00074 {
00075     // Evaluate the wall velocity
00076     updateCoeffs();
00077 }
00078 
00079 
00080 translatingWallVelocityFvPatchVectorField::
00081 translatingWallVelocityFvPatchVectorField
00082 (
00083     const translatingWallVelocityFvPatchVectorField& twvpvf
00084 )
00085 :
00086     fixedValueFvPatchField<vector>(twvpvf),
00087     U_(twvpvf.U_)
00088 {}
00089 
00090 
00091 translatingWallVelocityFvPatchVectorField::
00092 translatingWallVelocityFvPatchVectorField
00093 (
00094     const translatingWallVelocityFvPatchVectorField& twvpvf,
00095     const DimensionedField<vector, volMesh>& iF
00096 )
00097 :
00098     fixedValueFvPatchField<vector>(twvpvf, iF),
00099     U_(twvpvf.U_)
00100 {}
00101 
00102 
00103 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00104 
00105 void translatingWallVelocityFvPatchVectorField::updateCoeffs()
00106 {
00107     if (updated())
00108     {
00109         return;
00110     }
00111 
00112     // Remove the component of U normal to the wall in case the wall is not flat
00113     vectorField n = patch().nf();
00114     vectorField::operator=(U_ - n*(n & U_));
00115 
00116     fixedValueFvPatchVectorField::updateCoeffs();
00117 }
00118 
00119 
00120 void translatingWallVelocityFvPatchVectorField::write(Ostream& os) const
00121 {
00122     fvPatchVectorField::write(os);
00123     os.writeKeyword("U") << U_ << token::END_STATEMENT << nl;
00124     writeEntry("value", os);
00125 }
00126 
00127 
00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00129 
00130 makePatchTypeField
00131 (
00132     fvPatchVectorField,
00133     translatingWallVelocityFvPatchVectorField
00134 );
00135 
00136 
00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00138 
00139 } // End namespace Foam
00140 
00141 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines