19 KSPConvergedReason* convergedReason,
void*)
23 KSPGetApplicationContext(ksp,&context);
26 double residual_scale = 1.0;
34 residual_scale = 1.0/context->
rhs_norm;
49 KSPGetTolerances(ksp,
nullptr,&tol,
nullptr,&maxIts);
51 double scaled_residual = rnorm * residual_scale;
56 offset = std::string(
" ");
58 std::stringstream iter_info;
67 <<
" Iteration " << std::setw(5) << n
68 <<
" Residual " << std::setw(9) << scaled_residual;
70 if (scaled_residual < tol)
72 *convergedReason = KSP_CONVERGED_RTOL;
73 iter_info <<
" CONVERGED\n";
78 return KSP_CONVERGED_ITERATING;
static chi::Timer program_timer
LogStream Log(LOG_LVL level=LOG_0)
std::string GetTimeString() const
std::vector< LBSGroup > groups_
@ RHS_PRECONDITIONED_NORM
PetscErrorCode GSConvergenceTest(KSP ksp, PetscInt n, PetscReal rnorm, KSPConvergedReason *convergedReason, void *)
ResidualScaleType residual_scale_type
double custom_residual_scale
double rhs_preconditioned_norm