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

rotatingWallVelocityFvPatchVectorField.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 "rotatingWallVelocityFvPatchVectorField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "volFields.H"
00030 #include "surfaceFields.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00038 
00039 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
00040 (
00041     const fvPatch& p,
00042     const DimensionedField<vector, volMesh>& iF
00043 )
00044 :
00045     fixedValueFvPatchField<vector>(p, iF),
00046     origin_(vector::zero),
00047     axis_(vector::zero),
00048     omega_(0)
00049 {}
00050 
00051 
00052 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
00053 (
00054     const rotatingWallVelocityFvPatchVectorField& ptf,
00055     const fvPatch& p,
00056     const DimensionedField<vector, volMesh>& iF,
00057     const fvPatchFieldMapper& mapper
00058 )
00059 :
00060     fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
00061     origin_(ptf.origin_),
00062     axis_(ptf.axis_),
00063     omega_(ptf.omega_)
00064 {}
00065 
00066 
00067 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
00068 (
00069     const fvPatch& p,
00070     const DimensionedField<vector, volMesh>& iF,
00071     const dictionary& dict
00072 )
00073 :
00074     fixedValueFvPatchField<vector>(p, iF),
00075     origin_(dict.lookup("origin")),
00076     axis_(dict.lookup("axis")),
00077     omega_(readScalar(dict.lookup("omega")))
00078 {
00079     // Evaluate the wall velocity
00080     updateCoeffs();
00081 }
00082 
00083 
00084 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
00085 (
00086     const rotatingWallVelocityFvPatchVectorField& pivpvf
00087 )
00088 :
00089     fixedValueFvPatchField<vector>(pivpvf),
00090     origin_(pivpvf.origin_),
00091     axis_(pivpvf.axis_),
00092     omega_(pivpvf.omega_)
00093 {}
00094 
00095 
00096 rotatingWallVelocityFvPatchVectorField::rotatingWallVelocityFvPatchVectorField
00097 (
00098     const rotatingWallVelocityFvPatchVectorField& pivpvf,
00099     const DimensionedField<vector, volMesh>& iF
00100 )
00101 :
00102     fixedValueFvPatchField<vector>(pivpvf, iF),
00103     origin_(pivpvf.origin_),
00104     axis_(pivpvf.axis_),
00105     omega_(pivpvf.omega_)
00106 {}
00107 
00108 
00109 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00110 
00111 void rotatingWallVelocityFvPatchVectorField::updateCoeffs()
00112 {
00113     if (updated())
00114     {
00115         return;
00116     }
00117 
00118     // Calculate the rotating wall velocity from the specification of the motion
00119     vectorField Up = (-omega_)*((patch().Cf() - origin_) ^ (axis_/mag(axis_)));
00120 
00121     // Remove the component of Up normal to the wall
00122     // just in case it is not exactly circular
00123     vectorField n = patch().nf();
00124     vectorField::operator=(Up - n*(n & Up));
00125 
00126     fixedValueFvPatchVectorField::updateCoeffs();
00127 }
00128 
00129 
00130 void rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const
00131 {
00132     fvPatchVectorField::write(os);
00133     os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
00134     os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
00135     os.writeKeyword("omega") << omega_ << token::END_STATEMENT << nl;
00136     writeEntry("value", os);
00137 }
00138 
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 makePatchTypeField
00143 (
00144     fvPatchVectorField,
00145     rotatingWallVelocityFvPatchVectorField
00146 );
00147 
00148 
00149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00150 
00151 } // End namespace Foam
00152 
00153 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd