From c404b910a3446601e07a7449068238a788c33a8c Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 14 Mar 2019 08:19:15 +0100 Subject: [PATCH] STYLE: correct documentation for fanFvPatchField (#1229) - for more clarity, make read/write of rpm and mean-diameter contingent on nonDimensional == true --- .../derived/fan/fanFvPatchField.C | 20 +++++--- .../derived/fan/fanFvPatchField.H | 49 ++++++++++--------- .../derived/fan/fanFvPatchFields.C | 10 +++- .../uniformJump/uniformJumpFvPatchField.H | 8 +-- 4 files changed, 50 insertions(+), 37 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 350f173b0a..06dac9ee02 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011, 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011, 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2015 OpenFOAM Foundation @@ -53,8 +53,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField rhoName_("rho"), uniformJump_(false), nonDimensional_(false), - rpm_(0.0), - dm_(0.0) + rpm_(0), + dm_(0) {} @@ -71,8 +71,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField rhoName_(dict.lookupOrDefault<word>("rho", "rho")), uniformJump_(dict.lookupOrDefault("uniformJump", false)), nonDimensional_(dict.lookupOrDefault("nonDimensional", false)), - rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)), - dm_(dict.lookupOrDefault<scalar>("dm", 0.0)) + rpm_(0), + dm_(0) { if (nonDimensional_) { @@ -158,9 +158,13 @@ void Foam::fanFvPatchField<Type>::write(Ostream& os) const os.writeEntryIfDifferent<word>("phi", "phi", phiName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_); os.writeEntryIfDifferent<bool>("uniformJump", false, uniformJump_); - os.writeEntryIfDifferent<bool>("nonDimensional", false, nonDimensional_); - os.writeEntryIfDifferent<scalar>("rpm", false, rpm_); - os.writeEntryIfDifferent<scalar>("dm", false, dm_); + + if (nonDimensional_) + { + os.writeEntry("nonDimensional", nonDimensional_); + os.writeEntry("rpm", rpm_); + os.writeEntry("dm", dm_); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 7a17ad7035..11d86e338a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011, 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011, 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -34,38 +34,42 @@ Description condition as a base. The jump is specified as a \c Function1 type, to enable the use of, e.g. - contant, polynomial, table values. + constant, polynomial, table values. - The switch nonDimensional can be used for a non-dimensional table. It needs - inputs rpm and dm of the fan. It should be used with uniformJump true. + The switch nonDimensional can be used for a non-dimensional table, + in combination with uniformJump = true. + As inputs it needs the fan RPM (rpm) and the mean diameter (dm). - The nonDimensional U for the table is calculate as : + The non-dimensional U for the table is calculated as follows: + \verbatim phi = 120*Un/(PI^3*dm*rpm) where: dm is the mean diameter. rpm is the RPM of the fan. + \endverbatim - The nonDimensinal pressure : + The non-dimensional pressure: + \verbatim Psi = 2 deltaP/(rho*(sqr(PI*omega*dm))) where: deltaP is the pressure drop + \endverbatim The non-dimensional table should be given as Psi = F(phi). Usage \table - Property | Description | Required | Default value - patchType | underlying patch type should be \c cyclic| yes | - jumpTable | jump data, e.g. \c csvFile | yes | - phi | flux field name | no | phi - rho | density field name | no | none - uniformJump | applies a uniform pressure based on the averaged - velocity | no | false - 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 + Property | Description | Required | Default + patchType | underlying patch type should be \c cyclic | yes | + jumpTable | jump data, e.g. \c csvFile | yes | + phi | flux field name | no | phi + rho | density field name | no | rho + uniformJump | apply uniform pressure based on avg velocity | no | false + nonDimensional | use non-dimensional table | no | false + rpm | fan rpm (non-dimensional table) | no | 0 + dm | mean diameter (non-dimensional table) | no | 0 \endtable Example of the boundary condition specification: @@ -75,7 +79,8 @@ Usage type fan; patchType cyclic; jumpTable csvFile; - csvFileCoeffs + + jumpTableCoeffs { nHeaderLine 1; refColumn 0; @@ -109,7 +114,6 @@ SourceFiles #define fanFvPatchField_H #include "uniformJumpFvPatchField.H" -#include "Function1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,14 +134,13 @@ class fanFvPatchField //- Name of the flux transporting the field word phiName_; - //- Name of the density field used to normalise the mass flux - //- if necessary + //- Name of the density field for normalising the mass flux if necessary word rhoName_; - //- Uniform pressure drop + //- Apply uniform pressure drop bool uniformJump_; - //- Swtich for using non-dimensional curve + //- Use non-dimensional curve bool nonDimensional_; // Parameters for non-dimensional table @@ -228,7 +231,7 @@ public: virtual void updateCoeffs(); //- Write - virtual void write(Ostream&) const; + virtual void write(Ostream& os) const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index dc17bce04d..b4c3519360 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -100,9 +100,15 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField rhoName_(dict.lookupOrDefault<word>("rho", "rho")), uniformJump_(dict.lookupOrDefault("uniformJump", false)), nonDimensional_(dict.lookupOrDefault("nonDimensional", false)), - rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)), - dm_(dict.lookupOrDefault<scalar>("dm", 0.0)) + rpm_(0), + dm_(0) { + if (nonDimensional_) + { + dict.readEntry("rpm", rpm_); + dict.readEntry("dm", dm_); + } + if (this->cyclicPatch().owner()) { this->jumpTable_ = Function1<scalar>::New("jumpTable", dict); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H index 7745186a22..6f455e79d6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H @@ -36,9 +36,9 @@ Description Usage \table - Property | Description | Required | Default value - patchType | underlying patch type should be \c cyclic| yes | - jumpTable | jump value | yes | + Property | Description | Required | Default + patchType | underlying patch type should be \c cyclic | yes | + jumpTable | jump value | yes | \endtable Example of the boundary condition specification: @@ -171,7 +171,7 @@ public: virtual void updateCoeffs(); //- Write - virtual void write(Ostream&) const; + virtual void write(Ostream& os) const; }; -- GitLab