14 KSP ksp, PetscInt n, PetscReal rnorm,
void *monitordestroy)
20 VecNorm(Rhs,NORM_2,&rhs_norm);
21 if (rhs_norm < 1.0e-25)
26 const auto ksp_name =
"Diffusion";
28 std::stringstream buff;
34 << std::scientific << std::setprecision(7) << rnorm / rhs_norm
45 KSP ksp, PetscInt n, PetscReal rnorm,
46 KSPConvergedReason* convergedReason,
void*)
52 VecNorm(Rhs,NORM_2,&rhs_norm);
53 if (rhs_norm < 1.0e-25)
59 KSPGetTolerances(ksp,NULL,&tol,NULL,&maxIts);
61 double relative_residual = rnorm/rhs_norm;
63 Chi::log.
Log() <<
"Iteration " << n <<
" Residual " << rnorm/rhs_norm;
65 if (relative_residual < tol)
66 *convergedReason = KSP_CONVERGED_RTOL;
68 return KSP_CONVERGED_ITERATING;
static chi::MPI_Info & mpi
LogStream Log(LOG_LVL level=LOG_0)
PetscErrorCode DiffusionConvergenceTestNPT(KSP ksp, PetscInt n, PetscReal rnorm, KSPConvergedReason *convergedReason, void *monitordestroy)
PetscErrorCode KSPMonitorAChiTech(KSP ksp, PetscInt n, PetscReal rnorm, void *monitordestroy)