3D solver

PARALLAX provides a framework for a generic iterative solver designed for 3D problems, including those that involve MPI communication. The solver is based on the GMRES algorithm from the PIM or CERFACS library (see Advanced compilation options). The algorithm is matrix-free, meaning that instead of explicitly passing the matrix, you provide the matrix-vector product via a subroutine. While not explicitly shown in the example below, preconditioners can also be supplied as subroutines to optimize solver performance.

The 3D solver can be used in the following way:

! Dimension of partitioned matrix on specific MPI process is ndim_loc
integer :: ndim_loc

! Solver object
class(solver3d_t), allocatable :: solver3d
! Right-hand side of the problem
real(FP), dimension(ndim_loc) :: rhs
! Solution vector
real(FP), dimension(ndim_loc) :: sol

! Create solver based on PIM
call solver3d_factory('PIM', solver3d)

! Initialize the solver with the required parameters
call solver3d%create(MPI_COMM_WORLD, 'RGMRES', &
                     ndim_loc, resmax, matvec)

! Solve the system
call solver3d%solve(MPI_COMM_WORLD, rhs, sol, res, info)

...

contains !(or use from a separate module)

    subroutine matvec(u, v, ipar)
        !! Implementation of the matrix-vector operation v = A*u to be inverted
        real(FP), dimension(*) :: u
        real(FP), dimension(*) :: v
        integer :: ipar(*)

        ...

    end subroutine