Merge commit 'd3b269b7c6ffa0cd68845adfecdfb849316dba71' into nextRelease
[foam-extend-3.2.git] / src / engine / derivedFvPatchFields / engineMassFlowRateInletVelocity / engineMassFlowRateInletVelocityFvPatchVectorField.H
blob218db7cd22978b4cad2c759fb98ecc04e8b39290
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     engineMassFlowRateInletVelocityFvPatchVectorField
27 Description
28     Describes an massflow normal vector boundary condition by its magnitude
29     as an integral over its area.
30     The current density is used to correct the velocity.
31     Note: The value is positive inwards
33     Example of the BC specification:
35         inlet
36         {
37             type            massFlowRateInletVelocity;
38             massFlowRate    0.2;     // Mass flow rate [kg/s]
39         }
41 NOTE!
42  * may not work correctly for transonic inlets!
43  * strange behaviour with potentialFoam since the U equation is not solved
45 SourceFiles
46     engineMassFlowRateInletVelocityFvPatchVectorField.C
48 \*---------------------------------------------------------------------------*/
50 #ifndef engineMassFlowRateInletVelocityFvPatchVectorField_H
51 #define engineMassFlowRateInletVelocityFvPatchVectorField_H
53 #include "fixedValueFvPatchFields.H"
54 #include "engineTime.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 namespace Foam
60 /*---------------------------------------------------------------------------*\
61           Class massFlowRateInletVelocityFvPatchField Declaration
62 \*---------------------------------------------------------------------------*/
63 class graph;
65 class engineMassFlowRateInletVelocityFvPatchVectorField
67     public fixedValueFvPatchVectorField
69     // Private data
71         //- Name of the flux transporting the field
72         word phiName_;
74         //- Name of the density field used to normalize the mass flux
75         word rhoName_;
77         fileName timeDataFileName_;
78         autoPtr<graph> timeDataPtr_;
80         const engineTime& engineDB_;
82         void checkTable();
85 public:
87    //- Runtime type information
88    TypeName("engineMassFlowRateInletVelocity");
91    // Constructors
93         //- Construct from patch and internal field
94         engineMassFlowRateInletVelocityFvPatchVectorField
95         (
96             const fvPatch&,
97             const DimensionedField<vector, volMesh>&
98         );
100         //- Construct from patch, internal field and dictionary
101         engineMassFlowRateInletVelocityFvPatchVectorField
102         (
103             const fvPatch&,
104             const DimensionedField<vector, volMesh>&,
105             const dictionary&
106         );
108         //- Construct by mapping given
109         //  engineMassFlowRateInletVelocityFvPatchVectorField
110         //  onto a new patch
111         engineMassFlowRateInletVelocityFvPatchVectorField
112         (
113             const engineMassFlowRateInletVelocityFvPatchVectorField&,
114             const fvPatch&,
115             const DimensionedField<vector, volMesh>&,
116             const fvPatchFieldMapper&
117         );
119         //- Construct as copy
120         engineMassFlowRateInletVelocityFvPatchVectorField
121         (
122             const engineMassFlowRateInletVelocityFvPatchVectorField&
123         );
125         //- Construct and return a clone
126         virtual tmp<fvPatchVectorField> clone() const
127         {
128             return tmp<fvPatchVectorField>
129             (
130                 new engineMassFlowRateInletVelocityFvPatchVectorField(*this)
131             );
132         }
134         //- Construct as copy setting internal field reference
135         engineMassFlowRateInletVelocityFvPatchVectorField
136         (
137             const engineMassFlowRateInletVelocityFvPatchVectorField&,
138             const DimensionedField<vector, volMesh>&
139         );
141         //- Construct and return a clone setting internal field reference
142         virtual tmp<fvPatchVectorField> clone
143         (
144             const DimensionedField<vector, volMesh>& iF
145         ) const
146         {
147             return tmp<fvPatchVectorField>
148             (
149                 new engineMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
150             );
151         }
154     // Member functions
156         // Access
158             //- Return the fluctuation scale
159             const graph& timeData() const
160             {
161                 return timeDataPtr_;
162             }
165             //- Return reference to the fluctuation scale to allow adjustment
166             graph& timeData()
167             {
168                 return timeDataPtr_;
169             }
171             const engineTime& engineDB() const
172             {
173                 return engineDB_;
174             }
177         //- Update the coefficients associated with the patch field
178         virtual void updateCoeffs();
180         //- Write
181         virtual void write(Ostream&) const;
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #endif
194 // ************************************************************************* //