flowRateInletVelocityFvPatchVectorField.H 6.91 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

79
    The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
80

81
Note
andy's avatar
andy committed
82
83
    - \c rhoInlet is required for the case of a mass flow rate, where the
      density field is not available at start-up
84
85
86
    - 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
87
88

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

SourceFiles
93
    flowRateInletVelocityFvPatchVectorField.C
94
95
96

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

97
98
#ifndef flowRateInletVelocityFvPatchVectorField_H
#define flowRateInletVelocityFvPatchVectorField_H
99
100

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

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

namespace Foam
{
107

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

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

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

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

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

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

130
131
132
133
134
135
136
137
138
139
        //- 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);

140
141
142
143

public:

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


   // Constructors

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

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

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

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

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

        //- Construct as copy setting internal field reference
191
        flowRateInletVelocityFvPatchVectorField
192
        (
193
            const flowRateInletVelocityFvPatchVectorField&,
194
195
196
197
198
199
200
201
202
203
204
            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>
            (
205
                new flowRateInletVelocityFvPatchVectorField(*this, iF)
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
            );
        }


    // Member functions

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

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


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

} // End namespace Foam

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

#endif

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