init_solver Subroutine

public subroutine init_solver(mat)

Arguments

Type IntentOptional AttributesName
type(MAT_SOLV), intent(inout) :: mat

high level system type


Calls

proc~~init_solver~~CallsGraph proc~init_solver init_solver proc~init_superlu init_superlu proc~init_solver->proc~init_superlu mpi_finalize mpi_finalize proc~init_solver->mpi_finalize mpi_init mpi_init proc~init_solver->mpi_init proc~umfpack_di_report_control umfpack_di_report_control proc~init_solver->proc~umfpack_di_report_control dmumps dmumps proc~init_solver->dmumps proc~umfpack_di_defaults umfpack_di_defaults proc~init_solver->proc~umfpack_di_defaults ma48_initialize ma48_initialize proc~init_solver->ma48_initialize interface~set_default_options set_default_options proc~init_superlu->interface~set_default_options interface~c_umfpack_di_report_control c_umfpack_di_report_control proc~umfpack_di_report_control->interface~c_umfpack_di_report_control interface~c_umfpack_di_defaults c_umfpack_di_defaults proc~umfpack_di_defaults->interface~c_umfpack_di_defaults

Called by

proc~~init_solver~~CalledByGraph proc~init_solver init_solver proc~solve_syst solve_syst proc~solve_syst->proc~init_solver program~test_solvers test_solvers program~test_solvers->proc~solve_syst

Contents

Source Code


Source Code

   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