Commit bbafdc4e authored by Timo Koch's avatar Timo Koch
Browse files

Merge branch 'fix/rotationsymmetry' into 'master'

Rotationsymmetry: Fix bug to rotate around second axis

See merge request !1832
parents 4352c78e 573457da
...@@ -113,7 +113,7 @@ public: ...@@ -113,7 +113,7 @@ public:
//! The volume of the sub control volume (Guldinus theorem) //! The volume of the sub control volume (Guldinus theorem)
Scalar volume() const Scalar volume() const
{ {
const auto radius = this->center()[1]; const auto radius = this->center()[0];
return SubControlVolume::volume()*2.0*M_PI*radius; return SubControlVolume::volume()*2.0*M_PI*radius;
} }
}; };
......
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
//! The area of the sub control volume face (Guldinus theorem) //! The area of the sub control volume face (Guldinus theorem)
Scalar area() const Scalar area() const
{ {
const auto radius = this->center()[1]; const auto radius = this->center()[0];
return SubControlVolumeFace::area()*2.0*M_PI*radius; return SubControlVolumeFace::area()*2.0*M_PI*radius;
} }
}; };
......
...@@ -140,8 +140,9 @@ int main (int argc, char *argv[]) try ...@@ -140,8 +140,9 @@ int main (int argc, char *argv[]) try
// make a grid // make a grid
const double innerRadius = 0.1; const double innerRadius = 0.1;
const double outerRadius = 1.0; const double outerRadius = 1.0;
GlobalPosition lower({innerRadius, innerRadius}); const double height = 0.5;
GlobalPosition upper({outerRadius, outerRadius}); GlobalPosition lower({innerRadius, 0});
GlobalPosition upper({outerRadius, height});
std::array<unsigned int, Grid::dimension> els({20, 20}); std::array<unsigned int, Grid::dimension> els({20, 20});
std::shared_ptr<Grid> grid = Dune::StructuredGridFactory<Grid>::createCubeGrid(lower, upper, els); std::shared_ptr<Grid> grid = Dune::StructuredGridFactory<Grid>::createCubeGrid(lower, upper, els);
...@@ -152,9 +153,9 @@ int main (int argc, char *argv[]) try ...@@ -152,9 +153,9 @@ int main (int argc, char *argv[]) try
// compute the annulus area and the surface // compute the annulus area and the surface
const auto centroidRadius = 0.5*(innerRadius + outerRadius); const auto centroidRadius = 0.5*(innerRadius + outerRadius);
const auto side = (outerRadius - innerRadius); const auto width = (outerRadius - innerRadius);
const double refVolume = side*side*2.0*M_PI*centroidRadius; const double refVolume = height*width*2.0*M_PI*centroidRadius;
const double refSurface = 4.0*side*2.0*M_PI*centroidRadius; const double refSurface = (2.0*height + 2.0*width)*2.0*M_PI*centroidRadius;
runTest(gg, refVolume, refSurface); runTest(gg, refVolume, refSurface);
std::cout << "Successfully tested toroid policy." << std::endl; std::cout << "Successfully tested toroid policy." << std::endl;
...@@ -170,9 +171,11 @@ int main (int argc, char *argv[]) try ...@@ -170,9 +171,11 @@ int main (int argc, char *argv[]) try
// make a grid // make a grid
const double innerRadius = 0.0; const double innerRadius = 0.0;
const double outerRadius = 1.0; const double outerRadius = 1.1;
GlobalPosition lower({innerRadius, innerRadius}); const double minY = -0.25;
GlobalPosition upper({outerRadius, outerRadius}); const double height = 0.5;
GlobalPosition lower({innerRadius, minY});
GlobalPosition upper({outerRadius, minY+height});
std::array<unsigned int, Grid::dimension> els({20, 20}); std::array<unsigned int, Grid::dimension> els({20, 20});
std::shared_ptr<Grid> grid = Dune::StructuredGridFactory<Grid>::createCubeGrid(lower, upper, els); std::shared_ptr<Grid> grid = Dune::StructuredGridFactory<Grid>::createCubeGrid(lower, upper, els);
...@@ -182,8 +185,8 @@ int main (int argc, char *argv[]) try ...@@ -182,8 +185,8 @@ int main (int argc, char *argv[]) try
gg.update(); gg.update();
// compute the annulus area and the surface // compute the annulus area and the surface
const double refVolume = outerRadius*M_PI*outerRadius*outerRadius; const double refVolume = height*M_PI*outerRadius*outerRadius;
const double refSurface = 2.0*M_PI*outerRadius + 2.0*M_PI*outerRadius*outerRadius; const double refSurface = 2.0*M_PI*outerRadius*height + 2.0*M_PI*outerRadius*outerRadius;
runTest(gg, refVolume, refSurface); runTest(gg, refVolume, refSurface);
std::cout << "Successfully tested toroid policy for perfect cylinder." << std::endl; std::cout << "Successfully tested toroid policy for perfect cylinder." << std::endl;
......
Supports Markdown
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