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

uniformDensityHydrostaticPressureFvPatchScalarField.H

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 Class
00025     Foam::uniformDensityHydrostaticPressureFvPatchScalarField
00026 
00027 Description
00028     Hydrostatic pressure boundary condition calculated as
00029 
00030     pRefValue + rho*g.(x - pRefPoint)
00031 
00032     where rho is provided and assumed uniform.
00033 
00034 SourceFiles
00035     uniformDensityHydrostaticPressureFvPatchScalarField.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef uniformDensityHydrostaticPressureFvPatchScalarField_H
00040 #define uniformDensityHydrostaticPressureFvPatchScalarField_H
00041 
00042 #include <finiteVolume/fixedValueFvPatchFields.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050           Class uniformDensityHydrostaticPressureFvPatch Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class uniformDensityHydrostaticPressureFvPatchScalarField
00054 :
00055     public fixedValueFvPatchScalarField
00056 {
00057     // Private data
00058 
00059         //- Constant density in the far-field
00060         scalar rho_;
00061 
00062         //- Reference pressure
00063         scalar pRefValue_;
00064 
00065         //- Reference pressure location
00066         vector pRefPoint_;
00067 
00068 
00069 public:
00070 
00071     //- Runtime type information
00072     TypeName("uniformDensityHydrostaticPressure");
00073 
00074 
00075     // Constructors
00076 
00077         //- Construct from patch and internal field
00078         uniformDensityHydrostaticPressureFvPatchScalarField
00079         (
00080             const fvPatch&,
00081             const DimensionedField<scalar, volMesh>&
00082         );
00083 
00084         //- Construct from patch, internal field and dictionary
00085         uniformDensityHydrostaticPressureFvPatchScalarField
00086         (
00087             const fvPatch&,
00088             const DimensionedField<scalar, volMesh>&,
00089             const dictionary&
00090         );
00091 
00092         //- Construct by mapping given
00093         //  uniformDensityHydrostaticPressureFvPatchScalarField onto a new patch
00094         uniformDensityHydrostaticPressureFvPatchScalarField
00095         (
00096             const uniformDensityHydrostaticPressureFvPatchScalarField&,
00097             const fvPatch&,
00098             const DimensionedField<scalar, volMesh>&,
00099             const fvPatchFieldMapper&
00100         );
00101 
00102         //- Construct as copy
00103         uniformDensityHydrostaticPressureFvPatchScalarField
00104         (
00105             const uniformDensityHydrostaticPressureFvPatchScalarField&
00106         );
00107 
00108         //- Construct and return a clone
00109         virtual tmp<fvPatchScalarField> clone() const
00110         {
00111             return tmp<fvPatchScalarField>
00112             (
00113                 new uniformDensityHydrostaticPressureFvPatchScalarField(*this)
00114             );
00115         }
00116 
00117         //- Construct as copy setting internal field reference
00118         uniformDensityHydrostaticPressureFvPatchScalarField
00119         (
00120             const uniformDensityHydrostaticPressureFvPatchScalarField&,
00121             const DimensionedField<scalar, volMesh>&
00122         );
00123 
00124         //- Construct and return a clone setting internal field reference
00125         virtual tmp<fvPatchScalarField> clone
00126         (
00127             const DimensionedField<scalar, volMesh>& iF
00128         ) const
00129         {
00130             return tmp<fvPatchScalarField>
00131             (
00132                 new uniformDensityHydrostaticPressureFvPatchScalarField
00133                 (
00134                     *this,
00135                     iF
00136                 )
00137             );
00138         }
00139 
00140 
00141     // Member functions
00142 
00143         // Access
00144 
00145             //- Return the constant density in the far-field
00146             scalar rho() const
00147             {
00148                 return rho_;
00149             }
00150 
00151             //- Return reference to the constant density in the far-field
00152             //  to allow adjustment
00153             scalar& rho()
00154             {
00155                 return rho_;
00156             }
00157 
00158             //- Return the reference pressure
00159             scalar pRefValue() const
00160             {
00161                 return pRefValue_;
00162             }
00163 
00164             //- Return reference to the reference pressure to allow adjustment
00165             scalar& pRefValue()
00166             {
00167                 return pRefValue_;
00168             }
00169 
00170             //- Return the pressure reference location
00171             const vector& pRefPoint() const
00172             {
00173                 return pRefPoint_;
00174             }
00175 
00176             //- Return reference to the pressure reference location
00177             //  to allow adjustment
00178             vector& pRefPoint()
00179             {
00180                 return pRefPoint_;
00181             }
00182 
00183 
00184         // Evaluation functions
00185 
00186             //- Update the coefficients associated with the patch field
00187             virtual void updateCoeffs();
00188 
00189 
00190         //- Write
00191         virtual void write(Ostream&) const;
00192 };
00193 
00194 
00195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00196 
00197 } // End namespace Foam
00198 
00199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00200 
00201 #endif
00202 
00203 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines