From e3701a47aed619af06996e6382f000ed5fb6e263 Mon Sep 17 00:00:00 2001 From: sergio Date: Mon, 12 Jun 2017 11:28:57 -0700 Subject: [PATCH] ENH: Adding non-dimensional table input to fanPressure BC Adding intertial term switch to solarLoad chtMultiRegionFoam case --- .../fanPressureFvPatchScalarField.C | 54 ++++++++++++++++--- .../fanPressureFvPatchScalarField.H | 34 +++++++++++- .../system/air/changeDictionaryDict | 1 + .../system/floor/changeDictionaryDict | 2 + .../system/solid/changeDictionaryDict | 2 + 5 files changed, 84 insertions(+), 9 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index 2cc9641d52..9719903efc 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -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("nonDimensional", false)), + rpm_(dict.lookupOrDefault("rpm", 0.0)), + dm_(dict.lookupOrDefault("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_); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H index aa4b19f28b..e8744b192c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H @@ -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: diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/air/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/air/changeDictionaryDict index 4620862987..9e4ef1a6b3 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/air/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/air/changeDictionaryDict @@ -72,6 +72,7 @@ dictionaryReplacement qrNbr none; qr qr; kappa none; + thermalInertia true; value uniform 300; } } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/floor/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/floor/changeDictionaryDict index 3860f7dc3f..1b15cfcc06 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/floor/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/floor/changeDictionaryDict @@ -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; } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/solid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/solid/changeDictionaryDict index 080b5fba86..4c0e93ace8 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/solid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/externalSolarLoad/system/solid/changeDictionaryDict @@ -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; }