initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / derived / uniformDensityHydrostaticPressure / uniformDensityHydrostaticPressureFvPatchScalarField.H
blob8b129fe3ab3ac5e9bc834f38f9124ffd53742454
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::uniformDensityHydrostaticPressureFvPatchScalarField
28 Description
29     Hydrostatic pressure boundary condition calculated as
31     pRefValue + rho*g.(x - pRefPoint)
33     where rho is provided and assumed uniform.
35 SourceFiles
36     uniformDensityHydrostaticPressureFvPatchScalarField.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef uniformDensityHydrostaticPressureFvPatchScalarField_H
41 #define uniformDensityHydrostaticPressureFvPatchScalarField_H
43 #include "fixedValueFvPatchFields.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51           Class uniformDensityHydrostaticPressureFvPatch Declaration
52 \*---------------------------------------------------------------------------*/
54 class uniformDensityHydrostaticPressureFvPatchScalarField
56     public fixedValueFvPatchScalarField
58     // Private data
60         //- Constant density in the far-field
61         scalar rho_;
63         //- Reference pressure
64         scalar pRefValue_;
66         //- Reference pressure location
67         vector pRefPoint_;
70 public:
72     //- Runtime type information
73     TypeName("uniformDensityHydrostaticPressure");
76     // Constructors
78         //- Construct from patch and internal field
79         uniformDensityHydrostaticPressureFvPatchScalarField
80         (
81             const fvPatch&,
82             const DimensionedField<scalar, volMesh>&
83         );
85         //- Construct from patch, internal field and dictionary
86         uniformDensityHydrostaticPressureFvPatchScalarField
87         (
88             const fvPatch&,
89             const DimensionedField<scalar, volMesh>&,
90             const dictionary&
91         );
93         //- Construct by mapping given
94         //  uniformDensityHydrostaticPressureFvPatchScalarField onto a new patch
95         uniformDensityHydrostaticPressureFvPatchScalarField
96         (
97             const uniformDensityHydrostaticPressureFvPatchScalarField&,
98             const fvPatch&,
99             const DimensionedField<scalar, volMesh>&,
100             const fvPatchFieldMapper&
101         );
103         //- Construct as copy
104         uniformDensityHydrostaticPressureFvPatchScalarField
105         (
106             const uniformDensityHydrostaticPressureFvPatchScalarField&
107         );
109         //- Construct and return a clone
110         virtual tmp<fvPatchScalarField> clone() const
111         {
112             return tmp<fvPatchScalarField>
113             (
114                 new uniformDensityHydrostaticPressureFvPatchScalarField(*this)
115             );
116         }
118         //- Construct as copy setting internal field reference
119         uniformDensityHydrostaticPressureFvPatchScalarField
120         (
121             const uniformDensityHydrostaticPressureFvPatchScalarField&,
122             const DimensionedField<scalar, volMesh>&
123         );
125         //- Construct and return a clone setting internal field reference
126         virtual tmp<fvPatchScalarField> clone
127         (
128             const DimensionedField<scalar, volMesh>& iF
129         ) const
130         {
131             return tmp<fvPatchScalarField>
132             (
133                 new uniformDensityHydrostaticPressureFvPatchScalarField
134                 (
135                     *this,
136                     iF
137                 )
138             );
139         }
142     // Member functions
144         // Access
146             //- Return the constant density in the far-field
147             scalar rho() const
148             {
149                 return rho_;
150             }
152             //- Return reference to the constant density in the far-field
153             //  to allow adjustment
154             scalar& rho()
155             {
156                 return rho_;
157             }
159             //- Return the reference pressure
160             scalar pRefValue() const
161             {
162                 return pRefValue_;
163             }
165             //- Return reference to the reference pressure to allow adjustment
166             scalar& pRefValue()
167             {
168                 return pRefValue_;
169             }
171             //- Return the pressure reference location
172             const vector& pRefPoint() const
173             {
174                 return pRefPoint_;
175             }
177             //- Return reference to the pressure reference location
178             //  to allow adjustment
179             vector& pRefPoint()
180             {
181                 return pRefPoint_;
182             }
185         // Evaluation functions
187             //- Update the coefficients associated with the patch field
188             virtual void updateCoeffs();
191         //- Write
192         virtual void write(Ostream&) const;
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 } // End namespace Foam
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 #endif
204 // ************************************************************************* //