Sets up solver with IJ interface. Note: for PCG/GMRES/BiCGSTAB, precond_id means: 1 - ds preconditioner 2 - amg preconditioner 3 - pilut preconditioner 4 - ParaSails preconditioner
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hypre_obj), | intent(inout) | :: | this |
Hypre machinery |
impure subroutine hypre_obj_SetupSolIJver(this) !> Sets up solver with IJ interface. ! Note: for PCG/GMRES/BiCGSTAB, precond_id means: ! 1 - ds preconditioner ! 2 - amg preconditioner ! 3 - pilut preconditioner ! 4 - ParaSails preconditioner implicit none class(hypre_obj), intent(inout) :: this !! Hypre machinery ! Work variables integer :: ierr integer :: precond_id select case (this%solver_name) case (HYPRE_SOL_IJ_AMG_NONE) ! Using Boomer AMG (no preconditioning) call HYPRE_BoomerAMGCreate (this%solver, ierr) call HYPRE_BoomerAMGSetPrintLevel (this%solver, 0, ierr) call HYPRE_BoomerAMGSetRelaxType (this%solver, this%RelaxType, ierr) call HYPRE_BoomerAMGSetRelaxOrder (this%solver, 0, ierr) call HYPRE_BoomerAMGSetCoarsenType (this%solver, this%CoarsenType, ierr) call HYPRE_BoomerAMGSetKeepTransp (this%solver, 1, ierr) #ifdef USE_GPU ! Parameters optimized for GPU call HYPRE_BoomerAMGSetInterpType (this%solver, 14, ierr) call HYPRE_BoomerAMGSetAggNumLevels (this%solver, 0, ierr) call HYPRE_BoomerAMGSetAggInterpType(this%solver, 5, ierr) call HYPRE_BoomerAMGSetRAP2 (this%solver, 0, ierr) #else ! Parameters optimized for CPU call HYPRE_BoomerAMGSetInterpType (this%solver, 6, ierr) call HYPRE_BoomerAMGSetPMaxElmts (this%solver, 4, ierr) #endif call HYPRE_BoomerAMGSetNumSweeps (this%solver, 1, ierr) call HYPRE_BoomerAMGSetMaxLevels (this%solver, 25, ierr) call HYPRE_BoomerAMGSetMaxIter (this%solver, this%MaxIt, ierr) call HYPRE_BoomerAMGSetTol (this%solver, this%MaxTol, ierr) call HYPRE_BoomerAMGSetup(this%solver, this%par_matrix, this%par_rhs, this%par_sol, ierr) case (HYPRE_SOL_IJ_PCG_AMG) ! Using PCG with AMG preconditioning call HYPRE_ParCSRPCGCreate (this%comm, this%solver, ierr) call HYPRE_ParCSRPCGSetTwoNorm (this%solver, 1, ierr) call HYPRE_ParCSRPCGSetTol (this%solver, this%MaxTol, ierr) call HYPRE_ParCSRPCGSetMaxIter (this%solver, this%MaxIt, ierr) call HYPRE_ParCSRPCGSetPrintLevel (this%solver, 2, ierr) call HYPRE_ParCSRPCGSetLogging (this%solver, 1, ierr) ! Use BoomerAMG as preconditioner call HYPRE_BoomerAMGCreate (this%precond, ierr) call HYPRE_BoomerAMGSetRelaxType (this%solver, this%RelaxType, ierr) call HYPRE_BoomerAMGSetCoarsenType (this%solver, this%CoarsenType, ierr) call HYPRE_BoomerAMGSetInterpType (this%precond, 6, ierr) call HYPRE_BoomerAMGSetPrintLevel (this%precond, 1, ierr) call HYPRE_BoomerAMGSetNumSweeps (this%precond, 1, ierr) !call HYPRE_BoomerAMGSetMaxIter (this%precond, 1, ierr) call HYPRE_BoomerAMGSetTol (this%precond, 0.0_wp, ierr) precond_id=2 call HYPRE_ParCSRPCGSetPrecond(this%solver, precond_id, this%precond, ierr) call HYPRE_ParCSRPCGSetup(this%solver, this%par_matrix, this%par_rhs, this%par_sol, ierr) case (HYPRE_SOL_IJ_PCG_DS) ! Using PCG with DS preconditioning call HYPRE_ParCSRPCGCreate (this%comm, this%solver, ierr) call HYPRE_ParCSRPCGSetTol (this%solver, this%MaxTol, ierr) call HYPRE_ParCSRPCGSetMaxIter (this%solver, this%MaxIt, ierr) call HYPRE_ParCSRPCGSetTwoNorm (this%solver, 1, ierr) !call HYPRE_ParCSRPCGSetPrintLevel(this%solver, 2, ierr) call HYPRE_ParCSRPCGSetLogging (this%solver, 1, ierr) precond_id=1 call HYPRE_ParCSRPCGSetPrecond(this%solver, precond_id, this%precond, ierr) call HYPRE_ParCSRPCGSetup(this%solver, this%par_matrix, this%par_rhs, this%par_sol, ierr) case default call this%parallel%Stop("Unknown HYPRE solver") end select return end subroutine hypre_obj_SetupSolIJver