From 756d10c37c91697708784c8104be2ed480bb4a10 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 1 Feb 2019 14:24:33 +0000 Subject: [PATCH] reactingEulerFoam: sizeDistribution: Naming conventions The keyword which selects how the subset over which the function operates is generated has been renamed to "selectionMode", to make it more consistent with other parts of the OpenFOAM (e.g., fvOptions). It can still take the value "all" or "cellZone". A cell zone is now specified with a "cellZone", again for consistency. Error messaging has also been overhauled. Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum Dresden - Rossendorf (HZDR) --- .../sizeDistribution/sizeDistribution.C | 59 +++++++++++-------- .../sizeDistribution/sizeDistribution.H | 26 ++++---- .../binaryBreakup/system/controlDict | 2 +- .../breakup/system/controlDict | 2 +- .../coalescence/system/controlDict | 2 +- .../system/controlDict | 4 +- .../drift/system/controlDict | 4 +- .../negativeDrift/system/controlDict | 4 +- .../system/controlDict | 4 +- .../system/controlDict | 4 +- 10 files changed, 59 insertions(+), 52 deletions(-) diff --git a/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.C b/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.C index 8011f25269..579879ca11 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.C +++ b/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,7 @@ template<> const char* Foam::NamedEnum < - Foam::functionObjects::sizeDistribution::regionTypes, + Foam::functionObjects::sizeDistribution::selectionModeTypes, 2 >::names[] = {"cellZone", "all"}; @@ -70,9 +70,9 @@ Foam::NamedEnum const Foam::NamedEnum < - Foam::functionObjects::sizeDistribution::regionTypes, + Foam::functionObjects::sizeDistribution::selectionModeTypes, 2 -> Foam::functionObjects::sizeDistribution::regionTypeNames_; +> Foam::functionObjects::sizeDistribution::selectionModeTypeNames_; const Foam::NamedEnum < @@ -118,9 +118,9 @@ void Foam::functionObjects::sizeDistribution::initialise default: { - FatalErrorInFunction - << "Unknown function type. Valid function types are:" - << functionTypeNames_ << nl << exit(FatalError); + FatalIOErrorInFunction(dict) + << "Unknown functionType. Valid types are:" + << functionTypeNames_ << nl << exit(FatalIOError); } } @@ -138,9 +138,9 @@ void Foam::functionObjects::sizeDistribution::initialise default: { - FatalErrorInFunction - << "Unknown abszissa type. Valid abszissa types are:" - << abszissaTypeNames_ << nl << exit(FatalError); + FatalIOErrorInFunction(dict) + << "Unknown abszissaType. Valid types are:" + << abszissaTypeNames_ << nl << exit(FatalIOError); } } @@ -148,16 +148,18 @@ void Foam::functionObjects::sizeDistribution::initialise if (nCells_ == 0) { - FatalErrorInFunction + FatalIOErrorInFunction(dict) << type() << " " << name() << ": " - << regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl - << " Region has no cells" << exit(FatalError); + << selectionModeTypeNames_[selectionModeType_] + << "(" << selectionModeTypeName_ << "):" << nl + << " Selection has no cells" << exit(FatalIOError); } volume_ = volume(); Info<< type() << " " << name() << ":" - << regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl + << selectionModeTypeNames_[selectionModeType_] + << "(" << selectionModeTypeName_ << "):" << nl << " total cells = " << nCells_ << nl << " total volume = " << volume_ << nl << endl; @@ -166,20 +168,22 @@ void Foam::functionObjects::sizeDistribution::initialise void Foam::functionObjects::sizeDistribution::setCellZoneCells() { - switch (regionType_) + switch (selectionModeType_) { case rtCellZone: { - dict().lookup("name") >> regionName_; + dict().lookup("cellZone") >> selectionModeTypeName_; - label zoneId = mesh().cellZones().findZoneID(regionName_); + label zoneId = + mesh().cellZones().findZoneID(selectionModeTypeName_); if (zoneId < 0) { - FatalErrorInFunction - << "Unknown cell zone name: " << regionName_ - << ". Valid cell zones are: " << mesh().cellZones().names() - << nl << exit(FatalError); + FatalIOErrorInFunction(dict_) + << "Unknown cellZone name: " << selectionModeTypeName_ + << ". Valid cellZone names are: " + << mesh().cellZones().names() + << nl << exit(FatalIOError); } cellId_ = mesh().cellZones()[zoneId]; @@ -196,9 +200,9 @@ void Foam::functionObjects::sizeDistribution::setCellZoneCells() default: { - FatalErrorInFunction - << "Unknown region type. Valid region types are:" - << regionTypeNames_ << nl << exit(FatalError); + FatalIOErrorInFunction(dict_) + << "Unknown selectionMode type. Valid selectionMode types are:" + << selectionModeTypeNames_ << nl << exit(FatalIOError); } } } @@ -345,8 +349,11 @@ Foam::functionObjects::sizeDistribution::sizeDistribution fvMeshFunctionObject(name, runTime, dict), logFiles(obr_, name), dict_(dict), - regionType_(regionTypeNames_.read(dict.lookup("regionType"))), - regionName_(word::null), + selectionModeType_ + ( + selectionModeTypeNames_.read(dict.lookup("selectionMode")) + ), + selectionModeTypeName_(word::null), functionType_(functionTypeNames_.read(dict.lookup("functionType"))), abszissaType_(abszissaTypeNames_.read(dict.lookup("abszissaType"))), nCells_(0), diff --git a/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.H b/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.H index 76f24f0556..362d8cbc6e 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.H +++ b/applications/solvers/multiphase/reactingEulerFoam/functionObjects/sizeDistribution/sizeDistribution.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ Description ... functionType numberDensity; abszissaType volume; - regionType all; + selectionMode all; populationBalanceModel bubbles; normalize true; } @@ -57,8 +57,8 @@ Usage moments | yes | abszissaType | volume, diameter | yes | momentOrder | Write moment up to given order | no | 0 - regionType | Evaluate for cellZone or entire mesh | yes | - cellZoneName | Required if regionType is cellZone | | + selectionMode | Evaluate for cellZone or entire mesh | yes | + cellZone | Required if selectionMode is cellZone | | populationBalanceModel | Respective populationBalanceModel | yes | normalize | Normalization | no | \endtable @@ -106,15 +106,15 @@ public: // Public data types - //- Region type enumeration - enum regionTypes + //- Selection mode type enumeration + enum selectionModeTypes { rtCellZone, rtAll }; - //- Region type names - static const NamedEnum regionTypeNames_; + //- Selection mode type names + static const NamedEnum selectionModeTypeNames_; //- Function type enumeration @@ -148,11 +148,11 @@ protected: //- Construction dictionary dictionary dict_; - //- Region type - regionTypes regionType_; + //- Selection mode type + selectionModeTypes selectionModeType_; - //- Name of region - word regionName_; + //- Name of selection + word selectionModeTypeName_; //- Function type functionTypes functionType_; @@ -166,7 +166,7 @@ protected: //- Local list of cell IDs labelList cellId_; - //- Total volume of the evaluated region + //- Total volume of the evaluated selection scalar volume_; //- Optionally write the volume of the sizeDistribution diff --git a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/binaryBreakup/system/controlDict b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/binaryBreakup/system/controlDict index 6dc113c3a5..dd7022d875 100644 --- a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/binaryBreakup/system/controlDict +++ b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/binaryBreakup/system/controlDict @@ -64,7 +64,7 @@ functions functionType numberDensity; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } } diff --git a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/breakup/system/controlDict b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/breakup/system/controlDict index 6dc113c3a5..dd7022d875 100644 --- a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/breakup/system/controlDict +++ b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/breakup/system/controlDict @@ -64,7 +64,7 @@ functions functionType numberDensity; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } } diff --git a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/coalescence/system/controlDict b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/coalescence/system/controlDict index f61f58ee1d..028b504bf2 100644 --- a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/coalescence/system/controlDict +++ b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/coalescence/system/controlDict @@ -64,7 +64,7 @@ functions functionType numberDensity; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } } diff --git a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/simultaneousCoalescenceAndBreakup/system/controlDict b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/simultaneousCoalescenceAndBreakup/system/controlDict index b97dcc9ed9..9373f66bf1 100644 --- a/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/simultaneousCoalescenceAndBreakup/system/controlDict +++ b/test/multiphase/reactingMultiphaseEulerFoam/populationBalanceModeling/simultaneousCoalescenceAndBreakup/system/controlDict @@ -64,7 +64,7 @@ functions functionType numberDensity; abszissaType diameter; - regionType all; + selectionMode all; populationBalance bubbles; normalize true; } @@ -80,7 +80,7 @@ functions functionType volumeDensity; abszissaType diameter; - regionType all; + selectionMode all; populationBalance bubbles; normalize true; } diff --git a/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/drift/system/controlDict b/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/drift/system/controlDict index 030953211d..8e9a8cc9d6 100644 --- a/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/drift/system/controlDict +++ b/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/drift/system/controlDict @@ -64,7 +64,7 @@ functions functionType numberDensity; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } @@ -80,7 +80,7 @@ functions functionType moments; momentOrder 2; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } } diff --git a/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/negativeDrift/system/controlDict b/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/negativeDrift/system/controlDict index 030953211d..8e9a8cc9d6 100644 --- a/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/negativeDrift/system/controlDict +++ b/test/multiphase/reactingTwoPhaseEulerFoam/populationBalanceModeling/negativeDrift/system/controlDict @@ -64,7 +64,7 @@ functions functionType numberDensity; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } @@ -80,7 +80,7 @@ functions functionType moments; momentOrder 2; abszissaType volume; - regionType all; + selectionMode all; populationBalance bubbles; } } diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumnPolydisperse/system/controlDict b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumnPolydisperse/system/controlDict index 5597144fb7..c96015342c 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumnPolydisperse/system/controlDict +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/laminar/bubbleColumnPolydisperse/system/controlDict @@ -115,8 +115,8 @@ functions functionType numberDensity; abszissaType diameter; - regionType cellZone; - name zone; + selectionMode cellZone; + cellZone zone; populationBalance bubbles; } } diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubbleColumnPolydisperse/system/controlDict b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubbleColumnPolydisperse/system/controlDict index 5a9193543a..11c4669d76 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubbleColumnPolydisperse/system/controlDict +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubbleColumnPolydisperse/system/controlDict @@ -101,8 +101,8 @@ functions functionType numberDensity; abszissaType diameter; - regionType cellZone; - name zone; + selectionMode cellZone; + cellZone zone; populationBalance bubbles; } }