Subroutine to initialize the matrices of the solver
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(MAT_SOLV), | intent(inout) | :: | mat | high level system type |
subroutine init_solver(mat)
implicit none
type(MAT_SOLV), intent(inout) :: mat !! *high level system type*
integer(kind=I4) :: ierr
! allocation of the system vectors: rhs and unknown
allocate( mat%b(mat%nn), mat%x(mat%nn) )
mat%b = HIG_R8
mat%x = HIG_R8
! check solver type
select case (mat%slv_t)
case(MA48)
call ma48_initialize(factors = mat%matma48%fact, &
control = mat%matma48%ctrl)
select case(SOLV_MESS)
case(NO_MESS)
mat%matma48%ctrl%wp = -1
mat%matma48%ctrl%mp = -1
mat%matma48%ctrl%ldiag = -1
case(PRINT_MESS:)
mat%matma48%ctrl%ldiag = +2
endselect
case(MUMP)
call mpi_init(ierr)
mat%matmump%comm = MPI_COMM_WORLD
mat%matmump%job = -1 ! initialisation
mat%matmump%sym = 0 ! no symetry
mat%matmump%par = 1 ! MPI, host working
call dmumps(mat%matmump)
mat%matmump%icntl(5) = 1 ! Specify element entry : elemental matrices
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 'MUMP error, INIT_SOLVER'
endif
select case(SOLV_MESS)
case(NO_MESS)
mat%matmump%icntl(4) = 1 ! error output only
case(PRINT_MESS:)
mat%matmump%icntl(4) = 3 ! all error output
endselect
case(SULU)
call init_superlu(sulu = mat%matsulu)
select case(SOLV_MESS)
case(NO_MESS)
mat%matsulu%options%PrintStat = 0
case(PRINT_MESS:)
mat%matsulu%options%PrintStat = 1
endselect
case(UMFP)
mat%matumfp%c_numeric = C_NULL_PTR
call umfpack_di_defaults(mat%matumfp%c_control)
select case(SOLV_MESS)
case(NO_MESS)
mat%matumfp%c_control(UMFPACK_PRL) = 1
case(PRINT_MESS:)
mat%matumfp%c_control(UMFPACK_PRL) = 2
endselect
call umfpack_di_report_control(mat%matumfp%c_control)
case default
stop 'Unknown solver type, INIT_SOLVER'
endselect
return
endsubroutine init_solver