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

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