PMD_Solve_1DD - Solves the final problem
CALL PMD_Solve_1DD(Comm=comm, LocalSolver, FirstDerivative, Operator=Op, Factor=factor, Source=source, Field=field)
CALL PMD_Solve_1DD(Comm=comm, LocalSolver, FirstDerivative, Operator=Op, Schur=schur, Method=method, Source=source, Field=field)
<IN> comm : PMD handel of type PMD_Comm_1D or PMD_Comm_2D.
<IN> LocalSolver : EXTERNAL routine. A user defined routine to solve the local problem.
The parameters of this routine have to be defined as the following
depending on wether the operator matrix is dense or tridiagonal:
SUBROUTINE LocalSolver( Comm, Dense, Source, Field )
USE PMD
TYPE(PMD_Comm_1[or 2]D), INTENT(IN) :: Comm
REAL(kind=R4[or 8]), INTENT(IN), DIMENSION(:,:) :: Dense
REAL(kind=R4[or 8]), INTENT(IN), DIMENSION(:[,:]) :: Source
REAL(kind=R4[or 8]), INTENT(OUT), DIMENSION(0:[,:]) :: Field
END SUBROUTINE LocalSolver
SUBROUTINE LocalSolver( Comm, Low, Main, Upper, Source, Field )
USE PMD
TYPE(PMD_Comm_1[or 2]D), INTENT(IN) :: Comm
REAL(kind=R4[or 8]), INTENT(IN), DIMENSION(:[,:]) :: Low, Main, Upper
REAL(kind=R4[or 8]), INTENT(IN), DIMENSION(:[,:]) :: Source
REAL(kind=R4[or 8]), INTENT(OUT), DIMENSION(0:[,:]) :: Field
END SUBROUTINE LocalSolver
<IN> FirstDerivative : EXTERNAL routine. User defined routine
to compute the first normal derivative at the subdomain
interfaces. In a 1D Domain decomposition context, two normal
first derivatives have to be computed. One at the WEST
interface and the second at the EAST interface of each
subdomain. This routine has to be defined with the following
parameters:
SUBROUTINE FirstDerivative( Comm, Field, Source, WestFD, EastFD )
USE PMD
TYPE(PMD_Comm_1[or 2]D), INTENT(IN) :: Comm
REAL(kind=R8), INTENT(IN), DIMENSION(0:[,:]) :: Field
REAL(kind=R8), INTENT(IN), DIMENSION(:[,:]) :: Source
REAL(kind=R8), INTENT(OUT)[, DIMENSION(:)] :: WestFD, EastFD
END SUBROUTINE FirstDerivative
<IN> Op : PMD handel of type PMD_R4_Ge_Operator or PMD_R8_Ge_Operator
or of type PMD_R4_Tr_Operator or PMD_R8_Tr_Operator
(see PMD_Operator_1DD).
<IN> schur : Schur handel of type PMD_R4_Schur or PMD_R8_Schur.
<IN> factor : Factorization handel of type one of the following :
PMD_R4_GELU, PMD_R8_GELU, PMD_R4_SYCH, PMD_R8_SYCH
<IN> method : Iterative solver and Precondition handel of type PMD_R4_PCG_Jacobi
or PMD_R8_PCG_Jacobi or PMD_R4_BICG_Jacobi or PMD_R8_BICG_Jacobi.
<IN> source : Rank 1 or 2 array of type REAL(kind=R4 or R8). Source term
of the local linear system.
<OUT> field : Rank 1 or 2 array of type REAL(kind=R4 or R8). Returns the local
final solution.
PROGRAM Myprog
USE PMD
INTEGER, PARAMETER :: Nx=21, Ny=51
TYPE(PMD_Comm_1D) :: Comm
TYPE(PMD_R8_Tr_Operator) :: Op
TYPE(PMD_R8_Schur) :: Schur
TYPE(PMD_R8_PCG_Jacobi) :: PCGJacobi
REAL(kind=R8), DIMENSION(Nx) :: L, D, U, Source
REAL(kind=R8), DIMENSION(0:Nx+1) :: Field
EXTERNAL MyLocalSolver, MyFirstDerivative
...
L(:) = ... ; D(:)=... ; U(:)=...
CALL PMD_Operator_1DD( Comm, L, D, U, Op )
CALL PMD_Schur_1DD( Comm, MyLocalSolver, MyFirstDerivative, Op, Schur )
CALL PMD_Schur_Precond_1DD( Comm, Schur, PCGJacobi )
CALL PMD_Solve_1DD( Comm, MyLocalSolver, MyFirstDerivative, Op, Schur, PCGJacobi, Source, Field )
PRINT *, 'My Solution is: ', Field(:)
...
END PROGRAM Myprog
SUBROUTINE MyLocalSolver( Comm, L, D, U, Source, Field )
USE PMD
TYPE(PMD_Comm_1D), INTENT(IN) :: Comm
REAL(kind=R8), INTENT(IN), DIMENSION(:) :: L, D, U, Source
REAL(kind=R8), INTENT(OUT), DIMENSION(0:) :: Field
...
END SUBROUTINE MyLocalSolver
SUBROUTINE MyFirstDerivative( Comm, Field, Source, WestFD, EastFD )
USE PMD
TYPE(PMD_Comm_1D), INTENT(IN) :: Comm
REAL(kind=R8), INTENT(IN), DIMENSION(0:) :: Field
REAL(kind=R8), INTENT(IN), DIMENSION(:) :: Source
REAL(kind=R8), INTENT(OUT) :: WestFD, EastFD
...
END SUBROUTINE MyFirstDerivative
In case of a 2D problem, WestFD and EastFD parameters must be of rank 1 arrays.