ENH: Adding non-dimensional table input to fanPressure BC

Adding intertial term switch to solarLoad chtMultiRegionFoam case
This commit is contained in:
sergio 2017-06-12 11:28:57 -07:00
parent d27d69e3f7
commit e3701a47ae
5 changed files with 84 additions and 9 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,7 +61,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(p, iF),
fanCurve_(),
direction_(ffdOut)
direction_(ffdOut),
nonDimensional_(false),
rpm_(0.0),
dm_(0.0)
{}
@ -75,7 +78,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(ptf, p, iF, mapper),
fanCurve_(ptf.fanCurve_),
direction_(ptf.direction_)
direction_(ptf.direction_),
nonDimensional_(ptf.nonDimensional_),
rpm_(ptf.rpm_),
dm_(ptf.dm_)
{}
@ -88,8 +94,17 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(p, iF, dict),
fanCurve_(dict),
direction_(fanFlowDirectionNames_.read(dict.lookup("direction")))
{}
direction_(fanFlowDirectionNames_.read(dict.lookup("direction"))),
nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)),
rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)),
dm_(dict.lookupOrDefault<scalar>("dm", 0.0))
{
if (nonDimensional_)
{
dict.lookup("rpm") >> rpm_;
dict.lookup("dm") >> dm_;
}
}
Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
@ -99,7 +114,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(pfopsf),
fanCurve_(pfopsf.fanCurve_),
direction_(pfopsf.direction_)
direction_(pfopsf.direction_),
nonDimensional_(pfopsf.nonDimensional_),
rpm_(pfopsf.rpm_),
dm_(pfopsf.dm_)
{}
@ -111,7 +129,10 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
:
totalPressureFvPatchScalarField(pfopsf, iF),
fanCurve_(pfopsf.fanCurve_),
direction_(pfopsf.direction_)
direction_(pfopsf.direction_),
nonDimensional_(pfopsf.nonDimensional_),
rpm_(pfopsf.rpm_),
dm_(pfopsf.dm_)
{}
@ -156,8 +177,21 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
<< exit(FatalError);
}
if (nonDimensional_)
{
// Create an adimensional flow rate
volFlowRate =
120.0*volFlowRate/pow3(constant::mathematical::pi)/pow3(dm_);
}
// Pressure drop for this flow rate
const scalar pdFan = fanCurve_(max(volFlowRate, 0.0));
scalar pdFan = fanCurve_(max(volFlowRate, 0.0));
if (nonDimensional_)
{
// Convert the adimensional deltap from curve into deltaP
pdFan = pdFan*pow4(constant::mathematical::pi)*rpm_*sqr(dm_)/1800;
}
totalPressureFvPatchScalarField::updateCoeffs
(
@ -173,6 +207,10 @@ void Foam::fanPressureFvPatchScalarField::write(Ostream& os) const
fanCurve_.write(os);
os.writeKeyword("direction")
<< fanFlowDirectionNames_[direction_] << token::END_STATEMENT << nl;
os.writeKeyword("nonDimensional") << nonDimensional_
<< token::END_STATEMENT << nl;
os.writeEntry("rpm", rpm_);
os.writeEntry("dm", dm_);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,6 +31,24 @@ 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 nonDimensional flux for the table is calculate as :
phi = 4.0*mDot/(rho*sqr(PI)*dm^3*omega)
where:
dm is the mean diameter.
omega is rad/sec.
The nonDimensinal pressure :
Psi = 2 deltaP/(rho*(sqr(PI*omega*dm)))
where:
deltaP is the pressure drop
The non-dimensional table should be given as Psi = F(phi).
Usage
\table
Property | Description | Required | Default value
@ -38,6 +56,9 @@ Usage
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
dm | mean diameter for non-dimensional table | no | 0.0
\endtable
Example of the boundary condition specification:
@ -116,6 +137,17 @@ private:
//- Direction of flow through the fan relative to patch
fanFlowDirection direction_;
//- Swtich for using non-dimensional curve
Switch nonDimensional_;
// Parameters for non-dimensional table
//- Fan rpm
scalar rpm_;
//- Fan mean diameter
scalar dm_;
public:

View File

@ -72,6 +72,7 @@ dictionaryReplacement
qrNbr none;
qr qr;
kappa none;
thermalInertia true;
value uniform 300;
}
}

View File

@ -43,6 +43,7 @@ dictionaryReplacement
qrNbr none;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}
@ -54,6 +55,7 @@ dictionaryReplacement
qrNbr qr;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}

View File

@ -37,6 +37,7 @@ dictionaryReplacement
qrNbr qr;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}
@ -48,6 +49,7 @@ dictionaryReplacement
qrNbr none;
qr none;
kappa none;
thermalInertia true;
value uniform 300;
}