mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
variableHeightFlowRateInletVelocityFvPatchVectorField: Changed the flow-rate to a Function1
to support time-variation
This commit is contained in:
@ -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
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#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,11 +37,25 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
flowRate_(0),
|
flowRate_(),
|
||||||
alphaName_("none")
|
alphaName_("none")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
||||||
|
::variableHeightFlowRateInletVelocityFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||||
|
flowRate_(Function1<scalar>::New("flowRate", dict)),
|
||||||
|
alphaName_(dict.lookup("alpha"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
||||||
::variableHeightFlowRateInletVelocityFvPatchVectorField
|
::variableHeightFlowRateInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
@ -54,25 +66,11 @@ Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||||
flowRate_(ptf.flowRate_),
|
flowRate_(ptf.flowRate_, false),
|
||||||
alphaName_(ptf.alphaName_)
|
alphaName_(ptf.alphaName_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
|
||||||
::variableHeightFlowRateInletVelocityFvPatchVectorField
|
|
||||||
(
|
|
||||||
const fvPatch& p,
|
|
||||||
const DimensionedField<vector, volMesh>& iF,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
|
||||||
flowRate_(readScalar(dict.lookup("flowRate"))),
|
|
||||||
alphaName_(dict.lookup("alpha"))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
|
||||||
::variableHeightFlowRateInletVelocityFvPatchVectorField
|
::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
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
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
|
|||||||
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
|
|||||||
) 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 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / 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
|
|||||||
}
|
}
|
||||||
\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
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::fixedValueFvPatchField
|
Foam::fixedValueFvPatchField
|
||||||
|
Foam::Function1Types
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
variableHeightFlowRateInletVelocityFvPatchVectorField.C
|
variableHeightFlowRateInletVelocityFvPatchVectorField.C
|
||||||
@ -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
|
|||||||
// 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:
|
|||||||
|
|
||||||
// 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();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user