/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017-2019 OpenFOAM Foundation Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "sizeDistribution.H" #include "sizeGroup.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace functionObjects { defineTypeNameAndDebug(sizeDistribution, 0); addToRunTimeSelectionTable(functionObject, sizeDistribution, dictionary); } } const Foam::Enum < Foam::functionObjects::sizeDistribution::selectionModeTypes > Foam::functionObjects::sizeDistribution::selectionModeTypeNames_ ({ {selectionModeTypes::rtCellZone, "cellZone"}, {selectionModeTypes::rtAll, "all"}, }); const Foam::Enum < Foam::functionObjects::sizeDistribution::functionTypes > Foam::functionObjects::sizeDistribution::functionTypeNames_ ({ {functionTypes::ftNdf, "numberDensity"}, {functionTypes::ftVdf, "volumeDensity"}, {functionTypes::ftNc, "numberConcentration"}, {functionTypes::ftMom, "moments"}, }); const Foam::Enum < Foam::functionObjects::sizeDistribution::abszissaTypes > Foam::functionObjects::sizeDistribution::abszissaTypeNames_ ({ {abszissaTypes::atDiameter, "diameter"}, {abszissaTypes::atVolume, "volume"}, }); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void Foam::functionObjects::sizeDistribution::initialise ( const dictionary& dict ) { switch (functionType_) { case ftNdf: { break; } case ftVdf: { break; } case ftNc: { break; } case ftMom: { break; } default: { FatalIOErrorInLookup ( dict, "functionType", word::null, functionTypeNames_ ) << exit(FatalIOError); } } switch (abszissaType_) { case atDiameter: { break; } case atVolume: { break; } default: { FatalIOErrorInLookup ( dict, "abszissaType", word::null, abszissaTypeNames_ ) << exit(FatalIOError); } } setCellZoneCells(); if (nCells_ == 0) { FatalIOErrorInFunction(dict) << type() << " " << name() << ": " << selectionModeTypeNames_[selectionModeType_] << '(' << selectionModeTypeName_ << "):" << nl << " Selection has no cells" << exit(FatalIOError); } volume_ = volume(); Info<< type() << " " << name() << ":" << selectionModeTypeNames_[selectionModeType_] << '(' << selectionModeTypeName_ << "):" << nl << " total cells = " << nCells_ << nl << " total volume = " << volume_ << nl << endl; } void Foam::functionObjects::sizeDistribution::setCellZoneCells() { switch (selectionModeType_) { case rtCellZone: { dict().readEntry("cellZone", selectionModeTypeName_); label zoneId = mesh().cellZones().findZoneID(selectionModeTypeName_); if (zoneId < 0) { FatalIOErrorInFunction(dict_) << "Unknown cellZone name: " << selectionModeTypeName_ << ". Valid cellZone names are: " << mesh().cellZones().names() << nl << exit(FatalIOError); } cellId_ = mesh().cellZones()[zoneId]; nCells_ = returnReduce(cellId_.size(), sumOp