top_level) mid_jacobi_smoother = SplitSmoother(l_plus / mid_level.h**2, l_minus / mid_level.h**2, mid_level) low_jacobi_smoother = SplitSmoother(l_plus / low_level.h**2, l_minus / low_level.h**2, low_level) low_direct_smoother = DirectSolverSmoother(laplace_stencil, low_level) # time to test the relaxation methods print("===== DirectSolverSmoother Test =====") low_level.rhs[:] = 0.0 low_level.pad() print("arr:", low_level.arr) laplace_stencil.modify_rhs(low_level) print("rhs:", low_level.rhs) low_direct_smoother.relax() print(low_level.arr) low_level.pad() # Lets test the SplitSmoother by using the jacobi smoother # but for this case we need an initial guess print("===== JacobiSmoother Test =====") # define the 3 different JacobiSmoother Implementations jacobi_loop = WeightedJacobiSmoother(laplace_stencil, low_level, 0.5, "loop") jacobi_matrix = WeightedJacobiSmoother(laplace_stencil, low_level, 0.5, "matrix") jacobi_convolve = WeightedJacobiSmoother(laplace_stencil, low_level, 0.5, "convolve") low_level.mid[:] = 105.0 low_level.pad()
mid_jacobi_smoother.relax(n_pre) print("\t\t --After %d Jacobi iterations --" % n_pre) print_all(mid_level) mid_level.compute_residual(mid_stencil) print("\t\t --After the computation of the residual--") print_all(mid_level) rst_mid_to_low.restrict() print("\t\t --After restriction to low level") print_all(low_level) low_direct_smoother.relax() print("\t\t --After direct solve --") print_all(low_level) ipl_low_to_mid.eval() print("\t\t --After interpolation to mid level") print_all(mid_level) mid_jacobi_smoother.relax(n_post) print("\t\t --After %d Jacobi iterations --" % n_post) print_all(mid_level) ipl_mid_to_top.eval()