Skip to content
Snippets Groups Projects
Commit 5a1a03ee authored by Elias Pipping's avatar Elias Pipping
Browse files

ProjectedGradienttest: Reduce problem size

The test now passes again. Convergence can now be achieve within a
reasonable timeframe.
parent f9d79662
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ bool solveObstacleProblemByProjectedGradientSolver(const GridType& grid, const M
template <class GridType>
bool checkWithGrid(const GridType& grid, const std::string fileName="")
bool checkWithGrid(const GridType& grid, const std::string fileName, int maxIterations)
{
bool passed = true;
......@@ -115,7 +115,7 @@ bool checkWithGrid(const GridType& grid, const std::string fileName="")
markBoundaryDOFs(gridView, ignore);
solveObstacleProblemByProjectedGradientSolver(grid, A, u, rhs, ignore);
solveObstacleProblemByProjectedGradientSolver(grid, A, u, rhs, ignore, maxIterations);
if (fileName!="")
{
......@@ -129,7 +129,7 @@ bool checkWithGrid(const GridType& grid, const std::string fileName="")
template <int dim>
bool checkWithYaspGrid(int refine, const std::string fileName="")
bool checkWithYaspGrid(int refine, const std::string fileName, int maxIterations)
{
bool passed = true;
......@@ -150,7 +150,7 @@ bool checkWithYaspGrid(int refine, const std::string fileName="")
std::cout << "Number of levels: " << (grid.maxLevel()+1) << std::endl;
std::cout << "Number of leaf nodes: " << grid.leafGridView().size(dim) << std::endl;
passed = passed and checkWithGrid(grid, fileName);
passed = passed and checkWithGrid(grid, fileName, maxIterations);
return passed;
......@@ -164,9 +164,13 @@ int main(int argc, char** argv) try
bool passed(true);
int refine1d = 16;
int refine2d = 8;
int refine3d = 5;
int refine1d = 7;
int refine2d = 5;
int refine3d = 4;
int maxIter1D = 10000;
int maxIter2D = 1000;
int maxIter3D = 100;
if (argc>1)
std::istringstream(argv[1]) >> refine1d;
......@@ -175,9 +179,9 @@ int main(int argc, char** argv) try
if (argc>3)
std::istringstream(argv[3]) >> refine3d;
passed = passed and checkWithYaspGrid<1>(refine1d, "projectedgradienttest_yasp_1d_solution");
passed = passed and checkWithYaspGrid<2>(refine2d, "projectedgradienttest_yasp_2d_solution");
passed = passed and checkWithYaspGrid<3>(refine3d, "projectedgradienttest_yasp_3d_solution");
passed = passed and checkWithYaspGrid<1>(refine1d, "projectedgradienttest_yasp_1d_solution", maxIter1D);
passed = passed and checkWithYaspGrid<2>(refine2d, "projectedgradienttest_yasp_2d_solution", maxIter2D);
passed = passed and checkWithYaspGrid<3>(refine3d, "projectedgradienttest_yasp_3d_solution", maxIter3D);
return passed ? 0 : 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment