Solves the system Ax=b and return the solution, IJ interface.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hypre_obj), | intent(inout) | :: | this |
Hypre machinery |
||
| type(eulerian_obj_r), | intent(inout) | :: | sol |
Solution vector |
impure subroutine hypre_obj_SolveIJ(this,sol) !> Solves the system Ax=b and return the solution, IJ interface. implicit none class(hypre_obj), intent(inout) :: this !! Hypre machinery type(eulerian_obj_r), intent(inout) :: sol !! Solution vector ! Work variables integer :: ierr integer :: i,j,k,n select case (this%solver_name) case (HYPRE_SOL_IJ_AMG_NONE) call HYPRE_BoomerAMGSolve (this%solver, this%par_matrix, this%par_rhs, this%par_sol, ierr) call HYPRE_BoomerAMGGetNumIterations(this%solver, this%it, ierr) call HYPRE_BoomerAMGGetFinalReltvRes(this%solver, this%rel, ierr) case (HYPRE_SOL_IJ_PCG_AMG) call HYPRE_ParCSRPCGSolve (this%solver, this%par_matrix, this%par_rhs, this%par_sol, ierr) call HYPRE_ParCSRPCGGetNumIterations(this%solver, this%it, ierr) call HYPRE_ParCSRPCGGetFinalRelative(this%solver, this%rel, ierr) case (HYPRE_SOL_IJ_PCG_DS) call HYPRE_ParCSRPCGSolve (this%solver, this%par_matrix, this%par_rhs, this%par_sol, ierr) call HYPRE_ParCSRPCGGetNumIterations(this%solver, this%it, ierr) call HYPRE_ParCSRPCGGetFinalRelative(this%solver, this%rel, ierr) case default call this%parallel%Stop("Unknown HYPRE solver") end select ! - Transfer solution associate(lo=>this%block%lo, hi=>this%block%hi, irow=>this%irow, & irow_hi=>this%irow_hi,irow_lo =>this%irow_lo) call HYPRE_IJVectorGetValues(this%sol, irow_hi-irow_lo+1,this%rows,this%sol_values, ierr) do k=lo(3),hi(3) do j=lo(2),hi(2) do i=lo(1),hi(1) n = irow%cell(i,j,k) - irow_lo + 1 sol%cell(i,j,k) = this%sol_values(n) end do end do end do call sol%UpdateGhostCells end associate return end subroutine hypre_obj_SolveIJ