flowRateInletVelocityFvPatchVectorField.H 6.97 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
6
7
8
9
10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

11
12
13
14
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
15
16
17
18
19
20
21

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
23
24

Class
25
    Foam::flowRateInletVelocityFvPatchVectorField
26

andy's avatar
andy committed
27
28
Group
    grpInletBoundaryConditions
29

30
Description
31
32
33
    This boundary condition provides a velocity boundary condition, derived
    from the flux (volumetric or mass-based), whose direction is assumed
    to be normal to the patch.
Mark Olesen's avatar
Mark Olesen committed
34

35
    For a mass-based flux:
andy's avatar
andy committed
36
    - the flow rate should be provided in kg/s
37
    - if \c rhoName is "none" the flow rate is in m3/s
andy's avatar
andy committed
38
39
40
    - otherwise \c rhoName should correspond to the name of the density field
    - if the density field cannot be found in the database, the user must
      specify the inlet density using the \c rhoInlet entry
41
42

    For a volumetric-based flux:
43
44
    - the flow rate is in m3/s

andy's avatar
andy committed
45
    \heading Patch usage
46

andy's avatar
andy committed
47
    \table
48
        Property     | Description             | Required    | Default value
andy's avatar
andy committed
49
50
51
        massFlowRate | mass flow rate [kg/s]   | no          |
        volumetricFlowRate | volumetric flow rate [m3/s]| no |
        rhoInlet     | inlet density           | no          |
52
        extrapolateProfile | Extrapolate velocity profile | no | false
andy's avatar
andy committed
53
    \endtable
54

andy's avatar
andy committed
55
    Example of the boundary condition specification for a volumetric flow rate:
56
    \verbatim
57
58
    myPatch
    {
59
        type                flowRateInletVelocity;
andy's avatar
andy committed
60
        volumetricFlowRate  0.2;
61
62
        extrapolateProfile  yes;
        value               uniform (0 0 0);
63
    }
64
    \endverbatim
65

andy's avatar
andy committed
66
    Example of the boundary condition specification for a mass flow rate:
67
    \verbatim
andy's avatar
andy committed
68
    myPatch
69
70
    {
        type                flowRateInletVelocity;
andy's avatar
andy committed
71
        massFlowRate        0.2;
72
        extrapolateProfile  yes;
andy's avatar
andy committed
73
74
        rho                 rho;
        rhoInlet            1.0;
75
        value               uniform (0 0 0);
76
    }
77
    \endverbatim
78

Henry Weller's avatar
Henry Weller committed
79
    The \c flowRate entry is a \c Function1 type, meaning that it can be
80
81
    specified as constant, a polynomial fuction of time, and ...

82
Note
andy's avatar
andy committed
83
84
    - \c rhoInlet is required for the case of a mass flow rate, where the
      density field is not available at start-up
85
86
87
    - The value is positive into the domain (as an inlet)
    - May not work correctly for transonic inlets
    - Strange behaviour with potentialFoam since the U equation is not solved
88
89

SeeAlso
90
    Foam::fixedValueFvPatchField
91
    Foam::Function1Types
92
93

SourceFiles
94
    flowRateInletVelocityFvPatchVectorField.C
95
96
97

\*---------------------------------------------------------------------------*/

98
99
#ifndef flowRateInletVelocityFvPatchVectorField_H
#define flowRateInletVelocityFvPatchVectorField_H
100
101

#include "fixedValueFvPatchFields.H"
Henry Weller's avatar
Henry Weller committed
102
#include "Function1.H"
103
104
105
106
107

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
108

109
/*---------------------------------------------------------------------------*\
110
           Class flowRateInletVelocityFvPatchVectorField Declaration
111
112
\*---------------------------------------------------------------------------*/

113
class flowRateInletVelocityFvPatchVectorField
114
115
116
117
118
:
    public fixedValueFvPatchVectorField
{
    // Private data

119
        //- Inlet integral flow rate
Henry Weller's avatar
Henry Weller committed
120
        autoPtr<Function1<scalar>> flowRate_;
121

122
123
        //- Is volumetric?
        bool volumetric_;
124
125
126
127

        //- Name of the density field used to normalize the mass flux
        word rhoName_;

128
129
130
        //- Rho initialisation value (for start; if value not supplied)
        scalar rhoInlet_;

131
132
133
134
135
136
137
138
139
140
        //- Set true to extrapolate the velocity profile from the interior
        Switch extrapolateProfile_;


    // Private member functions

        //- Update the patch values given the appropriate density type and value
        template<class RhoType>
        void updateValues(const RhoType& rho);

141
142
143
144

public:

   //- Runtime type information
145
   TypeName("flowRateInletVelocity");
146
147
148
149
150


   // Constructors

        //- Construct from patch and internal field
151
        flowRateInletVelocityFvPatchVectorField
152
153
154
155
156
157
        (
            const fvPatch&,
            const DimensionedField<vector, volMesh>&
        );

        //- Construct from patch, internal field and dictionary
158
        flowRateInletVelocityFvPatchVectorField
159
160
161
162
163
164
165
        (
            const fvPatch&,
            const DimensionedField<vector, volMesh>&,
            const dictionary&
        );

        //- Construct by mapping given
166
        //  flowRateInletVelocityFvPatchVectorField
167
        //  onto a new patch
168
        flowRateInletVelocityFvPatchVectorField
169
        (
170
            const flowRateInletVelocityFvPatchVectorField&,
171
172
173
174
175
176
            const fvPatch&,
            const DimensionedField<vector, volMesh>&,
            const fvPatchFieldMapper&
        );

        //- Construct as copy
177
        flowRateInletVelocityFvPatchVectorField
178
        (
179
            const flowRateInletVelocityFvPatchVectorField&
180
181
182
183
184
185
186
        );

        //- Construct and return a clone
        virtual tmp<fvPatchVectorField> clone() const
        {
            return tmp<fvPatchVectorField>
            (
187
                new flowRateInletVelocityFvPatchVectorField(*this)
188
189
190
191
            );
        }

        //- Construct as copy setting internal field reference
192
        flowRateInletVelocityFvPatchVectorField
193
        (
194
            const flowRateInletVelocityFvPatchVectorField&,
195
196
197
198
199
200
201
202
203
204
205
            const DimensionedField<vector, volMesh>&
        );

        //- Construct and return a clone setting internal field reference
        virtual tmp<fvPatchVectorField> clone
        (
            const DimensionedField<vector, volMesh>& iF
        ) const
        {
            return tmp<fvPatchVectorField>
            (
206
                new flowRateInletVelocityFvPatchVectorField(*this, iF)
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
            );
        }


    // Member functions

        //- Update the coefficients associated with the patch field
        virtual void updateCoeffs();

        //- Write
        virtual void write(Ostream&) const;
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //