diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index 6c642dfe7b6333d4e71ab8c22f4458da73294503..b068fe51cb80c3abf2a00263f01ea7ff3237042a 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -7,5 +7,6 @@ wmake libso forces wmake libso IO wmake libso utilities wmake libso systemCall +wmake libso zones # ----------------------------------------------------------------- end-of-file diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index ec77782df4e7100291150b701ecb5bafb280bc0b..31e511377ee2152c32861ad1e011feae4ed0868e 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -197,13 +197,13 @@ void Foam::fieldMinMax::calcMinMaxFields<Foam::scalar> { if (obr_.foundObject<volScalarField>(fieldName)) { + const volScalarField& field = + obr_.lookupObject<volScalarField>(fieldName); + scalar minValue = min(field).value(); + scalar maxValue = max(field).value(); + if (Pstream::master()) { - const volScalarField& field = - obr_.lookupObject<volScalarField>(fieldName); - scalar minValue = min(field).value(); - scalar maxValue = max(field).value(); - fieldMinMaxFilePtr_() << obr_.time().value() << tab << fieldName << tab << minValue << tab << maxValue << endl; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 25daf62dd6ee73ecaacf41d0a340eb7d30332327..66f212f4c36d32f1178bd7473f6d51e6c923bf77 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -38,16 +38,16 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) if (obr_.foundObject<fieldType>(fieldName)) { - if (Pstream::master()) + const fieldType& field = obr_.lookupObject<fieldType>(fieldName); + switch (mode_) { - const fieldType& field = obr_.lookupObject<fieldType>(fieldName); - switch (mode_) + case mdMag: { - case mdMag: - { - scalar minValue = min(mag(field)).value(); - scalar maxValue = max(mag(field)).value(); + scalar minValue = min(mag(field)).value(); + scalar maxValue = max(mag(field)).value(); + if (Pstream::master()) + { fieldMinMaxFilePtr_() << obr_.time().value() << tab << fieldName << tab << minValue << tab << maxValue << endl; @@ -61,13 +61,16 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) << maxValue << nl << endl; } - break; } - case mdCmpt: - { - Type minValue = min(field).value(); - Type maxValue = max(field).value(); + break; + } + case mdCmpt: + { + Type minValue = min(field).value(); + Type maxValue = max(field).value(); + if (Pstream::master()) + { fieldMinMaxFilePtr_() << obr_.time().value() << tab << fieldName << tab << minValue << tab << maxValue << endl; @@ -81,17 +84,17 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName) << maxValue << nl << endl; } - break; - } - default: - { - FatalErrorIn - ( - "Foam::fieldMinMax::calcMinMaxFields" - "(const word& fieldName)" - )<< "Unknown min/max mode: " << modeTypeNames_[mode_] - << exit(FatalError); } + break; + } + default: + { + FatalErrorIn + ( + "Foam::fieldMinMax::calcMinMaxFields" + "(const word& fieldName)" + )<< "Unknown min/max mode: " << modeTypeNames_[mode_] + << exit(FatalError); } } } diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C index 0b8314667c728839bc11e72eddc2149e94026fdd..e0489208991d047a207359280ded08d5df2ce5ef 100644 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C +++ b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C @@ -191,7 +191,7 @@ void Foam::faceZonesIntegration::write() if (active_) { makeFile(); - scalar dm = 0.0; + forAll(fItems_, fieldI) { const word& fieldName = fItems_[fieldI]; @@ -201,8 +201,30 @@ void Foam::faceZonesIntegration::write() const fvMesh& mesh = fD.mesh(); + // 1. integrate over all face zones + + scalarField integralVals(faceZonesSet_.size()); + + forAll(faceZonesSet_, setI) + { + const word name = faceZonesSet_[setI]; + + label zoneID = mesh.faceZones().findZoneID(name); + + const faceZone& fz = mesh.faceZones()[zoneID]; + + integralVals[setI] = returnReduce + ( + calcFaceZonesIntegral(fD, fz), + sumOp<scalar>() + ); + } + + unsigned int w = IOstream::defaultPrecision() + 7; + // 2. Write only on master + if ( Pstream::master() @@ -213,26 +235,14 @@ void Foam::faceZonesIntegration::write() os << obr_.time().value(); - const faceZoneMesh& faceZoneList = mesh.faceZones(); - - forAll(faceZonesSet_, zoneI) + forAll(integralVals, setI) { - const word name = faceZonesSet_[zoneI]; - - label zoneID = faceZoneList.findZoneID(name); - - const faceZone& fz = mesh.faceZones()[zoneID]; - - dm = calcFaceZonesIntegral(fD, fz); - - reduce(dm, sumOp<scalar>()); - - os << ' ' << setw(w) << dm; + os << ' ' << setw(w) << integralVals[setI]; if (log_) { Info<< "faceZonesIntegration output:" << nl - << " Integration" << dm << endl; + << " Integration" << integralVals[setI] << endl; } } @@ -258,7 +268,7 @@ Foam::scalar Foam::faceZonesIntegration::calcFaceZonesIntegral if (mesh.isInternalFace(faceI)) { - if (fz.flipMap()[faceI]) + if (fz.flipMap()[i]) { dm -= fD[faceI]; } @@ -275,7 +285,7 @@ Foam::scalar Foam::faceZonesIntegration::calcFaceZonesIntegral { if (refCast<const processorPolyPatch>(pp).owner()) { - if (fz.flipMap()[faceI]) + if (fz.flipMap()[i]) { dm -= fD.boundaryField()[patchI][pp.whichFace(faceI)]; } @@ -290,7 +300,7 @@ Foam::scalar Foam::faceZonesIntegration::calcFaceZonesIntegral label patchFaceI = faceI - pp.start(); if (patchFaceI < pp.size()/2) { - if (fz.flipMap()[patchFaceI]) + if (fz.flipMap()[i]) { dm -= fD.boundaryField()[patchI][patchFaceI]; } @@ -303,7 +313,7 @@ Foam::scalar Foam::faceZonesIntegration::calcFaceZonesIntegral else if (!isA<emptyPolyPatch>(pp)) { label patchFaceI = faceI - pp.start(); - if (fz.flipMap()[patchFaceI]) + if (fz.flipMap()[i]) { dm -= fD.boundaryField()[patchI][patchFaceI]; } diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H index 5fc957bba739954dcf3181cd03d5a7f654e6609f..87659ac3406dc03dec4864001a88819d708729a6 100644 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H +++ b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H @@ -73,16 +73,13 @@ protected: const objectRegistry& obr_; - //- on/off switch - bool active_; + // Read from dictionary - //- Switch to send output to Info as well as to file - Switch log_; + //- on/off switch + bool active_; - //- Current open files - HashPtrTable<OFstream> faceZonesIntegrationFilePtr_; - - // Read from dictionary + //- Switch to send output to Info as well as to file + Switch log_; //- faceZones to integrate over wordList faceZonesSet_; @@ -91,6 +88,11 @@ protected: wordList fItems_; + //- Current open files + HashPtrTable<OFstream> faceZonesIntegrationFilePtr_; + + + // Private Member Functions //- If the integration file has not been created create it