stopcriterion
			
			
		
Salvatore Filippone 17 years ago
parent 95a614b900
commit 96fd0f69d5

@ -471,6 +471,8 @@ contains
val = mld_repl_mat_ val = mld_repl_mat_
case('DIST') case('DIST')
val = mld_distr_mat_ val = mld_distr_mat_
case('RAW')
val = mld_no_smooth_
case('SMOOTH') case('SMOOTH')
val = mld_smooth_prol_ val = mld_smooth_prol_
case('PRE') case('PRE')

@ -471,6 +471,8 @@ contains
val = mld_repl_mat_ val = mld_repl_mat_
case('DIST') case('DIST')
val = mld_distr_mat_ val = mld_distr_mat_
case('RAW')
val = mld_no_smooth_
case('SMOOTH') case('SMOOTH')
val = mld_smooth_prol_ val = mld_smooth_prol_
case('PRE') case('PRE')

@ -77,11 +77,57 @@
! !
! u(x,y) = rhs(x,y) ! u(x,y) = rhs(x,y)
! !
module data_input
interface read_data
module procedure read_char, read_int, read_double
end interface read_data
contains
subroutine read_char(val,file)
character(len=*), intent(out) :: val
integer, intent(in) :: file
character(len=1024) :: charbuf
integer :: idx
read(file,'(a)')charbuf
charbuf = adjustl(charbuf)
idx=index(charbuf,"!")
read(charbuf(1:idx-1),'(a)') val
!!$ write(0,*) 'read_char got value: "',val,'"'
end subroutine read_char
subroutine read_int(val,file)
integer, intent(out) :: val
integer, intent(in) :: file
character(len=1024) :: charbuf
integer :: idx
read(file,'(a)')charbuf
charbuf = adjustl(charbuf)
idx=index(charbuf,"!")
read(charbuf(1:idx-1),*) val
!!$ write(0,*) 'read_int got value: ',val
end subroutine read_int
subroutine read_double(val,file)
use psb_base_mod
real(psb_dpk_), intent(out) :: val
integer, intent(in) :: file
character(len=1024) :: charbuf
integer :: idx
read(file,'(a)')charbuf
charbuf = adjustl(charbuf)
idx=index(charbuf,"!")
read(charbuf(1:idx-1),*) val
!!$ write(0,*) 'read_double got value: ',val
end subroutine read_double
end module data_input
program ppde program ppde
use psb_base_mod use psb_base_mod
use mld_prec_mod use mld_prec_mod
use psb_krylov_mod use psb_krylov_mod
use psb_util_mod use psb_util_mod
use data_input
implicit none implicit none
! input parameters ! input parameters
@ -104,30 +150,29 @@ program ppde
integer :: ictxt, iam, np integer :: ictxt, iam, np
! solver parameters ! solver parameters
integer :: iter, itmax,itrace, istopc, irst integer :: iter, itmax,itrace, istopc, irst, nlv
real(psb_dpk_) :: err, eps real(psb_dpk_) :: err, eps
type precdata type precdata
character(len=10) :: lv1, lvn ! First level(s) and last level prec type character(len=20) :: descr ! verbose description of the prec
integer :: nlev ! character(len=10) :: prec ! overall prectype
integer :: novr ! number of overlapping levels integer :: novr ! number of overlap layers
integer :: restr ! restriction over application of as character(len=16) :: restr ! restriction over application of as
integer :: prol ! prolongation over application of as character(len=16) :: prol ! prolongation over application of as
integer :: ftype1 ! Factorization type: ILU, SuperLU, UMFPACK. character(len=16) :: solve ! Factorization type: ILU, SuperLU, UMFPACK.
integer :: fill1 ! Fill-in for factorization 1 integer :: fill1 ! Fill-in for factorization 1
real(psb_dpk_) :: thr1 ! Threshold for fact. 1 ILU(T) real(psb_dpk_) :: thr1 ! Threshold for fact. 1 ILU(T)
integer :: mltype ! additive or multiplicative 2nd level prec integer :: nlev ! Number of levels in multilevel prec.
integer :: aggr ! local or global aggregation character(len=16) :: aggrkind ! smoothed/raw aggregatin
integer :: smthkind ! smoothing type character(len=16) :: aggr_alg ! local or global aggregation
integer :: cmat ! coarse mat character(len=16) :: mltype ! additive or multiplicative 2nd level prec
integer :: smthpos ! pre, post, both smoothing character(len=16) :: smthpos ! side: pre, post, both smoothing
integer :: glbsmth ! global smoothing character(len=16) :: cmat ! coarse mat
integer :: ftype2 ! Factorization type: ILU, SuperLU, UMFPACK. character(len=16) :: csolve ! Factorization type: ILU, SuperLU, UMFPACK.
integer :: fill2 ! Fill-in for factorization 1 integer :: cfill ! Fill-in for factorization 1
real(psb_dpk_) :: thr2 ! Threshold for fact. 1 ILU(T) real(psb_dpk_) :: cthres ! Threshold for fact. 1 ILU(T)
integer :: jswp ! Jacobi sweeps integer :: cjswp ! Jacobi sweeps
real(psb_dpk_) :: omega ! smoother omega real(psb_dpk_) :: omega ! smoother omega
character(len=20) :: descr ! verbose description of the prec
end type precdata end type precdata
type(precdata) :: prectype type(precdata) :: prectype
! other variables ! other variables
@ -176,29 +221,34 @@ program ppde
! prepare the preconditioner. ! prepare the preconditioner.
! !
if (prectype%nlev > 1) then if (toupper(prectype%prec) =='ML') then
call mld_precinit(prec,prectype%lvn,info,nlev=prectype%nlev) nlv = prectype%nlev
else
nlv = 1
end if
call mld_precinit(prec,prectype%prec,info,nlev=nlv)
call mld_precset(prec,mld_n_ovr_,prectype%novr,info)
call mld_precset(prec,mld_sub_restr_,prectype%restr,info)
call mld_precset(prec,mld_sub_prol_,prectype%prol,info)
call mld_precset(prec,mld_sub_solve_,prectype%solve,info)
call mld_precset(prec,mld_sub_fill_in_,prectype%fill1,info)
call mld_precset(prec,mld_fact_thrs_,prectype%thr1,info)
if (toupper(prectype%prec) =='ML') then
call mld_precset(prec,mld_aggr_kind_,prectype%aggrkind,info)
call mld_precset(prec,mld_aggr_alg_,prectype%aggr_alg,info)
call mld_precset(prec,mld_ml_type_,prectype%mltype,info)
call mld_precset(prec,mld_ml_type_,prectype%mltype,info)
call mld_precset(prec,mld_smooth_pos_,prectype%smthpos,info)
call mld_precset(prec,mld_coarse_mat_,prectype%cmat,info)
call mld_precset(prec,mld_coarse_solve_,prectype%csolve,info)
call mld_precset(prec,mld_sub_fill_in_,prectype%cfill,info,ilev=nlv)
call mld_precset(prec,mld_fact_thrs_,prectype%cthres,info,ilev=nlv)
call mld_precset(prec,mld_smooth_sweeps_,prectype%cjswp,info,ilev=nlv)
call mld_precset(prec,mld_smooth_sweeps_,prectype%cjswp,info,ilev=nlv)
if (prectype%omega>=0.0) then if (prectype%omega>=0.0) then
call mld_precset(prec,mld_aggr_damp_,prectype%omega,info,ilev=prectype%nlev) call mld_precset(prec,mld_aggr_damp_,prectype%omega,info,ilev=nlv)
end if end if
call mld_precset(prec,mld_ml_type_, prectype%mltype, info,ilev=prectype%nlev) end if
call mld_precset(prec,mld_aggr_alg_, prectype%aggr, info,ilev=prectype%nlev)
call mld_precset(prec,mld_coarse_mat_, prectype%cmat, info,ilev=prectype%nlev)
call mld_precset(prec,mld_smooth_pos_, prectype%smthpos, info,ilev=prectype%nlev)
call mld_precset(prec,mld_sub_solve_, prectype%ftype2, info,ilev=prectype%nlev)
call mld_precset(prec,mld_sub_fill_in_, prectype%fill2, info,ilev=prectype%nlev)
call mld_precset(prec,mld_fact_thrs_, prectype%thr2, info,ilev=prectype%nlev)
call mld_precset(prec,mld_smooth_sweeps_, prectype%jswp, info,ilev=prectype%nlev)
call mld_precset(prec,mld_aggr_kind_, prectype%smthkind, info,ilev=prectype%nlev)
else
call mld_precinit(prec,prectype%lv1,info)
endif
call mld_precset(prec,mld_n_ovr_, prectype%novr, info,ilev=1)
call mld_precset(prec,mld_sub_restr_, prectype%restr, info,ilev=1)
call mld_precset(prec,mld_sub_prol_, prectype%prol, info,ilev=1)
call mld_precset(prec,mld_sub_solve_, prectype%ftype1, info,ilev=1)
call mld_precset(prec,mld_sub_fill_in_, prectype%fill1, info,ilev=1)
call mld_precset(prec,mld_fact_thrs_, prectype%thr1, info,ilev=1)
call psb_barrier(ictxt) call psb_barrier(ictxt)
@ -286,43 +336,34 @@ contains
call psb_info(ictxt, iam, np) call psb_info(ictxt, iam, np)
if (iam==psb_root_) then if (iam==psb_root_) then
read(*,*) kmethd call read_data(kmethd,5)
read(*,*) afmt call read_data(afmt,5)
read(*,*) idim call read_data(idim,5)
read(*,*) istopc call read_data(istopc,5)
read(*,*) itmax call read_data(itmax,5)
read(*,*) itrace call read_data(itrace,5)
read(*,*) irst call read_data(irst,5)
read(*,*) prectype%descr call read_data(eps,5)
read(*,*) prectype%nlev call read_data(prectype%descr,5) ! verbose description of the prec
read(*,*) prectype%lv1 call read_data(prectype%prec,5) ! overall prectype
read(*,*) buffer call read_data(prectype%novr,5) ! number of overlap layers
call get_stringval(buffer,prectype%ftype1,info) call read_data(prectype%restr,5) ! restriction over application of as
read(*,*) prectype%fill1 call read_data(prectype%prol,5) ! prolongation over application of as
read(*,*) prectype%thr1 call read_data(prectype%solve,5) ! Factorization type: ILU, SuperLU, UMFPACK.
read(*,*) prectype%novr call read_data(prectype%fill1,5) ! Fill-in for factorization 1
read(*,*) buffer call read_data(prectype%thr1,5) ! Threshold for fact. 1 ILU(T)
call get_stringval(buffer,prectype%restr,info) if (toupper(prectype%prec) == 'ML') then
read(*,*) buffer call read_data(prectype%nlev,5) ! Number of levels in multilevel prec.
call get_stringval(buffer,prectype%prol,info) call read_data(prectype%aggrkind,5) ! smoothed/raw aggregatin
if (prectype%nlev>1) then call read_data(prectype%aggr_alg,5) ! local or global aggregation
read(*,*) prectype%lvn call read_data(prectype%mltype,5) ! additive or multiplicative 2nd level prec
read(*,*) buffer call read_data(prectype%smthpos,5) ! side: pre, post, both smoothing
call get_stringval(buffer,prectype%mltype,info) call read_data(prectype%cmat,5) ! coarse mat
read(*,*) buffer call read_data(prectype%csolve,5) ! Factorization type: ILU, SuperLU, UMFPACK.
call get_stringval(buffer,prectype%aggr,info) call read_data(prectype%cfill,5) ! Fill-in for factorization 1
read(*,*) buffer call read_data(prectype%cthres,5) ! Threshold for fact. 1 ILU(T)
call get_stringval(buffer,prectype%smthkind,info) call read_data(prectype%cjswp,5) ! Jacobi sweeps
read(*,*) buffer call read_data(prectype%omega,5) ! smoother omega
call get_stringval(buffer,prectype%cmat,info)
read(*,*) buffer
call get_stringval(buffer,prectype%smthpos,info)
read(*,*) buffer
call get_stringval(buffer,prectype%ftype2,info)
read(*,*) prectype%fill2
read(*,*) prectype%thr2
read(*,*) prectype%jswp
read(*,*) prectype%omega
end if end if
end if end if
@ -334,27 +375,28 @@ contains
call psb_bcast(ictxt,itmax) call psb_bcast(ictxt,itmax)
call psb_bcast(ictxt,itrace) call psb_bcast(ictxt,itrace)
call psb_bcast(ictxt,irst) call psb_bcast(ictxt,irst)
call psb_bcast(ictxt,prectype%descr)
call psb_bcast(ictxt,prectype%nlev)
call psb_bcast(ictxt,prectype%lv1) call psb_bcast(ictxt,prectype%descr) ! verbose description of the prec
call psb_bcast(ictxt,prectype%ftype1) call psb_bcast(ictxt,prectype%prec) ! overall prectype
call psb_bcast(ictxt,prectype%fill1) call psb_bcast(ictxt,prectype%novr) ! number of overlap layers
call psb_bcast(ictxt,prectype%thr1) call psb_bcast(ictxt,prectype%restr) ! restriction over application of as
call psb_bcast(ictxt,prectype%novr) call psb_bcast(ictxt,prectype%prol) ! prolongation over application of as
call psb_bcast(ictxt,prectype%restr) call psb_bcast(ictxt,prectype%solve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(ictxt,prectype%prol) call psb_bcast(ictxt,prectype%fill1) ! Fill-in for factorization 1
if (prectype%nlev>1) then call psb_bcast(ictxt,prectype%thr1) ! Threshold for fact. 1 ILU(T)
call psb_bcast(ictxt,prectype%lvn ) if (toupper(prectype%prec) == 'ML') then
call psb_bcast(ictxt,prectype%mltype ) call psb_bcast(ictxt,prectype%nlev) ! Number of levels in multilevel prec.
call psb_bcast(ictxt,prectype%aggr ) call psb_bcast(ictxt,prectype%aggrkind) ! smoothed/raw aggregatin
call psb_bcast(ictxt,prectype%smthkind ) call psb_bcast(ictxt,prectype%aggr_alg) ! local or global aggregation
call psb_bcast(ictxt,prectype%cmat ) call psb_bcast(ictxt,prectype%mltype) ! additive or multiplicative 2nd level prec
call psb_bcast(ictxt,prectype%smthpos ) call psb_bcast(ictxt,prectype%smthpos) ! side: pre, post, both smoothing
call psb_bcast(ictxt,prectype%ftype2 ) call psb_bcast(ictxt,prectype%cmat) ! coarse mat
call psb_bcast(ictxt,prectype%fill2 ) call psb_bcast(ictxt,prectype%csolve) ! Factorization type: ILU, SuperLU, UMFPACK.
call psb_bcast(ictxt,prectype%thr2 ) call psb_bcast(ictxt,prectype%cfill) ! Fill-in for factorization 1
call psb_bcast(ictxt,prectype%jswp ) call psb_bcast(ictxt,prectype%cthres) ! Threshold for fact. 1 ILU(T)
call psb_bcast(ictxt,prectype%omega ) call psb_bcast(ictxt,prectype%cjswp) ! Jacobi sweeps
call psb_bcast(ictxt,prectype%omega) ! smoother omega
end if end if
if (iam==psb_root_) then if (iam==psb_root_) then
@ -371,61 +413,6 @@ contains
end subroutine get_parms end subroutine get_parms
subroutine get_stringval(string,val,info)
character(len=*), intent(in) :: string
integer, intent(out) :: val, info
info = 0
select case(toupper(trim(string)))
case('NONE')
val = 0
case('HALO')
val = psb_halo_
case('SUM')
val = psb_sum_
case('AVG')
val = psb_avg_
case('ILU')
val = mld_ilu_n_
case('MILU')
val = mld_milu_n_
case('ILUT')
val = mld_ilu_t_
case('SLU')
val = mld_slu_
case('UMFP')
val = mld_umf_
case('ADD')
val = mld_add_ml_
case('MULT')
val = mld_mult_ml_
case('DEC')
val = mld_dec_aggr_
case('REPL')
val = mld_repl_mat_
case('DIST')
val = mld_distr_mat_
case('SYMDEC')
val = mld_sym_dec_aggr_
case('GLB')
val = mld_glb_aggr_
case('SMOOTH')
val = mld_smooth_prol_
case('PRE')
val = mld_pre_smooth_
case('POST')
val = mld_post_smooth_
case('TWOSIDE','BOTH')
val = mld_twoside_smooth_
case default
val = -1
info = -1
end select
if (info /= 0) then
write(0,*) 'Error in get_Stringval: unknown: "',trim(string),'"'
end if
end subroutine get_stringval
! !
! print an error message ! print an error message
! !

@ -1,28 +1,28 @@
BICGSTAB | Iterative method BICGSTAB CGS BICG BICGSTABL RGMRES BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
CSR | Storage format for matrix A CSR COO JAD CSR ! Storage format CSR COO JAD
60 | Domain size (acutal system is this**3) 80 ! IDIM; domain size is idim**3
1 | Stopping criterion 2 ! ISTOPC
80 | MAXIT 01000 ! ITMAX
01 | ITRACE -1 ! ITRACE
20 | IRST restart for RGMRES and BiCGSTABL 30 ! IRST (restart for RGMRES and BiCGSTABL)
3L-M-RAS-U-D4 | Preconditioner description NONE DIAG BJAC 2L-M-RAS-ID4 1.d-6 ! EPS
3 | N levels 3L-M-RAS-I-D4 ! Longer descriptive name for preconditioner (up to 20 chars)
AS | Preconditioner for base level(s): NONE DIAG BJAC AS ML ! Preconditioner NONE DIAG BJAC AS ML
ILU | Fact. for base: ILU MILU ILUT SLU UMFP 0 ! Number of overlap layers for AS preconditioner at finest level
0 | Fill level for ILU(K) and ILU(T,P) HALO ! Restriction operator NONE HALO
1.d-8 | Threshold for ILU(T,P), ignored otherwise NONE ! Prolongation operator NONE SUM AVG
1 | Number of overlap layers ILU ! Subdomain solver ILU MILU ILUT UMF SLU
HALO | Restriction: NONE HALO 1 ! Level-set N for ILU(N)
NONE | Prolongator: NONE SUM AVG 1.d-4 ! Threshold T for ILU(T,P)
ML | Preconditioner for upper levels must be ML ignored if nlev<2 3 ! Number of levels in a multilevel preconditioner
MULT | Type of multilevel NONE ADD MULT (none is self contradictory!!) SMOOTH ! Kind of aggregation: RAW, SMOOTH
DEC | Aggregation algorithm: DEC SYMDEC GLB DEC ! Type of aggregation DEC SYMDEC GLB
SMOOTH | Prolongator: NONE SMOOTH MULT ! Type of multilevel correction: ADD MULT
REPL | coarse matrix: DIST REPL POST ! Side of multiplicative correction PRE POST BOTH (ignored for ADD)
POST | Smoother position: PRE POST TWOSIDE DIST ! Coarse level: matrix distribution DIST REPL
UMFP | Fact. for upper: ILU MILU ILUT SLU UMFP UMF ! Coarse level: solver ILU ILUT UMF SLU SLUDIST
0 | Fill level for ILU(K) and ILU(T,P) 0 ! Coarse level: Level-set N for ILU(N)
1.e-8 | Threshold for ILU(T,P), ignored otherwise 1.d-4 ! Coarse level: Threshold T for ILU(T,P)
4 | Number of Jacoby sweeps 4 ! Coarse level: Number of Jacobi sweeps
-1.0 | Smoother omega if >=0.0, if <0.0 library default -1.0d0 ! Smoother Omega: if < 0 means library choice.

Loading…
Cancel
Save