flowRateInletVelocityFvPatchVectorField.H 5.53 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2006-2008 OpenCFD Ltd.
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    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 2 of the License, or (at your
    option) any later version.

    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
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Class
26
    Foam::flowRateInletVelocityFvPatchVectorField
27
28

Description
Mark Olesen's avatar
Mark Olesen committed
29
    Describes a volumetric/mass flow normal vector boundary condition by its
30
    magnitude as an integral over its area.
Mark Olesen's avatar
Mark Olesen committed
31

32
33
    The basis of the patch (volumetric or mass) is determined by the
    dimensions of the flux, phi.
Mark Olesen's avatar
Mark Olesen committed
34
35
    The current density is used to correct the velocity when applying the
    mass basis.
36
37
38
39
40

    Example of the boundary condition specification:
    @verbatim
    inlet
    {
41
42
        type            flowRateInletVelocity;
        flowRate        0.2;        // Volumetric/mass flow rate [m3/s or kg/s]
43
44
45
46
47
48
49
50
51
52
        value           uniform (0 0 0); // placeholder
    }
    @endverbatim

Note
    - The value is positive inwards
    - May not work correctly for transonic inlets
    - Strange behaviour with potentialFoam since the U equation is not solved

SourceFiles
53
    flowRateInletVelocityFvPatchVectorField.C
54
55
56

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

57
58
#ifndef flowRateInletVelocityFvPatchVectorField_H
#define flowRateInletVelocityFvPatchVectorField_H
59
60
61
62
63
64
65
66

#include "fixedValueFvPatchFields.H"

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

namespace Foam
{
/*---------------------------------------------------------------------------*\
67
               Class flowRateInletVelocityFvPatch Declaration
68
69
\*---------------------------------------------------------------------------*/

70
class flowRateInletVelocityFvPatchVectorField
71
72
73
74
75
:
    public fixedValueFvPatchVectorField
{
    // Private data

76
77
        //- Inlet integral flow rate
        scalar flowRate_;
78
79
80
81
82
83
84
85
86
87
88

        //- Name of the flux transporting the field
        word phiName_;

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


public:

   //- Runtime type information
89
   TypeName("flowRateInletVelocity");
90
91
92
93
94


   // Constructors

        //- Construct from patch and internal field
95
        flowRateInletVelocityFvPatchVectorField
96
97
98
99
100
101
        (
            const fvPatch&,
            const DimensionedField<vector, volMesh>&
        );

        //- Construct from patch, internal field and dictionary
102
        flowRateInletVelocityFvPatchVectorField
103
104
105
106
107
108
109
        (
            const fvPatch&,
            const DimensionedField<vector, volMesh>&,
            const dictionary&
        );

        //- Construct by mapping given
110
        //  flowRateInletVelocityFvPatchVectorField
111
        //  onto a new patch
112
        flowRateInletVelocityFvPatchVectorField
113
        (
114
            const flowRateInletVelocityFvPatchVectorField&,
115
116
117
118
119
120
            const fvPatch&,
            const DimensionedField<vector, volMesh>&,
            const fvPatchFieldMapper&
        );

        //- Construct as copy
121
        flowRateInletVelocityFvPatchVectorField
122
        (
123
            const flowRateInletVelocityFvPatchVectorField&
124
125
126
127
128
129
130
        );

        //- Construct and return a clone
        virtual tmp<fvPatchVectorField> clone() const
        {
            return tmp<fvPatchVectorField>
            (
131
                new flowRateInletVelocityFvPatchVectorField(*this)
132
133
134
135
            );
        }

        //- Construct as copy setting internal field reference
136
        flowRateInletVelocityFvPatchVectorField
137
        (
138
            const flowRateInletVelocityFvPatchVectorField&,
139
140
141
142
143
144
145
146
147
148
149
            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>
            (
150
                new flowRateInletVelocityFvPatchVectorField(*this, iF)
151
152
153
154
155
156
157
158
            );
        }


    // Member functions

        // Access

159
160
            //- Return the flux
            scalar flowRate() const
161
            {
162
                return flowRate_;
163
164
            }

165
166
            //- Return reference to the flux to allow adjustment
            scalar& flowRate()
167
            {
168
                return flowRate_;
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
            }


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

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

};


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

} // End namespace Foam

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

#endif

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