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

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