From 86c5f9e3b6a38176d2c27cf19e09a0c7b4eec3b6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 14 Dec 2016 12:21:45 +0100 Subject: [PATCH] BUG: allocation mismatch in fluxSummary (issue #342) ENH: reduce number of variables, simplify code - Note: use boolList instead of scalarList for managing the face signs since its lazy evaluation can be convenient when sign information is not required. --- .../field/fluxSummary/fluxSummary.C | 263 +++++++++--------- .../field/fluxSummary/fluxSummary.H | 44 +-- 2 files changed, 160 insertions(+), 147 deletions(-) diff --git a/src/functionObjects/field/fluxSummary/fluxSummary.C b/src/functionObjects/field/fluxSummary/fluxSummary.C index dc403701a4..5950b33c4a 100644 --- a/src/functionObjects/field/fluxSummary/fluxSummary.C +++ b/src/functionObjects/field/fluxSummary/fluxSummary.C @@ -70,17 +70,44 @@ Foam::functionObjects::fluxSummary::modeTypeNames_; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +Foam::word Foam::functionObjects::fluxSummary::checkFlowType +( + const dimensionSet& dims, + const word& fieldName +) const +{ + if (dims == dimVolume/dimTime) + { + return "volumetric"; + } + else if (dims == dimMass/dimTime) + { + return "mass"; + } + else + { + FatalErrorInFunction + << "Unsupported flux field " << fieldName << " with dimensions " + << dims + << ". Expected either mass flow or volumetric flow rate." + << abort(FatalError); + + return Foam::word::null; + } +} + + void Foam::functionObjects::fluxSummary::initialiseFaceZone ( const word& faceZoneName, - DynamicList& faceZoneNames, + DynamicList& names, + DynamicList& directions, DynamicList>& faceID, DynamicList>& facePatchID, - DynamicList>& faceSign + DynamicList& faceFlip ) const { label zonei = mesh_.faceZones().findZoneID(faceZoneName); - if (zonei == -1) { FatalErrorInFunction @@ -88,14 +115,14 @@ void Foam::functionObjects::fluxSummary::initialiseFaceZone << ". Valid faceZones are: " << mesh_.faceZones().names() << exit(FatalError); } - - faceZoneNames.append(faceZoneName); - const faceZone& fZone = mesh_.faceZones()[zonei]; + names.append(faceZoneName); + directions.append(Zero); // dummy value + DynamicList