diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 350f173b0af9572d28913831c8abb9369801ae0b..06dac9ee02af2aba9a77bd777a432b15407831de 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 7a17ad703567deab72254f9ce8d49015179a9a0e..11d86e338a172b410d72e04fe914258c274ac795 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 dc17bce04d9b0e7ca4e531bde7e79048e0f9cc2f..b4c35193609d9c6b61d15c857a782d1f83cfee6e 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 7745186a224870bbe49c794b11f74cfd66a4b2d7..6f455e79d62781132f0b5be28955dbe3af2d37fa 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; };