This test checks that the CG solver leaves the input invariant if the RHS is constructed as b_c = A_CG * u_random with some vector u_random, when the same u_random is used as the initial guess for the algorithm.
More...
This test checks that the CG solver leaves the input invariant if the RHS is constructed as b_c = A_CG * u_random with some vector u_random, when the same u_random is used as the initial guess for the algorithm.
It shows that the solution of the problem A * u = A * u_random converges to u_random in one iteration. u_random has to satisfy the boundary conditions but can be random at the interior vertices.
Algorithm:
- Generate u_random by assigning a value from [0,1] to each vertex.
- Set u_random to 0 at the boundary vertices to satisfy the boundary conditions.
- Compute b_c = A_CG * u_random, where A_CG is the system matrix for CG.
- Solve A_CG * u = b_c with CollocatedSolver with u_random as the initial guess.
- Check |u - u_random| < tol after the first iteration of the solver.