From 13c99a0c3ff0b189acab1b62325dd27c8a1e099f Mon Sep 17 00:00:00 2001 From: sfilippone Date: Mon, 18 Nov 2024 16:20:35 +0100 Subject: [PATCH] Cleanup use of RICHARDSON --- samples/advanced/pdegen/amg_d_pde2d.F90 | 16 +++++++++++----- samples/advanced/pdegen/amg_d_pde3d.F90 | 16 +++++++++++----- samples/advanced/pdegen/amg_s_pde2d.F90 | 16 +++++++++++----- samples/advanced/pdegen/amg_s_pde3d.F90 | 16 +++++++++++----- samples/advanced/pdegen/runs/amg_pde2d.inp | 2 +- samples/advanced/pdegen/runs/amg_pde3d.inp | 2 +- 6 files changed, 46 insertions(+), 22 deletions(-) diff --git a/samples/advanced/pdegen/amg_d_pde2d.F90 b/samples/advanced/pdegen/amg_d_pde2d.F90 index 33b9b7f0..76cb7bd3 100644 --- a/samples/advanced/pdegen/amg_d_pde2d.F90 +++ b/samples/advanced/pdegen/amg_d_pde2d.F90 @@ -105,9 +105,9 @@ program amg_d_pde2d integer(psb_epk_) :: amatsize, precsize, descsize real(psb_dpk_) :: err, resmx, resmxp - ! Krylov solver data + ! Solver data type solverdata - character(len=40) :: kmethd ! Krylov solver + character(len=40) :: kmethd ! Iterative solver integer(psb_ipk_) :: istopc ! stopping criterion integer(psb_ipk_) :: itmax ! maximum number of iterations integer(psb_ipk_) :: itrace ! tracing @@ -472,16 +472,22 @@ program amg_d_pde2d ! call psb_barrier(ctxt) t1 = psb_wtime() - if (psb_toupper(trim(s_choice%kmethd)) == 'RICHARDSON') then + select case(psb_toupper(trim(s_choice%kmethd))) + case('RICHARDSON') call psb_richardson(a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,& & err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc) - else + case('BICGSTAB','BICGSTABL','BICG','CG','CGS','FCG','GCR','RGMRES') call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc,irst=s_choice%irst) - end if + case default + write(psb_err_unit,*) 'Unknown method :"',trim(s_choice%kmethd),'"' + info=psb_err_invalid_input_ + call psb_errpush(info,name) + goto 9999 + end select call psb_barrier(ctxt) tslv = psb_wtime() - t1 diff --git a/samples/advanced/pdegen/amg_d_pde3d.F90 b/samples/advanced/pdegen/amg_d_pde3d.F90 index 1b064b24..90d80fa8 100644 --- a/samples/advanced/pdegen/amg_d_pde3d.F90 +++ b/samples/advanced/pdegen/amg_d_pde3d.F90 @@ -106,9 +106,9 @@ program amg_d_pde3d integer(psb_epk_) :: amatsize, precsize, descsize real(psb_dpk_) :: err, resmx, resmxp - ! Krylov solver data + ! Solver data type solverdata - character(len=40) :: kmethd ! Krylov solver + character(len=40) :: kmethd ! Iterative solver integer(psb_ipk_) :: istopc ! stopping criterion integer(psb_ipk_) :: itmax ! maximum number of iterations integer(psb_ipk_) :: itrace ! tracing @@ -476,16 +476,22 @@ program amg_d_pde3d ! call psb_barrier(ctxt) t1 = psb_wtime() - if (psb_toupper(trim(s_choice%kmethd)) == 'RICHARDSON') then + select case(psb_toupper(trim(s_choice%kmethd))) + case('RICHARDSON') call psb_richardson(a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,& & err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc) - else + case('BICGSTAB','BICGSTABL','BICG','CG','CGS','FCG','GCR','RGMRES') call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc,irst=s_choice%irst) - end if + case default + write(psb_err_unit,*) 'Unknown method :"',trim(s_choice%kmethd),'"' + info=psb_err_invalid_input_ + call psb_errpush(info,name) + goto 9999 + end select call psb_barrier(ctxt) tslv = psb_wtime() - t1 diff --git a/samples/advanced/pdegen/amg_s_pde2d.F90 b/samples/advanced/pdegen/amg_s_pde2d.F90 index 53ff650d..cce067a7 100644 --- a/samples/advanced/pdegen/amg_s_pde2d.F90 +++ b/samples/advanced/pdegen/amg_s_pde2d.F90 @@ -105,9 +105,9 @@ program amg_s_pde2d integer(psb_epk_) :: amatsize, precsize, descsize real(psb_spk_) :: err, resmx, resmxp - ! Krylov solver data + ! Solver data type solverdata - character(len=40) :: kmethd ! Krylov solver + character(len=40) :: kmethd ! Iterative solver integer(psb_ipk_) :: istopc ! stopping criterion integer(psb_ipk_) :: itmax ! maximum number of iterations integer(psb_ipk_) :: itrace ! tracing @@ -472,16 +472,22 @@ program amg_s_pde2d ! call psb_barrier(ctxt) t1 = psb_wtime() - if (psb_toupper(trim(s_choice%kmethd)) == 'RICHARDSON') then + select case(psb_toupper(trim(s_choice%kmethd))) + case('RICHARDSON') call psb_richardson(a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,& & err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc) - else + case('BICGSTAB','BICGSTABL','BICG','CG','CGS','FCG','GCR','RGMRES') call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc,irst=s_choice%irst) - end if + case default + write(psb_err_unit,*) 'Unknown method :"',trim(s_choice%kmethd),'"' + info=psb_err_invalid_input_ + call psb_errpush(info,name) + goto 9999 + end select call psb_barrier(ctxt) tslv = psb_wtime() - t1 diff --git a/samples/advanced/pdegen/amg_s_pde3d.F90 b/samples/advanced/pdegen/amg_s_pde3d.F90 index 91df58a3..a92f9605 100644 --- a/samples/advanced/pdegen/amg_s_pde3d.F90 +++ b/samples/advanced/pdegen/amg_s_pde3d.F90 @@ -106,9 +106,9 @@ program amg_s_pde3d integer(psb_epk_) :: amatsize, precsize, descsize real(psb_spk_) :: err, resmx, resmxp - ! Krylov solver data + ! Solver data type solverdata - character(len=40) :: kmethd ! Krylov solver + character(len=40) :: kmethd ! Iterative solver integer(psb_ipk_) :: istopc ! stopping criterion integer(psb_ipk_) :: itmax ! maximum number of iterations integer(psb_ipk_) :: itrace ! tracing @@ -476,16 +476,22 @@ program amg_s_pde3d ! call psb_barrier(ctxt) t1 = psb_wtime() - if (psb_toupper(trim(s_choice%kmethd)) == 'RICHARDSON') then + select case(psb_toupper(trim(s_choice%kmethd))) + case('RICHARDSON') call psb_richardson(a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,& & err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc) - else + case('BICGSTAB','BICGSTABL','BICG','CG','CGS','FCG','GCR','RGMRES') call psb_krylov(s_choice%kmethd,a,prec,b,x,s_choice%eps,& & desc_a,info,itmax=s_choice%itmax,iter=iter,err=err,itrace=s_choice%itrace,& & istop=s_choice%istopc,irst=s_choice%irst) - end if + case default + write(psb_err_unit,*) 'Unknown method :"',trim(s_choice%kmethd),'"' + info=psb_err_invalid_input_ + call psb_errpush(info,name) + goto 9999 + end select call psb_barrier(ctxt) tslv = psb_wtime() - t1 diff --git a/samples/advanced/pdegen/runs/amg_pde2d.inp b/samples/advanced/pdegen/runs/amg_pde2d.inp index f2586a2e..29034114 100644 --- a/samples/advanced/pdegen/runs/amg_pde2d.inp +++ b/samples/advanced/pdegen/runs/amg_pde2d.inp @@ -4,7 +4,7 @@ CSR ! Storage format CSR COO JAD POISSON ! PDECOEFF: POISSON, EXP, BOX, GAUSS % ! Coefficients of the PDE CG ! Iterative method: -% ! BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES +% ! BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES RICHARDSON 2 ! ISTOPC 00500 ! ITMAX 1 ! ITRACE diff --git a/samples/advanced/pdegen/runs/amg_pde3d.inp b/samples/advanced/pdegen/runs/amg_pde3d.inp index 13227273..1abec25f 100644 --- a/samples/advanced/pdegen/runs/amg_pde3d.inp +++ b/samples/advanced/pdegen/runs/amg_pde3d.inp @@ -4,7 +4,7 @@ CSR ! Storage format CSR COO JAD POISSON ! PDECOEFF: POISSON, EXP, BOX, GAUSS % ! Coefficients of the PDE CG ! Iterative method: -% ! BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES +% ! BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES RICHARDSON 2 ! ISTOPC 00500 ! ITMAX 1 ! ITRACE