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

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