ENH: fanPressure - use fanCurve entry if present

- only use implicit legacy handling if the "fanCurve" entry is missing
  and the "file" entry is present.
This commit is contained in:
Mark Olesen
2020-09-28 10:35:45 +02:00
parent 245ac07312
commit aca4f077ac
3 changed files with 37 additions and 25 deletions

View File

@ -54,7 +54,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
)
:
totalPressureFvPatchScalarField(p, iF),
fanCurve_(),
fanCurve_(nullptr),
direction_(ffdOut),
rpm_(0),
dm_(0),
@ -87,15 +87,15 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
)
:
totalPressureFvPatchScalarField(p, iF, dict),
fanCurve_(),
fanCurve_(nullptr),
direction_(fanFlowDirectionNames_.get("direction", dict)),
rpm_(0),
dm_(0),
nonDimensional_(dict.getOrDefault("nonDimensional", false))
{
// Backwards compatibility
if (dict.found("file"))
if (dict.found("file") && !dict.found("fanCurve"))
{
// Backwards compatibility (2006 and earlier)
fanCurve_.reset
(
new Function1Types::TableFile<scalar>("fanCurve", dict)
@ -160,7 +160,7 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
const auto& phip = patch().patchField<surfaceScalarField, scalar>(phi);
int dir = 2*direction_ - 1;
const int dir = 2*direction_ - 1;
// Average volumetric flow rate
scalar volFlowRate = 0;
@ -193,7 +193,7 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
}
// Pressure drop for this flow rate
scalar pdFan = fanCurve_->value(max(volFlowRate, 0.0));
scalar pdFan = fanCurve_->value(max(volFlowRate, scalar(0)));
if (nonDimensional_)
{

View File

@ -34,10 +34,10 @@ Description
This boundary condition can be applied to assign either a pressure inlet
or outlet total pressure condition for a fan.
The switch nonDimensional can be used for a non-dimensional table. It needs
inputs rpm and dm of the fan.
The switch nonDimensional can be used for a non-dimensional fan curve.
It needs inputs rpm and dm of the fan.
The nonDimensional flux for the table is calculate as :
The nonDimensional flux is calculate as :
phi = 4.0*mDot/(rho*sqr(PI)*dm^3*omega)
where:
@ -54,14 +54,15 @@ Description
Usage
\table
Property | Description | Required | Default value
file | fan curve file name | yes |
Property | Description | Required | Default
fanCurve | Pressure vs flow-rate | yes |
outOfBounds | out of bounds handling | yes |
direction | direction of flow through fan [in/out] | yes |
p0 | environmental total pressure | yes |
nonDimensional | uses non-dimensional table | no | false
rpm | fan rpm for non-dimensional table | no | 0.0
rpm | fan rpm for non-dimensional table | no | 0
dm | mean diameter for non-dimensional table | no | 0.0
file | fan curve file name | legacy |
\endtable
Example of the boundary condition specification:
@ -69,26 +70,34 @@ Usage
inlet
{
type fanPressure;
fanCurve tableFile;
file "fanCurve";
outOfBounds clamp;
direction in;
fanCurve tableFile;
fanCurveCoeffs
{
file "<constant>/fanCurve";
outOfBounds clamp;
}
p0 uniform 0;
value uniform 0;
}
// Legacy specification
outlet
{
type fanPressure;
fanCurve tableFile;
file "fanCurve";
outOfBounds clamp;
direction out;
file "<constant>/fanCurve";
outOfBounds clamp;
p0 uniform 0;
value uniform 0;
}
\endverbatim
Note
For compatibility with older versions (OpenFOAM-v2006 and earlier),
a missing \c fanCurve keyword is treated as a tableFile and makes
the \c file keyword mandatory.
See also
Foam::fanFvPatchField
Foam::totalPressureFvPatchScalarField

View File

@ -24,14 +24,17 @@ boundaryField
inlet
{
type fanPressure;
outOfBounds clamp;
direction in;
readerType openFoam;
fanCurve tableFile;
fanCurveCoeffs
{
file "<constant>/FluxVsdP.dat";
// readerType openFoam; // Default
// outOfBounds clamp; // Default
}
//nonDimensional true;
//rpm 300;
//dm 2e-2;
outOfBounds clamp;
p0 uniform 30;
}
outlet1