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

freestreamPressureFvPatchScalarField.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 "freestreamPressureFvPatchScalarField.H"
00027 #include <finiteVolume/freestreamFvPatchFields.H>
00028 #include <finiteVolume/fvPatchFieldMapper.H>
00029 #include <finiteVolume/volFields.H>
00030 #include <finiteVolume/surfaceFields.H>
00031 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00032 
00033 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 freestreamPressureFvPatchScalarField::freestreamPressureFvPatchScalarField
00041 (
00042     const fvPatch& p,
00043     const DimensionedField<scalar, volMesh>& iF
00044 )
00045 :
00046     zeroGradientFvPatchScalarField(p, iF)
00047 {}
00048 
00049 
00050 freestreamPressureFvPatchScalarField::freestreamPressureFvPatchScalarField
00051 (
00052     const freestreamPressureFvPatchScalarField& ptf,
00053     const fvPatch& p,
00054     const DimensionedField<scalar, volMesh>& iF,
00055     const fvPatchFieldMapper& mapper
00056 )
00057 :
00058     zeroGradientFvPatchScalarField(ptf, p, iF, mapper)
00059 {}
00060 
00061 
00062 freestreamPressureFvPatchScalarField::freestreamPressureFvPatchScalarField
00063 (
00064     const fvPatch& p,
00065     const DimensionedField<scalar, volMesh>& iF,
00066     const dictionary& dict
00067 )
00068 :
00069     zeroGradientFvPatchScalarField(p, iF, dict)
00070 {}
00071 
00072 
00073 freestreamPressureFvPatchScalarField::freestreamPressureFvPatchScalarField
00074 (
00075     const freestreamPressureFvPatchScalarField& wbppsf
00076 )
00077 :
00078     zeroGradientFvPatchScalarField(wbppsf)
00079 {}
00080 
00081 
00082 freestreamPressureFvPatchScalarField::freestreamPressureFvPatchScalarField
00083 (
00084     const freestreamPressureFvPatchScalarField& wbppsf,
00085     const DimensionedField<scalar, volMesh>& iF
00086 )
00087 :
00088     zeroGradientFvPatchScalarField(wbppsf, iF)
00089 {}
00090 
00091 
00092 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00093 
00094 void freestreamPressureFvPatchScalarField::updateCoeffs()
00095 {
00096     if (updated())
00097     {
00098         return;
00099     }
00100 
00101     const freestreamFvPatchVectorField& Up = 
00102         refCast<const freestreamFvPatchVectorField>
00103         (
00104             patch().lookupPatchField<volVectorField, vector>("U")
00105         );
00106 
00107     const surfaceScalarField& phi = 
00108         db().lookupObject<surfaceScalarField>("phi");
00109 
00110     fvsPatchField<scalar>& phip =
00111         const_cast<fvsPatchField<scalar>&>
00112         (
00113             patch().patchField<surfaceScalarField, scalar>(phi)
00114         );
00115 
00116     if (phi.dimensions() == dimVelocity*dimArea)
00117     {
00118         phip = patch().Sf() & Up.freestreamValue();
00119     }
00120     else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
00121     {
00122         const fvPatchField<scalar>& rhop =
00123             patch().lookupPatchField<volScalarField, scalar>("rho");
00124 
00125         phip = rhop*(patch().Sf() & Up.freestreamValue());
00126     }
00127     else
00128     {
00129         FatalErrorIn("freestreamPressureFvPatchScalarField::updateCoeffs()")
00130             << "dimensions of phi are not correct"
00131             << "\n    on patch " << this->patch().name()
00132             << " of field " << this->dimensionedInternalField().name()
00133             << " in file " << this->dimensionedInternalField().objectPath()
00134             << exit(FatalError);
00135     }
00136 
00137     zeroGradientFvPatchScalarField::updateCoeffs();
00138 }
00139 
00140 
00141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00142 
00143 makePatchTypeField(fvPatchScalarField, freestreamPressureFvPatchScalarField);
00144 
00145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00146 
00147 } // End namespace Foam
00148 
00149 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines