Skip to content
Snippets Groups Projects
Commit 09e91aab authored by andy's avatar andy
Browse files

ENH: rotorDiskSource - updated calculation of co-ord sys for parallel running

parent 61b511e0
Branches
Tags
No related merge requests found
...@@ -252,7 +252,7 @@ void Foam::rotorDiskSource::createCoordinateSystem() ...@@ -252,7 +252,7 @@ void Foam::rotorDiskSource::createCoordinateSystem()
{ {
case gmAuto: case gmAuto:
{ {
// determine rotation origin // determine rotation origin (cell volume weighted)
scalar sumV = 0.0; scalar sumV = 0.0;
const scalarField& V = mesh_.V(); const scalarField& V = mesh_.V();
const vectorField& C = mesh_.C(); const vectorField& C = mesh_.C();
...@@ -262,6 +262,8 @@ void Foam::rotorDiskSource::createCoordinateSystem() ...@@ -262,6 +262,8 @@ void Foam::rotorDiskSource::createCoordinateSystem()
sumV += V[cellI]; sumV += V[cellI];
origin += V[cellI]*C[cellI]; origin += V[cellI]*C[cellI];
} }
reduce(origin, sumOp<vector>());
reduce(sumV, sumOp<scalar>());
origin /= sumV; origin /= sumV;
// determine first radial vector // determine first radial vector
...@@ -277,6 +279,8 @@ void Foam::rotorDiskSource::createCoordinateSystem() ...@@ -277,6 +279,8 @@ void Foam::rotorDiskSource::createCoordinateSystem()
magR = mag(test); magR = mag(test);
} }
} }
reduce(dx1, maxMagSqrOp<vector>());
magR = mag(dx1);
// determine second radial vector and cross to determine axis // determine second radial vector and cross to determine axis
forAll(cells_, i) forAll(cells_, i)
...@@ -292,6 +296,7 @@ void Foam::rotorDiskSource::createCoordinateSystem() ...@@ -292,6 +296,7 @@ void Foam::rotorDiskSource::createCoordinateSystem()
} }
} }
} }
reduce(axis, maxMagSqrOp<vector>());
axis /= mag(axis); axis /= mag(axis);
// axis direction is somewhat arbitrary - check if user needs // axis direction is somewhat arbitrary - check if user needs
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment