Skip to content
Snippets Groups Projects
Commit 3b3bb717 authored by Henry Weller's avatar Henry Weller
Browse files

variableHeightFlowRateInletVelocityFvPatchVectorField: Changed the flow-rate to a Function1

to support time-variation
parent e37da9fe
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -24,10 +24,8 @@ License ...@@ -24,10 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "variableHeightFlowRateInletVelocityFvPatchVectorField.H" #include "variableHeightFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H" #include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...@@ -39,7 +37,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ...@@ -39,7 +37,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchField<vector>(p, iF), fixedValueFvPatchField<vector>(p, iF),
flowRate_(0), flowRate_(),
alphaName_("none") alphaName_("none")
{} {}
...@@ -47,29 +45,29 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ...@@ -47,29 +45,29 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField ::variableHeightFlowRateInletVelocityFvPatchVectorField
( (
const variableHeightFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p, const fvPatch& p,
const DimensionedField<vector, volMesh>& iF, const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper const dictionary& dict
) )
: :
fixedValueFvPatchField<vector>(ptf, p, iF, mapper), fixedValueFvPatchField<vector>(p, iF, dict),
flowRate_(ptf.flowRate_), flowRate_(Function1<scalar>::New("flowRate", dict)),
alphaName_(ptf.alphaName_) alphaName_(dict.lookup("alpha"))
{} {}
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField ::variableHeightFlowRateInletVelocityFvPatchVectorField
( (
const variableHeightFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p, const fvPatch& p,
const DimensionedField<vector, volMesh>& iF, const DimensionedField<vector, volMesh>& iF,
const dictionary& dict const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<vector>(p, iF, dict), fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
flowRate_(readScalar(dict.lookup("flowRate"))), flowRate_(ptf.flowRate_, false),
alphaName_(dict.lookup("alpha")) alphaName_(ptf.alphaName_)
{} {}
...@@ -80,7 +78,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ...@@ -80,7 +78,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchField<vector>(ptf), fixedValueFvPatchField<vector>(ptf),
flowRate_(ptf.flowRate_), flowRate_(ptf.flowRate_, false),
alphaName_(ptf.alphaName_) alphaName_(ptf.alphaName_)
{} {}
...@@ -93,7 +91,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ...@@ -93,7 +91,7 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchField<vector>(ptf, iF), fixedValueFvPatchField<vector>(ptf, iF),
flowRate_(ptf.flowRate_), flowRate_(ptf.flowRate_, false),
alphaName_(ptf.alphaName_) alphaName_(ptf.alphaName_)
{} {}
...@@ -114,8 +112,11 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField ...@@ -114,8 +112,11 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
alphap = max(alphap, scalar(0)); alphap = max(alphap, scalar(0));
alphap = min(alphap, scalar(1)); alphap = min(alphap, scalar(1));
const scalar t = db().time().timeOutputValue();
scalar flowRate = flowRate_->value(t);
// a simpler way of doing this would be nice // a simpler way of doing this would be nice
scalar avgU = -flowRate_/gSum(patch().magSf()*alphap); scalar avgU = -flowRate/gSum(patch().magSf()*alphap);
vectorField n(patch().nf()); vectorField n(patch().nf());
...@@ -131,11 +132,8 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::write ...@@ -131,11 +132,8 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::write
) const ) const
{ {
fvPatchField<vector>::write(os); fvPatchField<vector>::write(os);
flowRate_->writeData(os);
os.writeKeyword("flowRate") << flowRate_ os.writeKeyword("alpha") << alphaName_ << token::END_STATEMENT << nl;
<< token::END_STATEMENT << nl;
os.writeKeyword("alpha") << alphaName_
<< token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -53,6 +53,8 @@ Description ...@@ -53,6 +53,8 @@ Description
} }
\endverbatim \endverbatim
The \c flowRate entry is a \c Function1 of time, see Foam::Function1Types.
Note Note
- the value is positive into the domain - the value is positive into the domain
- may not work correctly for transonic inlets - may not work correctly for transonic inlets
...@@ -61,6 +63,7 @@ Note ...@@ -61,6 +63,7 @@ Note
SeeAlso SeeAlso
Foam::fixedValueFvPatchField Foam::fixedValueFvPatchField
Foam::Function1Types
SourceFiles SourceFiles
variableHeightFlowRateInletVelocityFvPatchVectorField.C variableHeightFlowRateInletVelocityFvPatchVectorField.C
...@@ -71,6 +74,7 @@ SourceFiles ...@@ -71,6 +74,7 @@ SourceFiles
#define variableHeightFlowRateInletVelocityFvPatchVectorField_H #define variableHeightFlowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -87,7 +91,7 @@ class variableHeightFlowRateInletVelocityFvPatchVectorField ...@@ -87,7 +91,7 @@ class variableHeightFlowRateInletVelocityFvPatchVectorField
// Private data // Private data
//- Inlet integral flow rate //- Inlet integral flow rate
scalar flowRate_; autoPtr<Function1<scalar>> flowRate_;
//- Name of the phase-fraction field //- Name of the phase-fraction field
word alphaName_; word alphaName_;
...@@ -168,21 +172,6 @@ public: ...@@ -168,21 +172,6 @@ public:
// Member functions // Member functions
// Access
//- Return the flux
scalar flowRate() const
{
return flowRate_;
}
//- Return reference to the flux to allow adjustment
scalar& flowRate()
{
return flowRate_;
}
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment