File size: 8,915 Bytes
5a600cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::flowRateInletVelocityFvPatchVectorField
Description
Velocity inlet boundary condition creating a velocity field with
optionally specified profile normal to the patch adjusted to match the
specified mass flow rate, volumetric flow rate or mean velocity.
For a mass-based flux:
- the flow rate should be provided in kg/s
- if \c rho is "none" the flow rate is in m3/s
- otherwise \c rho 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
For a volumetric-based flux:
- the flow rate is in m3/s
Usage
\table
Property | Description | Required | Default value
massFlowRate | Mass flow rate [kg/s] | no |
volumetricFlowRate | Volumetric flow rate [m^3/s] | no |
meanVelocity | Mean velocity [m/s] | no |
profile | Velocity profile | no |
rho | Density field name | no | rho
rhoInlet | Inlet density | no |
alpha | Volume fraction field name | no |
\endtable
Example of the boundary condition specification for a volumetric flow rate:
\verbatim
<patchName>
{
type flowRateInletVelocity;
volumetricFlowRate 0.2;
profile laminarBL;
}
\endverbatim
Example of the boundary condition specification for a mass flow rate:
\verbatim
<patchName>
{
type flowRateInletVelocity;
massFlowRate 0.2;
profile turbulentBL;
rho rho;
rhoInlet 1.0;
}
\endverbatim
Example of the boundary condition specification for a mean velocity:
\verbatim
<patchName>
{
type flowRateInletVelocity;
meanVelocity 5;
profile turbulentBL;
}
\endverbatim
The \c volumetricFlowRate, \c massFlowRate or \c meanVelocity entries are
\c Function1 of time, see Foam::Function1s.
The \c profile entry is a \c Function1 of the normalised distance to the
wall. Any suitable Foam::Function1s can be used including
Foam::Function1s::codedFunction1 but Foam::Function1s::laminarBL and
Foam::Function1s::turbulentBL have been created specifically for this
purpose and are likely to be appropriate for most cases.
Note:
- \c rhoInlet is required for the case of a mass flow rate, where the
density field is not available at start-up
- 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
See also
Foam::fixedValueFvPatchField
Foam::Function1s::laminarBL
Foam::Function1s::turbulentBL
Foam::Function1s
Foam::flowRateOutletVelocityFvPatchVectorField
SourceFiles
flowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef flowRateInletVelocityFvPatchVectorField_H
#define flowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class flowRateInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class flowRateInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private Data
//- Inlet integral flow rate
autoPtr<Function1<scalar>> flowRate_;
//- Is the flow-rate mean velocity?
bool meanVelocity_;
//- Is the flow-rate volumetric?
bool volumetric_;
//- Optional velocity profile
autoPtr<Function1<scalar>> profile_;
//- Name of the density field used to normalise the mass flux
word rhoName_;
//- Rho initialisation value (for start; if value not supplied)
scalar rhoInlet_;
//- Name of the volume fraction field used to convert to interstitial
// velocity
word alphaName_;
//- Normalised distance to the wall
scalarField y_;
//- Total area of patch
scalar area_;
// Private Member Functions
//- Set the wall distance field y_
void setWallDist();
//- Return the normalised velocity profile
virtual tmp<scalarField> profile();
//- Update the patch values given the appropriate volume fraction and
// density types and values
template<class ScaleType, class AlphaType, class RhoType>
void updateValues
(
const ScaleType& scale,
const AlphaType& alpha,
const RhoType& rho
);
//- Update the patch values given the appropriate volume fraction type
// and values
template<class AlphaType>
void updateValues(const AlphaType& alpha);
public:
//- Runtime type information
TypeName("flowRateInletVelocity");
// Constructors
//- Construct from patch, internal field and dictionary
flowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, fvMesh>&,
const dictionary&
);
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
flowRateInletVelocityFvPatchVectorField
(
const flowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, fvMesh>&,
const fieldMapper&
);
//- Disallow copy without setting internal field reference
flowRateInletVelocityFvPatchVectorField
(
const flowRateInletVelocityFvPatchVectorField&
) = delete;
//- Copy constructor setting internal field reference
flowRateInletVelocityFvPatchVectorField
(
const flowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, fvMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, fvMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new flowRateInletVelocityFvPatchVectorField(*this, iF)
);
}
// Member Functions
// Mapping functions
//- Map the given fvPatchField onto this fvPatchField
virtual void map(const fvPatchVectorField&, const fieldMapper&);
//- Reset the fvPatchField to the given fvPatchField
// Used for mesh to mesh mapping
virtual void reset(const fvPatchVectorField&);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
// Member Operators
//- Inherit assignment
using fixedValueFvPatchVectorField::operator=;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
|