variableHeightFlowRateInletVelocityFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "volFields.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
39 )
40 :
42  flowRate_(),
43  alphaName_("none")
44 {}
45 
46 
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
56  flowRate_(Function1<scalar>::New("flowRate", dict)),
57  alphaName_(dict.lookup("alpha"))
58 {}
59 
60 
63 (
65  const fvPatch& p,
67  const fvPatchFieldMapper& mapper
68 )
69 :
70  fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
71  flowRate_(ptf.flowRate_.clone()),
72  alphaName_(ptf.alphaName_)
73 {}
74 
75 
78 (
80 )
81 :
83  flowRate_(ptf.flowRate_.clone()),
84  alphaName_(ptf.alphaName_)
85 {}
86 
87 
90 (
93 )
94 :
96  flowRate_(ptf.flowRate_.clone()),
97  alphaName_(ptf.alphaName_)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
105 {
106  if (updated())
107  {
108  return;
109  }
110 
111  scalarField alphap =
112  patch().lookupPatchField<volScalarField, scalar>(alphaName_);
113 
114  alphap = max(alphap, scalar(0));
115  alphap = min(alphap, scalar(1));
116 
117  const scalar t = db().time().timeOutputValue();
118  scalar flowRate = flowRate_->value(t);
119 
120  // a simpler way of doing this would be nice
121  scalar avgU = -flowRate/gSum(patch().magSf()*alphap);
122 
123  vectorField n(patch().nf());
124 
125  operator==(n*avgU*alphap);
126 
128 }
129 
130 
132 (
133  Ostream& os
134 ) const
135 {
137  flowRate_->writeData(os);
138  os.writeEntry("alpha", alphaName_);
139  writeEntry("value", os);
140 }
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 namespace Foam
146 {
148  (
151  );
152 }
153 
154 
155 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
volFields.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
This boundary condition provides a velocity boundary condition for multphase flow based on a user-spe...
Definition: variableHeightFlowRateInletVelocityFvPatchVectorField.H:102
variableHeightFlowRateInletVelocityFvPatchVectorField.H
Foam::gSum
Type gSum(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:594
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::Function1
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:86
Foam::fixedValueFvPatchField
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Definition: fixedValueFvPatchField.H:80
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::variableHeightFlowRateInletVelocityFvPatchVectorField
variableHeightFlowRateInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: variableHeightFlowRateInletVelocityFvPatchVectorField.C:36
Foam::Field< scalar >
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: variableHeightFlowRateInletVelocityFvPatchVectorField.C:104
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: variableHeightFlowRateInletVelocityFvPatchVectorField.C:132
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54