diff --git a/src/postProcessing/functionObjects/utilities/fluxSummary/fluxSummary.C b/src/postProcessing/functionObjects/utilities/fluxSummary/fluxSummary.C index 7ec070bef00cf97fb365ccc29fee1df47b6123c9..e1b078a41705cc349ff4bbdafb95b9ee589471db 100644 --- a/src/postProcessing/functionObjects/utilities/fluxSummary/fluxSummary.C +++ b/src/postProcessing/functionObjects/utilities/fluxSummary/fluxSummary.C @@ -677,120 +677,138 @@ Foam::fluxSummary::~fluxSummary() void Foam::fluxSummary::read(const dictionary& dict) { - if (active_) + if (!active_) { - functionObjectFile::read(dict); + return; + } + + functionObjectFile::read(dict); - log_ = dict.lookupOrDefault<Switch>("log", true); + log_ = dict.lookupOrDefault<Switch>("log", true); - mode_ = modeTypeNames_.read(dict.lookup("mode")); - phiName_= dict.lookupOrDefault<word>("phiName", "phi"); - dict.readIfPresent("scaleFactor", scaleFactor_); - dict.readIfPresent("tolerance", tolerance_); + mode_ = modeTypeNames_.read(dict.lookup("mode")); + phiName_= dict.lookupOrDefault<word>("phiName", "phi"); + dict.readIfPresent("scaleFactor", scaleFactor_); + dict.readIfPresent("tolerance", tolerance_); - // initialise with capacity of 10 faceZones - DynamicList<vector> refDir(10); - DynamicList<word> faceZoneName(refDir.size()); - DynamicList<List<label> > faceID(refDir.size()); - DynamicList<List<label> > facePatchID(refDir.size()); - DynamicList<List<scalar> > faceSign(refDir.size()); + // initialise with capacity of 10 faceZones + DynamicList<vector> refDir(10); + DynamicList<word> faceZoneName(refDir.size()); + DynamicList<List<label> > faceID(refDir.size()); + DynamicList<List<label> > facePatchID(refDir.size()); + DynamicList<List<scalar> > faceSign(refDir.size()); - switch (mode_) + switch (mode_) + { + case mdFaceZone: { - case mdFaceZone: - { - List<word> zones(dict.lookup("faceZones")); + List<word> zones(dict.lookup("faceZones")); - forAll(zones, i) - { - initialiseFaceZone - ( - zones[i], - faceZoneName, - faceID, - facePatchID, - faceSign - ); - } - break; - } - case mdFaceZoneAndDirection: + forAll(zones, i) { - List<Tuple2<word, vector> > - zoneAndDirection(dict.lookup("faceZoneAndDirection")); - - forAll(zoneAndDirection, i) - { - initialiseFaceZoneAndDirection - ( - zoneAndDirection[i].first(), - zoneAndDirection[i].second(), - refDir, - faceZoneName, - faceID, - facePatchID, - faceSign - ); - } - break; + initialiseFaceZone + ( + zones[i], + faceZoneName, + faceID, + facePatchID, + faceSign + ); } - case mdCellZoneAndDirection: - { - List<Tuple2<word, vector> > - zoneAndDirection(dict.lookup("cellZoneAndDirection")); + break; + } + case mdFaceZoneAndDirection: + { + List<Tuple2<word, vector> > + zoneAndDirection(dict.lookup("faceZoneAndDirection")); - forAll(zoneAndDirection, i) - { - initialiseCellZoneAndDirection - ( - zoneAndDirection[i].first(), - zoneAndDirection[i].second(), - refDir, - faceZoneName, - faceID, - facePatchID, - faceSign - ); - } - break; - } - default: + forAll(zoneAndDirection, i) { - FatalIOErrorIn + initialiseFaceZoneAndDirection ( - "void Foam::fluxSummary::read(const dictionary&)", - dict - ) - << "unhandled enumeration " << modeTypeNames_[mode_] - << abort(FatalIOError); + zoneAndDirection[i].first(), + zoneAndDirection[i].second(), + refDir, + faceZoneName, + faceID, + facePatchID, + faceSign + ); } + break; } - - faceZoneName_.transfer(faceZoneName); - refDir_.transfer(refDir); - faceID_.transfer(faceID); - facePatchID_.transfer(facePatchID); - faceSign_.transfer(faceSign); - - initialiseFaceArea(); - - if (writeToFile()) + case mdCellZoneAndDirection: { - filePtrs_.setSize(faceZoneName_.size()); + List<Tuple2<word, vector> > + zoneAndDirection(dict.lookup("cellZoneAndDirection")); - forAll(filePtrs_, fileI) + forAll(zoneAndDirection, i) { - const word& fzName = faceZoneName_[fileI]; - filePtrs_.set(fileI, createFile(fzName)); - writeFileHeader + initialiseCellZoneAndDirection ( - fzName, - faceArea_[fileI], - refDir_[fileI], - filePtrs_[fileI] + zoneAndDirection[i].first(), + zoneAndDirection[i].second(), + refDir, + faceZoneName, + faceID, + facePatchID, + faceSign ); } + break; } + default: + { + FatalIOErrorIn + ( + "void Foam::fluxSummary::read(const dictionary&)", + dict + ) + << "unhandled enumeration " << modeTypeNames_[mode_] + << abort(FatalIOError); + } + } + + faceZoneName_.transfer(faceZoneName); + refDir_.transfer(refDir); + faceID_.transfer(faceID); + facePatchID_.transfer(facePatchID); + faceSign_.transfer(faceSign); + + initialiseFaceArea(); + + if (writeToFile()) + { + filePtrs_.setSize(faceZoneName_.size()); + + forAll(filePtrs_, fileI) + { + const word& fzName = faceZoneName_[fileI]; + filePtrs_.set(fileI, createFile(fzName)); + writeFileHeader + ( + fzName, + faceArea_[fileI], + refDir_[fileI], + filePtrs_[fileI] + ); + } + } + + // Provide some output + if (log_) + { + Info<< type() << " " << name_ << " output:" << nl; + + forAll(faceZoneName_, zoneI) + { + const word& zoneName = faceZoneName_[zoneI]; + scalar zoneArea = faceArea_[zoneI]; + + Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl; + } + + Info<< endl; } }