|
|
|
@ -37,14 +37,17 @@
|
|
|
|
|
! File: mld_dprecset.f90
|
|
|
|
|
!
|
|
|
|
|
! Subroutine: mld_dprecseti
|
|
|
|
|
! Version: real
|
|
|
|
|
!
|
|
|
|
|
! These routines set the parameters defining the preconditioner. More precisely,
|
|
|
|
|
! the parameter identified by 'what' is assigned the value contained in 'val'.
|
|
|
|
|
! mld_dprecsetc works on string parameters, mld_dprecseti works on integer
|
|
|
|
|
! parameters, while mld_dprecsetd works on real ones.
|
|
|
|
|
! This routine sets the integer parameters defining the preconditioner. More
|
|
|
|
|
! precisely, the integer parameter identified by 'what' is assigned the value
|
|
|
|
|
! contained in 'val'.
|
|
|
|
|
! For the multilevel preconditioners, the levels are numbered in increasing
|
|
|
|
|
! order starting from the finest one, i.e. level 1 is the finest level.
|
|
|
|
|
!
|
|
|
|
|
! To set character and real parameters, see mld_dprecsetc and mld_dprecsetd,
|
|
|
|
|
! respectively.
|
|
|
|
|
!
|
|
|
|
|
!
|
|
|
|
|
! Arguments:
|
|
|
|
|
! p - type(mld_dprec_type), input/output.
|
|
|
|
@ -62,10 +65,7 @@
|
|
|
|
|
! For the multilevel preconditioner, the level at which the
|
|
|
|
|
! preconditioner parameter has to be set.
|
|
|
|
|
! If nlev is not present, the parameter identified by 'what'
|
|
|
|
|
! is set at all the levels but the coarsest one, except when
|
|
|
|
|
! 'what' has the values mld_coarse_mat_, mld_coarse_solve_,
|
|
|
|
|
! mld_coarse_sweeps_, mld_coarse_fill_in_, which refer to the
|
|
|
|
|
! coarsest level.
|
|
|
|
|
! is set at all the appropriate levels.
|
|
|
|
|
!
|
|
|
|
|
subroutine mld_dprecseti(p,what,val,info,ilev)
|
|
|
|
|
|
|
|
|
@ -127,9 +127,16 @@ subroutine mld_dprecseti(p,what,val,info,ilev)
|
|
|
|
|
else if (ilev_ > 1) then
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_prec_type_,mld_sub_solve_,mld_sub_restr_,mld_sub_prol_,mld_sub_ren_,mld_n_ovr_,mld_sub_fill_in_,&
|
|
|
|
|
& mld_smooth_sweeps_,mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,mld_coarse_mat_,&
|
|
|
|
|
& mld_smooth_sweeps_,mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,&
|
|
|
|
|
& mld_smooth_pos_,mld_aggr_eig_)
|
|
|
|
|
p%baseprecv(ilev_)%iprcparm(what) = val
|
|
|
|
|
case(mld_coarse_mat_)
|
|
|
|
|
if (ilev_ /= nlev_ .and. val /= mld_distr_mat_) then
|
|
|
|
|
write(0,*) 'Inconsistent specification of WHAT vs. ILEV'
|
|
|
|
|
info = -2
|
|
|
|
|
return
|
|
|
|
|
end if
|
|
|
|
|
p%baseprecv(ilev_)%iprcparm(mld_coarse_mat_) = val
|
|
|
|
|
case(mld_coarse_solve_)
|
|
|
|
|
if (ilev_ /= nlev_) then
|
|
|
|
|
write(0,*) 'Inconsistent specification of WHAT vs. ILEV'
|
|
|
|
@ -160,14 +167,13 @@ subroutine mld_dprecseti(p,what,val,info,ilev)
|
|
|
|
|
|
|
|
|
|
else if (.not.present(ilev)) then
|
|
|
|
|
!
|
|
|
|
|
! ilev not specified: set preconditioner parameters at levels 1,...,nlev_-1,
|
|
|
|
|
! except when 'what' has the values mld_coarse_solve_, mld_coarse_sweeps_,
|
|
|
|
|
! mld_coarse_fill_in_, which refer to the coarsest level
|
|
|
|
|
! ilev not specified: set preconditioner parameters at all the appropriate
|
|
|
|
|
! levels
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_prec_type_,mld_sub_solve_,mld_sub_restr_,mld_sub_prol_,mld_sub_ren_,mld_n_ovr_,mld_sub_fill_in_,&
|
|
|
|
|
& mld_smooth_sweeps_,mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,mld_coarse_mat_,&
|
|
|
|
|
& mld_smooth_sweeps_,mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,&
|
|
|
|
|
& mld_smooth_pos_,mld_aggr_eig_)
|
|
|
|
|
do ilev_=1,nlev_-1
|
|
|
|
|
if (.not.allocated(p%baseprecv(ilev_)%iprcparm)) then
|
|
|
|
@ -177,6 +183,13 @@ subroutine mld_dprecseti(p,what,val,info,ilev)
|
|
|
|
|
endif
|
|
|
|
|
p%baseprecv(ilev_)%iprcparm(what) = val
|
|
|
|
|
end do
|
|
|
|
|
case(mld_coarse_mat_)
|
|
|
|
|
if (.not.allocated(p%baseprecv(nlev_)%iprcparm)) then
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET on an uninitialized preconditioner'
|
|
|
|
|
info = -1
|
|
|
|
|
return
|
|
|
|
|
endif
|
|
|
|
|
p%baseprecv(nlev_)%iprcparm(mld_coarse_mat_) = val
|
|
|
|
|
case(mld_coarse_solve_)
|
|
|
|
|
if (.not.allocated(p%baseprecv(nlev_)%iprcparm)) then
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET on an uninitialized preconditioner'
|
|
|
|
@ -209,6 +222,17 @@ end subroutine mld_dprecseti
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Subroutine: mld_dprecsetc
|
|
|
|
|
! Version: real
|
|
|
|
|
! Contains: get_stringval
|
|
|
|
|
!
|
|
|
|
|
! This routine sets the character parameters defining the preconditioner. More
|
|
|
|
|
! precisely, the character parameter identified by 'what' is assigned the value
|
|
|
|
|
! contained in 'val'.
|
|
|
|
|
! For the multilevel preconditioners, the levels are numbered in increasing
|
|
|
|
|
! order starting from the finest one, i.e. level 1 is the finest level.
|
|
|
|
|
!
|
|
|
|
|
! To set integer and real parameters, see mld_dprecseti and mld_dprecsetd,
|
|
|
|
|
! respectively.
|
|
|
|
|
!
|
|
|
|
|
!
|
|
|
|
|
! Arguments:
|
|
|
|
@ -218,7 +242,7 @@ end subroutine mld_dprecseti
|
|
|
|
|
! The number identifying the parameter to be set.
|
|
|
|
|
! A mnemonic constant has been associated to each of these
|
|
|
|
|
! numbers, as reported in MLD2P4 user's guide.
|
|
|
|
|
! val - string(len=*) input.
|
|
|
|
|
! string - character(len=*), input.
|
|
|
|
|
! The value of the parameter to be set. The list of allowed
|
|
|
|
|
! values is reported in MLD2P4 user's guide.
|
|
|
|
|
! info - integer, output.
|
|
|
|
@ -227,10 +251,7 @@ end subroutine mld_dprecseti
|
|
|
|
|
! For the multilevel preconditioner, the level at which the
|
|
|
|
|
! preconditioner parameter has to be set.
|
|
|
|
|
! If nlev is not present, the parameter identified by 'what'
|
|
|
|
|
! is set at all the levels but the coarsest one, except when
|
|
|
|
|
! 'what' has the values mld_coarse_mat_, mld_coarse_solve_,
|
|
|
|
|
! mld_coarse_sweeps_, mld_coarse_fill_in_, which refer to the
|
|
|
|
|
! coarsest level.
|
|
|
|
|
! is set at all the appropriate levels.
|
|
|
|
|
!
|
|
|
|
|
subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
|
|
|
|
@ -238,11 +259,15 @@ subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
use mld_prec_mod, mld_protect_name => mld_dprecsetc
|
|
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
! Arguments
|
|
|
|
|
type(mld_dprec_type), intent(inout) :: p
|
|
|
|
|
integer, intent(in) :: what
|
|
|
|
|
character(len=*), intent(in) :: string
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
integer, optional, intent(in) :: ilev
|
|
|
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
integer :: ilev_, nlev_,val
|
|
|
|
|
|
|
|
|
|
info = 0
|
|
|
|
@ -269,11 +294,15 @@ subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
return
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Set preconditioner parameters at level ilev.
|
|
|
|
|
!
|
|
|
|
|
if (present(ilev)) then
|
|
|
|
|
|
|
|
|
|
if (ilev_ == 1) then
|
|
|
|
|
!
|
|
|
|
|
! Rules for fine level are slightly different.
|
|
|
|
|
!
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_prec_type_,mld_sub_solve_,mld_sub_restr_,mld_sub_prol_)
|
|
|
|
|
call get_stringval(string,val,info)
|
|
|
|
@ -282,13 +311,22 @@ subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET with an invalid WHAT'
|
|
|
|
|
info = -2
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
else if (ilev_ > 1) then
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_prec_type_,mld_sub_solve_,mld_sub_restr_,mld_sub_prol_,&
|
|
|
|
|
& mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,mld_coarse_mat_,&
|
|
|
|
|
& mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,&
|
|
|
|
|
& mld_smooth_pos_,mld_aggr_eig_)
|
|
|
|
|
call get_stringval(string,val,info)
|
|
|
|
|
p%baseprecv(ilev_)%iprcparm(what) = val
|
|
|
|
|
case(mld_coarse_mat_)
|
|
|
|
|
call get_stringval(string,val,info)
|
|
|
|
|
if (ilev_ /= nlev_ .and. val /= mld_distr_mat_) then
|
|
|
|
|
write(0,*) 'Inconsistent specification of WHAT vs. ILEV'
|
|
|
|
|
info = -2
|
|
|
|
|
return
|
|
|
|
|
end if
|
|
|
|
|
p%baseprecv(ilev_)%iprcparm(mld_coarse_mat_) = val
|
|
|
|
|
case(mld_coarse_solve_)
|
|
|
|
|
call get_stringval(string,val,info)
|
|
|
|
|
if (ilev_ /= nlev_) then
|
|
|
|
@ -304,10 +342,14 @@ subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
else if (.not.present(ilev)) then
|
|
|
|
|
!
|
|
|
|
|
! ilev not specified: set preconditioner parameters at all the appropriate
|
|
|
|
|
! levels
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_prec_type_,mld_sub_solve_,mld_sub_restr_,mld_sub_prol_,mld_sub_ren_,&
|
|
|
|
|
& mld_smooth_sweeps_,mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,mld_coarse_mat_,&
|
|
|
|
|
& mld_smooth_sweeps_,mld_ml_type_,mld_aggr_alg_,mld_aggr_kind_,&
|
|
|
|
|
& mld_smooth_pos_)
|
|
|
|
|
call get_stringval(string,val,info)
|
|
|
|
|
do ilev_=1,nlev_-1
|
|
|
|
@ -318,6 +360,14 @@ subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
endif
|
|
|
|
|
p%baseprecv(ilev_)%iprcparm(what) = val
|
|
|
|
|
end do
|
|
|
|
|
case(mld_coarse_mat_)
|
|
|
|
|
if (.not.allocated(p%baseprecv(nlev_)%iprcparm)) then
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET on an uninitialized preconditioner'
|
|
|
|
|
info = -1
|
|
|
|
|
return
|
|
|
|
|
endif
|
|
|
|
|
call get_stringval(string,val,info)
|
|
|
|
|
p%baseprecv(nlev_)%iprcparm(mld_coarse_mat_) = val
|
|
|
|
|
case(mld_coarse_solve_)
|
|
|
|
|
if (.not.allocated(p%baseprecv(nlev_)%iprcparm)) then
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET on an uninitialized preconditioner'
|
|
|
|
@ -335,7 +385,24 @@ subroutine mld_dprecsetc(p,what,string,info,ilev)
|
|
|
|
|
|
|
|
|
|
contains
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Subroutine: get_stringval
|
|
|
|
|
! Note: internal subroutine of mld_dprecsetc
|
|
|
|
|
!
|
|
|
|
|
! This routine converts the string contained into string into the corresponding
|
|
|
|
|
! integer value.
|
|
|
|
|
!
|
|
|
|
|
! Arguments:
|
|
|
|
|
! string - character(len=*), input.
|
|
|
|
|
! The string to be converted.
|
|
|
|
|
! val - integer, output.
|
|
|
|
|
! The integer value corresponding to the string
|
|
|
|
|
! info - integer, output.
|
|
|
|
|
! Error code.
|
|
|
|
|
!
|
|
|
|
|
subroutine get_stringval(string,val,info)
|
|
|
|
|
|
|
|
|
|
! Arguments
|
|
|
|
|
character(len=*), intent(in) :: string
|
|
|
|
|
integer, intent(out) :: val, info
|
|
|
|
|
|
|
|
|
@ -355,10 +422,12 @@ contains
|
|
|
|
|
val = mld_milu_n_
|
|
|
|
|
case('ILUT')
|
|
|
|
|
val = mld_ilu_t_
|
|
|
|
|
case('UMF')
|
|
|
|
|
val = mld_umf_
|
|
|
|
|
case('SLU')
|
|
|
|
|
val = mld_slu_
|
|
|
|
|
case('UMFP')
|
|
|
|
|
val = mld_umf_
|
|
|
|
|
case('SLUDIST')
|
|
|
|
|
val = mld_sludist_
|
|
|
|
|
case('ADD')
|
|
|
|
|
val = mld_add_ml_
|
|
|
|
|
case('MULT')
|
|
|
|
@ -389,12 +458,22 @@ contains
|
|
|
|
|
write(0,*) 'Error in get_Stringval: unknown: "',trim(string),'"'
|
|
|
|
|
end if
|
|
|
|
|
end subroutine get_stringval
|
|
|
|
|
|
|
|
|
|
end subroutine mld_dprecsetc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Subroutine: mld_dprecsetd
|
|
|
|
|
! Version: real
|
|
|
|
|
!
|
|
|
|
|
! This routine sets the real parameters defining the preconditioner. More
|
|
|
|
|
! precisely, the real parameter identified by 'what' is assigned the value
|
|
|
|
|
! contained in 'val'.
|
|
|
|
|
! For the multilevel preconditioners, the levels are numbered in increasing
|
|
|
|
|
! order starting from the finest one, i.e. level 1 is the finest level.
|
|
|
|
|
!
|
|
|
|
|
! To set integer and character parameters, see mld_dprecseti and mld_dprecsetc,
|
|
|
|
|
! respectively.
|
|
|
|
|
!
|
|
|
|
|
! Arguments:
|
|
|
|
|
! p - type(mld_dprec_type), input/output.
|
|
|
|
@ -403,7 +482,7 @@ end subroutine mld_dprecsetc
|
|
|
|
|
! The number identifying the parameter to be set.
|
|
|
|
|
! A mnemonic constant has been associated to each of these
|
|
|
|
|
! numbers, as reported in MLD2P4 user's guide.
|
|
|
|
|
! val - real(kind(1.d0))
|
|
|
|
|
! val - real(kind(1.d0)), input.
|
|
|
|
|
! The value of the parameter to be set. The list of allowed
|
|
|
|
|
! values is reported in MLD2P4 user's guide.
|
|
|
|
|
! info - integer, output.
|
|
|
|
@ -412,10 +491,7 @@ end subroutine mld_dprecsetc
|
|
|
|
|
! For the multilevel preconditioner, the level at which the
|
|
|
|
|
! preconditioner parameter has to be set.
|
|
|
|
|
! If nlev is not present, the parameter identified by 'what'
|
|
|
|
|
! is set at all the levels but the coarsest one, except when
|
|
|
|
|
! 'what' has the values mld_coarse_mat_, mld_coarse_solve_,
|
|
|
|
|
! mld_coarse_sweeps_, mld_coarse_fill_in_, which refer to the
|
|
|
|
|
! coarsest level.
|
|
|
|
|
! is set at all the appropriate levels.
|
|
|
|
|
!
|
|
|
|
|
subroutine mld_dprecsetd(p,what,val,info,ilev)
|
|
|
|
|
|
|
|
|
@ -423,12 +499,15 @@ subroutine mld_dprecsetd(p,what,val,info,ilev)
|
|
|
|
|
use mld_prec_mod, mld_protect_name => mld_dprecsetd
|
|
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
|
|
|
|
|
|
! Arguments
|
|
|
|
|
type(mld_dprec_type), intent(inout) :: p
|
|
|
|
|
integer, intent(in) :: what
|
|
|
|
|
real(kind(1.d0)), intent(in) :: val
|
|
|
|
|
integer, intent(out) :: info
|
|
|
|
|
integer, optional, intent(in) :: ilev
|
|
|
|
|
|
|
|
|
|
! Local variables
|
|
|
|
|
integer :: ilev_,nlev_
|
|
|
|
|
|
|
|
|
|
info = 0
|
|
|
|
@ -455,8 +534,15 @@ subroutine mld_dprecsetd(p,what,val,info,ilev)
|
|
|
|
|
return
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
|
! Set preconditioner parameters at level ilev.
|
|
|
|
|
!
|
|
|
|
|
if (present(ilev)) then
|
|
|
|
|
|
|
|
|
|
if (ilev_ == 1) then
|
|
|
|
|
!
|
|
|
|
|
! Rules for fine level are slightly different.
|
|
|
|
|
!
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_fact_thrs_)
|
|
|
|
|
p%baseprecv(ilev_)%dprcparm(what) = val
|
|
|
|
@ -464,6 +550,7 @@ subroutine mld_dprecsetd(p,what,val,info,ilev)
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET with an invalid WHAT'
|
|
|
|
|
info = -2
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
else if (ilev_ > 1) then
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_aggr_damp_,mld_fact_thrs_)
|
|
|
|
@ -474,4 +561,35 @@ subroutine mld_dprecsetd(p,what,val,info,ilev)
|
|
|
|
|
end select
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
else if (.not.present(ilev)) then
|
|
|
|
|
!
|
|
|
|
|
! ilev not specified: set preconditioner parameters at all the appropriate levels
|
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
select case(what)
|
|
|
|
|
case(mld_fact_thrs_)
|
|
|
|
|
do ilev_=1,nlev_-1
|
|
|
|
|
if (.not.allocated(p%baseprecv(ilev_)%dprcparm)) then
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET on an uninitialized preconditioner'
|
|
|
|
|
info = -1
|
|
|
|
|
return
|
|
|
|
|
endif
|
|
|
|
|
p%baseprecv(ilev_)%dprcparm(what) = val
|
|
|
|
|
end do
|
|
|
|
|
case(mld_aggr_damp_)
|
|
|
|
|
do ilev_=2,nlev_-1
|
|
|
|
|
if (.not.allocated(p%baseprecv(ilev_)%dprcparm)) then
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET on an uninitialized preconditioner'
|
|
|
|
|
info = -1
|
|
|
|
|
return
|
|
|
|
|
endif
|
|
|
|
|
p%baseprecv(ilev_)%dprcparm(what) = val
|
|
|
|
|
end do
|
|
|
|
|
case default
|
|
|
|
|
write(0,*) 'Error: trying to call PRECSET with an invalid WHAT'
|
|
|
|
|
info = -2
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
end subroutine mld_dprecsetd
|
|
|
|
|