From 09e91aab32441f6df30f9f4f51af4304f0fd152a Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 5 Apr 2012 11:26:39 +0100 Subject: [PATCH] ENH: rotorDiskSource - updated calculation of co-ord sys for parallel running --- .../basicSource/rotorDiskSource/rotorDiskSource.C | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C index 8177c02efa..c2a3511485 100644 --- a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C +++ b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C @@ -252,7 +252,7 @@ void Foam::rotorDiskSource::createCoordinateSystem() { case gmAuto: { - // determine rotation origin + // determine rotation origin (cell volume weighted) scalar sumV = 0.0; const scalarField& V = mesh_.V(); const vectorField& C = mesh_.C(); @@ -262,6 +262,8 @@ void Foam::rotorDiskSource::createCoordinateSystem() sumV += V[cellI]; origin += V[cellI]*C[cellI]; } + reduce(origin, sumOp()); + reduce(sumV, sumOp()); origin /= sumV; // determine first radial vector @@ -277,6 +279,8 @@ void Foam::rotorDiskSource::createCoordinateSystem() magR = mag(test); } } + reduce(dx1, maxMagSqrOp()); + magR = mag(dx1); // determine second radial vector and cross to determine axis forAll(cells_, i) @@ -292,6 +296,7 @@ void Foam::rotorDiskSource::createCoordinateSystem() } } } + reduce(axis, maxMagSqrOp()); axis /= mag(axis); // axis direction is somewhat arbitrary - check if user needs