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

rotatingPressureInletOutletVelocityFvPatchVectorField.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 "rotatingPressureInletOutletVelocityFvPatchVectorField.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 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00037 
00038 void rotatingPressureInletOutletVelocityFvPatchVectorField::
00039 calcTangentialVelocity()
00040 {
00041     vector axisHat = omega_/mag(omega_);
00042     vectorField tangentialVelocity = 
00043         (-omega_) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf()));
00044 
00045     vectorField n = patch().nf();
00046     refValue() = tangentialVelocity - n*(n & tangentialVelocity);
00047 }
00048 
00049 
00050 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00051 
00052 rotatingPressureInletOutletVelocityFvPatchVectorField::
00053 rotatingPressureInletOutletVelocityFvPatchVectorField
00054 (
00055     const fvPatch& p,
00056     const DimensionedField<vector, volMesh>& iF
00057 )
00058 :
00059     pressureInletOutletVelocityFvPatchVectorField(p, iF),
00060     omega_(vector::zero)
00061 {}
00062 
00063 
00064 rotatingPressureInletOutletVelocityFvPatchVectorField::
00065 rotatingPressureInletOutletVelocityFvPatchVectorField
00066 (
00067     const rotatingPressureInletOutletVelocityFvPatchVectorField& ptf,
00068     const fvPatch& p,
00069     const DimensionedField<vector, volMesh>& iF,
00070     const fvPatchFieldMapper& mapper
00071 )
00072 :
00073     pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper),
00074     omega_(ptf.omega_)
00075 {
00076     calcTangentialVelocity();
00077 }
00078 
00079 
00080 rotatingPressureInletOutletVelocityFvPatchVectorField::
00081 rotatingPressureInletOutletVelocityFvPatchVectorField
00082 (
00083     const fvPatch& p,
00084     const DimensionedField<vector, volMesh>& iF,
00085     const dictionary& dict
00086 )
00087 :
00088     pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
00089     omega_(dict.lookup("omega"))
00090 {
00091     calcTangentialVelocity();
00092 }
00093 
00094 
00095 rotatingPressureInletOutletVelocityFvPatchVectorField::
00096 rotatingPressureInletOutletVelocityFvPatchVectorField
00097 (
00098     const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf
00099 )
00100 :
00101     pressureInletOutletVelocityFvPatchVectorField(pivpvf),
00102     omega_(pivpvf.omega_)
00103 {
00104     calcTangentialVelocity();
00105 }
00106 
00107 
00108 rotatingPressureInletOutletVelocityFvPatchVectorField::
00109 rotatingPressureInletOutletVelocityFvPatchVectorField
00110 (
00111     const rotatingPressureInletOutletVelocityFvPatchVectorField& pivpvf,
00112     const DimensionedField<vector, volMesh>& iF
00113 )
00114 :
00115     pressureInletOutletVelocityFvPatchVectorField(pivpvf, iF),
00116     omega_(pivpvf.omega_)
00117 {
00118     calcTangentialVelocity();
00119 }
00120 
00121 
00122 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00123 
00124 void rotatingPressureInletOutletVelocityFvPatchVectorField::
00125 write(Ostream& os) const
00126 {
00127     fvPatchVectorField::write(os);
00128     os.writeKeyword("phi") << phiName() << token::END_STATEMENT << nl;
00129     os.writeKeyword("omega")<< omega_ << token::END_STATEMENT << nl;
00130     writeEntry("value", os);
00131 }
00132 
00133 
00134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00135 
00136 makePatchTypeField
00137 (
00138     fvPatchVectorField,
00139     rotatingPressureInletOutletVelocityFvPatchVectorField
00140 );
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 } // End namespace Foam
00145 
00146 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines