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

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