Subroutine to solve the system (sparse A)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(MAT_SOLV), | intent(inout), | target | :: | mat | high level system type |
subroutine solution_solver(mat)
implicit none
type(MAT_SOLV), target, intent(inout) :: mat !! *high level system type*
integer(kind=I4) :: ierr
select case(mat%slv_t)
case(MA48)
call ma48_solve(matrix = mat%matma48%zmat, &
factors = mat%matma48%fact, &
rhs = mat%b, &
x = mat%x, &
control = mat%matma48%ctrl, &
sinfo = mat%matma48%sinf, &
resid = mat%matma48%resid, &
error = mat%error)
case(MUMP)
mat%matmump%job = 3
call dmumps(mat%matmump)
if (mat%matmump%infog(1) < 0) then
write(OPU,'(a,a,i6,a,i9)') ' error return: ', &
' mumps_par%infog(1)= ', mat%matmump%infog(1), &
' mumps_par%infog(2)= ', mat%matmump%infog(2)
call mpi_finalize(ierr)
stop 'Error in SOLUTION_SOLVER'
endif
! solution has been assembled on the host
if ( mat%matmump%myid == 0 ) then
mat%x(1:mat%nn) = mat%matmump%rhs(1:mat%nn)
endif
case(SULU)
call solv_superlu(sol_x = mat%x, &
sulu = mat%matsulu, &
verbose = (mat%matsulu%options%PrintStat==1))
mat%matsulu%first = .false.
case(UMFP)
! Numeric factors must exist
if (.not.C_ASSOCIATED(mat%matumfp%c_numeric)) call solve_syst(mat, 'fac')
mat%matumfp%c_control(UMFPACK_IRSTEP) = 0 ! solve ax=b, without iterative refinement
! If you want to evaluate the required RAM (Go)
! write(*,*) mat%matumfp%c_info(UMFPACK_PEAK_MEMORY_ESTIMATE)/mat%matumfp%c_info(UMFPACK_SIZE_OF_UNIT)/1e9
! write(*,*) sizeof(mat%a_elt)/1e9
call s_umfpack_di_solve(sys = UMFPACK_A, &
x = mat%x, &
b = mat%b, &
numeric = mat%matumfp%c_numeric, &
control = mat%matumfp%c_control, &
info = mat%matumfp%c_info)
if (mat%matumfp%c_info(UMFPACK_STATUS) < 0) then
write(OPU, *) 'error occurred in umfpack_di_solve: ', mat%matumfp%c_info(UMFPACK_STATUS)
stop 'Error in SOLUTION_SOLVER'
endif
case default
stop 'Unknown solver type, SOLUTION_SOLVER'
endselect
return
endsubroutine solution_solver