mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
reduce synchronisation
This commit is contained in:
@ -7,5 +7,6 @@ wmake libso forces
|
||||
wmake libso IO
|
||||
wmake libso utilities
|
||||
wmake libso systemCall
|
||||
wmake libso zones
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -196,14 +196,14 @@ void Foam::fieldMinMax::calcMinMaxFields<Foam::scalar>
|
||||
)
|
||||
{
|
||||
if (obr_.foundObject<volScalarField>(fieldName))
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
const volScalarField& field =
|
||||
obr_.lookupObject<volScalarField>(fieldName);
|
||||
scalar minValue = min(field).value();
|
||||
scalar maxValue = max(field).value();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
fieldMinMaxFilePtr_() << obr_.time().value() << tab
|
||||
<< fieldName << tab << minValue << tab << maxValue << endl;
|
||||
|
||||
|
||||
@ -37,8 +37,6 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
if (obr_.foundObject<fieldType>(fieldName))
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
const fieldType& field = obr_.lookupObject<fieldType>(fieldName);
|
||||
switch (mode_)
|
||||
@ -48,6 +46,8 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
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,6 +61,7 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
<< maxValue << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case mdCmpt:
|
||||
@ -68,6 +69,8 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
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,6 +84,7 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
<< maxValue << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -95,7 +99,6 @@ void Foam::fieldMinMax::calcMinMaxFields(const word& fieldName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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];
|
||||
}
|
||||
|
||||
@ -73,17 +73,14 @@ protected:
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
// Read from dictionary
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Current open files
|
||||
HashPtrTable<OFstream> faceZonesIntegrationFilePtr_;
|
||||
|
||||
// Read from dictionary
|
||||
|
||||
//- 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
|
||||
|
||||
Reference in New Issue
Block a user