From a6581d308283ef24fcfafc5484aa04e520dee240 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 22 Aug 2019 10:12:49 +0200 Subject: [PATCH] STYLE: group bool members together for better packing --- .../fanPressureFvPatchScalarField.C | 33 ++++++++++--------- .../fanPressureFvPatchScalarField.H | 18 +++++----- .../flowRateInletVelocityFvPatchVectorField.C | 16 +++++---- .../flowRateInletVelocityFvPatchVectorField.H | 8 ++--- .../swirlFanVelocityFvPatchField.C | 20 +++++------ .../swirlFanVelocityFvPatchField.H | 6 ++-- .../turbulentDFSEMInletFvPatchVectorField.C | 20 +++++------ .../turbulentDFSEMInletFvPatchVectorField.H | 14 ++++---- 8 files changed, 69 insertions(+), 66 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index 0a32ee0e06f..72ea59f6df3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -54,9 +54,9 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField totalPressureFvPatchScalarField(p, iF), fanCurve_(), direction_(ffdOut), - nonDimensional_(false), - rpm_(0.0), - dm_(0.0) + rpm_(0), + dm_(0), + nonDimensional_(false) {} @@ -71,9 +71,9 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField totalPressureFvPatchScalarField(ptf, p, iF, mapper), fanCurve_(ptf.fanCurve_), direction_(ptf.direction_), - nonDimensional_(ptf.nonDimensional_), rpm_(ptf.rpm_), - dm_(ptf.dm_) + dm_(ptf.dm_), + nonDimensional_(ptf.nonDimensional_) {} @@ -87,9 +87,9 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField totalPressureFvPatchScalarField(p, iF, dict), fanCurve_(dict), direction_(fanFlowDirectionNames_.get("direction", dict)), - nonDimensional_(dict.lookupOrDefault<Switch>("nonDimensional", false)), - rpm_(dict.lookupOrDefault<scalar>("rpm", 0.0)), - dm_(dict.lookupOrDefault<scalar>("dm", 0.0)) + rpm_(0), + dm_(0), + nonDimensional_(dict.lookupOrDefault("nonDimensional", false)) { if (nonDimensional_) { @@ -107,9 +107,9 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField totalPressureFvPatchScalarField(pfopsf), fanCurve_(pfopsf.fanCurve_), direction_(pfopsf.direction_), - nonDimensional_(pfopsf.nonDimensional_), rpm_(pfopsf.rpm_), - dm_(pfopsf.dm_) + dm_(pfopsf.dm_), + nonDimensional_(pfopsf.nonDimensional_) {} @@ -122,9 +122,9 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField totalPressureFvPatchScalarField(pfopsf, iF), fanCurve_(pfopsf.fanCurve_), direction_(pfopsf.direction_), - nonDimensional_(pfopsf.nonDimensional_), rpm_(pfopsf.rpm_), - dm_(pfopsf.dm_) + dm_(pfopsf.dm_), + nonDimensional_(pfopsf.nonDimensional_) {} @@ -198,9 +198,12 @@ void Foam::fanPressureFvPatchScalarField::write(Ostream& os) const totalPressureFvPatchScalarField::write(os); fanCurve_.write(os); os.writeEntry("direction", fanFlowDirectionNames_[direction_]); - os.writeEntry("nonDimensional", nonDimensional_); - os.writeEntry("rpm", rpm_); - os.writeEntry("dm", dm_); + if (nonDimensional_) + { + os.writeEntry("nonDimensional", "true"); + 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 df6e35f889b..4f4ae0f9792 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.H @@ -131,7 +131,7 @@ public: private: - // Private data + // Private Data //- Tabulated fan curve interpolationTable<scalar> fanCurve_; @@ -139,16 +139,14 @@ private: //- Direction of flow through the fan relative to patch fanFlowDirection direction_; - //- Switch for using non-dimensional curve - Switch nonDimensional_; + //- Fan rpm (for non-dimensional curve) + scalar rpm_; - // Parameters for non-dimensional table + //- Fan mean diameter (for non-dimensional curve) + scalar dm_; - //- Fan rpm - scalar rpm_; - - //- Fan mean diameter - scalar dm_; + //- Use non-dimensional curve + bool nonDimensional_; public: @@ -230,7 +228,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/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C index b5702165bea..af08325bf74 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -41,9 +41,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField<vector>(p, iF), flowRate_(), - volumetric_(false), rhoName_("rho"), rhoInlet_(0.0), + volumetric_(false), extrapolateProfile_(false) {} @@ -57,7 +57,9 @@ flowRateInletVelocityFvPatchVectorField ) : fixedValueFvPatchField<vector>(p, iF, dict, false), + rhoName_("rho"), rhoInlet_(dict.lookupOrDefault<scalar>("rhoInlet", -VGREAT)), + volumetric_(false), extrapolateProfile_ ( dict.lookupOrDefault<Switch>("extrapolateProfile", false) @@ -67,7 +69,6 @@ flowRateInletVelocityFvPatchVectorField { volumetric_ = true; flowRate_ = Function1<scalar>::New("volumetricFlowRate", dict); - rhoName_ = "rho"; } else if (dict.found("massFlowRate")) { @@ -79,7 +80,8 @@ flowRateInletVelocityFvPatchVectorField { FatalIOErrorInFunction(dict) << "Please supply either 'volumetricFlowRate' or" - << " 'massFlowRate' and 'rho'" << exit(FatalIOError); + << " 'massFlowRate' and 'rho'" << nl + << exit(FatalIOError); } // Value field require if mass based @@ -108,9 +110,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField<vector>(ptf, p, iF, mapper), flowRate_(ptf.flowRate_.clone()), - volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_), + volumetric_(ptf.volumetric_), extrapolateProfile_(ptf.extrapolateProfile_) {} @@ -123,9 +125,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField<vector>(ptf), flowRate_(ptf.flowRate_.clone()), - volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_), + volumetric_(ptf.volumetric_), extrapolateProfile_(ptf.extrapolateProfile_) {} @@ -139,9 +141,9 @@ flowRateInletVelocityFvPatchVectorField : fixedValueFvPatchField<vector>(ptf, iF), flowRate_(ptf.flowRate_.clone()), - volumetric_(ptf.volumetric_), rhoName_(ptf.rhoName_), rhoInlet_(ptf.rhoInlet_), + volumetric_(ptf.volumetric_), extrapolateProfile_(ptf.extrapolateProfile_) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H index d0ddcb035db..7998a5031f9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -121,15 +121,15 @@ class flowRateInletVelocityFvPatchVectorField //- Inlet integral flow rate autoPtr<Function1<scalar>> flowRate_; - //- Is volumetric? - bool volumetric_; - //- Name of the density field used to normalize the mass flux word rhoName_; //- Rho initialisation value (for start; if value not supplied) scalar rhoInlet_; + //- Is volumetric? + bool volumetric_; + //- Set true to extrapolate the velocity profile from the interior Switch extrapolateProfile_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C index ede79590bf6..063cee6f202 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.C @@ -123,9 +123,9 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField rpm_(), rEff_(0.0), fanEff_(1.0), - useRealRadius_(false), rInner_(0.0), - rOuter_(0.0) + rOuter_(0.0), + useRealRadius_(false) {} @@ -158,9 +158,9 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField ), rEff_(dict.lookupOrDefault<scalar>("rEff", 0)), fanEff_(dict.lookupOrDefault<scalar>("fanEff", 1)), - useRealRadius_(dict.lookupOrDefault("useRealRadius", false)), rInner_(dict.lookupOrDefault<scalar>("rInner", 0)), - rOuter_(dict.lookupOrDefault<scalar>("rOuter", 0)) + rOuter_(dict.lookupOrDefault<scalar>("rOuter", 0)), + useRealRadius_(dict.lookupOrDefault("useRealRadius", false)) {} @@ -180,9 +180,9 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField rpm_(ptf.rpm_.clone()), rEff_(ptf.rEff_), fanEff_(ptf.fanEff_), - useRealRadius_(ptf.useRealRadius_), rInner_(ptf.rInner_), - rOuter_(ptf.rOuter_) + rOuter_(ptf.rOuter_), + useRealRadius_(ptf.useRealRadius_) {} @@ -198,9 +198,9 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField origin_(ptf.origin_), rpm_(ptf.rpm_.clone()), rEff_(ptf.rEff_), - useRealRadius_(ptf.useRealRadius_), rInner_(ptf.rInner_), - rOuter_(ptf.rOuter_) + rOuter_(ptf.rOuter_), + useRealRadius_(ptf.useRealRadius_) {} @@ -217,9 +217,9 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField origin_(ptf.origin_), rpm_(ptf.rpm_.clone()), rEff_(ptf.rEff_), - useRealRadius_(ptf.useRealRadius_), rInner_(ptf.rInner_), - rOuter_(ptf.rOuter_) + rOuter_(ptf.rOuter_), + useRealRadius_(ptf.useRealRadius_) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.H index 040aa515d4e..9ada3331e2c 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlFanVelocity/swirlFanVelocityFvPatchField.H @@ -141,15 +141,15 @@ class swirlFanVelocityFvPatchField //- Fan efficiency scalar fanEff_; - //- Switch to use effective radius or inner and outer radius - bool useRealRadius_; - //- Inner radius scalar rInner_; //- Outer radius scalar rOuter_; + //- Switch to use effective radius or inner and outer radius + bool useRealRadius_; + // Private Member Functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C index 393cab8a7ad..b656ac21c71 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C @@ -737,10 +737,10 @@ turbulentDFSEMInletFvPatchVectorField mapMethod_("planarInterpolation"), mapperPtr_(nullptr), interpolateR_(false), - R_(), interpolateL_(false), - L_(), interpolateU_(false), + R_(), + L_(), U_(), UMean_(Zero), @@ -783,10 +783,10 @@ turbulentDFSEMInletFvPatchVectorField mapMethod_(ptf.mapMethod_), mapperPtr_(nullptr), interpolateR_(ptf.interpolateR_), - R_(ptf.R_, mapper), interpolateL_(ptf.interpolateL_), - L_(ptf.L_, mapper), interpolateU_(ptf.interpolateU_), + R_(ptf.R_, mapper), + L_(ptf.L_, mapper), U_(ptf.U_, mapper), UMean_(ptf.UMean_), @@ -828,10 +828,10 @@ turbulentDFSEMInletFvPatchVectorField mapMethod_(dict.lookup("mapMethod")), mapperPtr_(nullptr), interpolateR_(false), - R_(interpolateOrRead<symmTensor>("R", dict, interpolateR_)), interpolateL_(false), - L_(interpolateOrRead<scalar>("L", dict, interpolateL_)), interpolateU_(false), + R_(interpolateOrRead<symmTensor>("R", dict, interpolateR_)), + L_(interpolateOrRead<scalar>("L", dict, interpolateL_)), U_(interpolateOrRead<vector>("U", dict, interpolateU_)), UMean_(Zero), @@ -878,10 +878,10 @@ turbulentDFSEMInletFvPatchVectorField mapMethod_(ptf.mapMethod_), mapperPtr_(nullptr), interpolateR_(ptf.interpolateR_), - R_(ptf.R_), interpolateL_(ptf.interpolateL_), - L_(ptf.L_), interpolateU_(ptf.interpolateU_), + R_(ptf.R_), + L_(ptf.L_), U_(ptf.U_), UMean_(ptf.UMean_), @@ -922,10 +922,10 @@ turbulentDFSEMInletFvPatchVectorField mapMethod_(ptf.mapMethod_), mapperPtr_(nullptr), interpolateR_(ptf.interpolateR_), - R_(ptf.R_), interpolateL_(ptf.interpolateL_), - L_(ptf.L_), interpolateU_(ptf.interpolateU_), + R_(ptf.R_), + L_(ptf.L_), U_(ptf.U_), UMean_(ptf.UMean_), diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H index eaae2a73ba0..640c35351e9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H @@ -104,7 +104,7 @@ class turbulentDFSEMInletFvPatchVectorField : public fixedValueFvPatchVectorField { - // Private data + // Private Data //- Maximum number of attempts when seeding eddies static label seedIterMax_; @@ -136,18 +136,18 @@ class turbulentDFSEMInletFvPatchVectorField //- Flag to identify to interpolate the R field bool interpolateR_; - //- Reynolds stress tensor - symmTensorField R_; - //- Flag to identify to interpolate the L field bool interpolateL_; - //- Length scale - scalarField L_; - //- Flag to identify to interpolate the U field bool interpolateU_; + //- Reynolds stress tensor + symmTensorField R_; + + //- Length scale + scalarField L_; + //- Inlet velocity vectorField U_; -- GitLab