New test cases
parent
b1c4b08d6e
commit
f99b563f83
@ -0,0 +1,66 @@
|
||||
AMGDIR=../../..
|
||||
AMGINCDIR=$(AMGDIR)/include
|
||||
include $(AMGINCDIR)/Make.inc.amg4psblas
|
||||
AMGMODDIR=$(AMGDIR)/modules
|
||||
AMGLIBDIR=$(AMGDIR)/lib
|
||||
AMG_LIBS=-L$(AMGLIBDIR) -lpsb_linsolve -lamg_prec -lpsb_prec
|
||||
FINCLUDES=$(FMFLAG). $(FMFLAG)$(AMGMODDIR) $(FMFLAG)$(AMGINCDIR) $(PSBLAS_INCLUDES) $(FIFLAG).
|
||||
|
||||
LINKOPT=
|
||||
EXEDIR=./runs
|
||||
DGEN2D=amg_d_pde2d_poisson_mod.o amg_d_pde2d_exp_mod.o \
|
||||
amg_d_pde2d_gauss_mod.o amg_d_pde2d_box_mod.o
|
||||
DGEN3D=amg_d_pde3d_poisson_mod.o amg_d_pde3d_exp_mod.o \
|
||||
amg_d_pde3d_gauss_mod.o amg_d_pde3d_box_mod.o
|
||||
SGEN2D=amg_s_pde2d_poisson_mod.o amg_s_pde2d_exp_mod.o \
|
||||
amg_s_pde2d_gauss_mod.o amg_s_pde2d_box_mod.o
|
||||
SGEN3D=amg_s_pde3d_poisson_mod.o amg_s_pde3d_exp_mod.o \
|
||||
amg_s_pde3d_gauss_mod.o amg_s_pde3d_box_mod.o
|
||||
|
||||
all: amg_s_pde3d amg_d_pde3d amg_s_pde2d amg_d_pde2d
|
||||
|
||||
amg_d_pde3d: amg_d_pde3d.o amg_d_genpde_mod.o $(DGEN3D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde3d.o amg_d_genpde_mod.o $(DGEN3D) data_input.o \
|
||||
-o amg_d_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(AMG_LDLIBS) $(LDLIBS)
|
||||
/bin/mv amg_d_pde3d $(EXEDIR)
|
||||
|
||||
amg_s_pde3d: amg_s_pde3d.o amg_s_genpde_mod.o $(SGEN3D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde3d.o amg_s_genpde_mod.o $(SGEN3D) data_input.o \
|
||||
-o amg_s_pde3d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_s_pde3d $(EXEDIR)
|
||||
|
||||
amg_d_pde2d: amg_d_pde2d.o amg_d_genpde_mod.o $(DGEN2D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_d_pde2d.o amg_d_genpde_mod.o $(DGEN2D) data_input.o \
|
||||
-o amg_d_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_d_pde2d $(EXEDIR)
|
||||
|
||||
amg_s_pde2d: amg_s_pde2d.o amg_s_genpde_mod.o $(SGEN2D) data_input.o
|
||||
$(FLINK) $(LINKOPT) amg_s_pde2d.o amg_s_genpde_mod.o $(SGEN2D) data_input.o \
|
||||
-o amg_s_pde2d $(AMG_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
|
||||
/bin/mv amg_s_pde2d $(EXEDIR)
|
||||
|
||||
|
||||
amg_d_pde3d.o amg_s_pde3d.o amg_d_pde2d.o amg_s_pde2d.o: data_input.o
|
||||
|
||||
amg_d_pde3d.o: amg_d_genpde_mod.o $(DGEN3D)
|
||||
amg_s_pde3d.o: amg_s_genpde_mod.o $(SGEN3D)
|
||||
amg_d_pde2d.o: amg_d_genpde_mod.o $(DGEN2D)
|
||||
amg_s_pde2d.o: amg_s_genpde_mod.o $(SGEN2D)
|
||||
|
||||
amg_d_genpde_mod.o: $(DGEN3D)
|
||||
amg_s_genpde_mod.o: $(SGEN3D)
|
||||
amg_d_genpde_mod.o: $(DGEN2D)
|
||||
amg_s_genpde_mod.o: $(SGEN2D)
|
||||
|
||||
check: all
|
||||
cd runs && ./amg_d_pde2d <amg_pde2d.inp && ./amg_s_pde2d<amg_pde2d.inp
|
||||
|
||||
|
||||
clean:
|
||||
/bin/rm -f data_input.o *.o *$(.mod)\
|
||||
$(EXEDIR)/amg_d_pde3d $(EXEDIR)/amg_s_pde3d $(EXEDIR)/amg_d_pde2d $(EXEDIR)/amg_s_pde2d
|
||||
|
||||
verycleanlib:
|
||||
(cd ../..; make veryclean)
|
||||
lib:
|
||||
(cd ../../; make library)
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,843 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: amg_d_pde2d.f90
|
||||
!
|
||||
! Program: amg_d_pde2d
|
||||
! This sample program solves a linear system obtained by discretizing a
|
||||
! PDE with Dirichlet BCs.
|
||||
!
|
||||
!
|
||||
! The PDE is a general second order equation in 2d
|
||||
!
|
||||
! a1 dd(u) a2 dd(u) b1 d(u) b2 d(u)
|
||||
! - ------ - ------ ----- + ------ + c u = f
|
||||
! dxdx dydy dx dy
|
||||
!
|
||||
! with Dirichlet boundary conditions
|
||||
! u = g
|
||||
!
|
||||
! on the unit square 0<=x,y<=1.
|
||||
!
|
||||
!
|
||||
! Note that if b1=b2=c=0., the PDE is the Laplace equation.
|
||||
!
|
||||
! There are three choices available for data distribution:
|
||||
! 1. A simple BLOCK distribution
|
||||
! 2. A ditribution based on arbitrary assignment of indices to processes,
|
||||
! typically from a graph partitioner
|
||||
! 3. A 2D distribution in which the unit square is partitioned
|
||||
! into rectangles, each one assigned to a process.
|
||||
!
|
||||
program amg_d_pde2d
|
||||
use psb_base_mod
|
||||
use amg_prec_mod
|
||||
use psb_linsolve_mod
|
||||
use psb_util_mod
|
||||
use data_input
|
||||
use amg_d_pde2d_poisson_mod
|
||||
use amg_d_pde2d_exp_mod
|
||||
use amg_d_pde2d_box_mod
|
||||
use amg_d_pde2d_gauss_mod
|
||||
use amg_d_genpde_mod
|
||||
#if defined(PSB_OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
character(len=20) :: kmethd, ptype
|
||||
character(len=5) :: afmt
|
||||
character(len=32) :: pdecoeff
|
||||
integer(psb_ipk_) :: idim
|
||||
integer(psb_epk_) :: system_size
|
||||
|
||||
! miscellaneous
|
||||
real(psb_dpk_) :: t1, t2, tprec, thier, tslv, tsmth, tpgen
|
||||
|
||||
! sparse matrix and preconditioner
|
||||
type(psb_dspmat_type) :: a
|
||||
type(amg_dprec_type) :: prec
|
||||
! descriptor
|
||||
type(psb_desc_type) :: desc_a
|
||||
! dense vectors
|
||||
type(psb_d_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
integer(psb_epk_) :: amatsize, precsize, descsize, vecsize
|
||||
real(psb_dpk_) :: err, resmx, resmxp
|
||||
|
||||
! Solver data
|
||||
type solverdata
|
||||
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
|
||||
integer(psb_ipk_) :: irst ! restart
|
||||
real(psb_dpk_) :: eps ! stopping tolerance
|
||||
end type solverdata
|
||||
type(solverdata) :: s_choice
|
||||
|
||||
! preconditioner data
|
||||
type precdata
|
||||
|
||||
! preconditioner type
|
||||
character(len=40) :: descr ! verbose description of the prec
|
||||
character(len=10) :: ptype ! preconditioner type
|
||||
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_dpk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: degree ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant ! polynomial variant
|
||||
character(len=32) :: prhovariant ! how to estimate rho(M^{-1}A)
|
||||
real(psb_dpk_) :: prhovalue ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: degree2 ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant2 ! polynomial variant
|
||||
character(len=32) :: prhovariant2 ! how to estimate rho(M^{-1}A)
|
||||
real(psb_dpk_) :: prhovalue2 ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
! settings for the Krylov method
|
||||
character(len=16) :: krm_method ! Krylov method for coarsest level
|
||||
character(len=16) :: krm_prec ! Preconditioner for coarsest level
|
||||
character(len=16) :: krm_subsolve ! Subsolver for coarsest level
|
||||
character(len=16) :: krm_global ! Is the solver global or local? TRUE or FALSE
|
||||
real(psb_dpk_) :: krm_eps ! Stopping tolerance
|
||||
integer(psb_ipk_) :: krm_irst ! Restart for Krylov method
|
||||
integer(psb_ipk_) :: krm_istop ! Stopping criterion
|
||||
integer(psb_ipk_) :: krm_itmax ! Maximum number of iterations
|
||||
integer(psb_ipk_) :: krm_itrace ! Trace of the lower Krylov iterations
|
||||
integer(psb_ipk_) :: krm_fillin ! Fill-in for incomplete LU factorization
|
||||
|
||||
! Dump data
|
||||
logical :: dump = .false.
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
logical :: dump_ac = .false.
|
||||
logical :: dump_rp = .false.
|
||||
logical :: dump_tprol = .false.
|
||||
logical :: dump_smoother = .false.
|
||||
logical :: dump_solver = .false.
|
||||
logical :: dump_global_num = .false.
|
||||
|
||||
end type precdata
|
||||
type(precdata) :: p_choice
|
||||
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(PSB_OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
endif
|
||||
if(psb_get_errstatus() /= 0) goto 9999
|
||||
name='amg_d_pde2d'
|
||||
call psb_set_errverbosity(itwo)
|
||||
!
|
||||
! Hello world
|
||||
!
|
||||
if (iam == psb_root_) then
|
||||
write(*,*) 'Welcome to AMG4PSBLAS version: ',amg_version_string_
|
||||
write(*,*) 'This is the ',trim(name),' sample program'
|
||||
end if
|
||||
|
||||
!
|
||||
! get parameters
|
||||
!
|
||||
call get_parms(ctxt,afmt,idim,s_choice,p_choice,pdecoeff)
|
||||
|
||||
!
|
||||
! allocate and fill in the coefficient matrix, rhs and initial guess
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("POISSON")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_poisson,a2_poisson,&
|
||||
& b1_poisson,b2_poisson,c_poisson,g_poisson,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,&
|
||||
& b1_exp,b2_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,&
|
||||
& b1_box,b2_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,&
|
||||
& b1_gauss,b2_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end select
|
||||
call psb_barrier(ctxt)
|
||||
tpgen = psb_wtime() - t1
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pde2d'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("PDE Coefficients : ",a)')pdecoeff
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("Overall matrix creation time : ",es12.5)')tpgen
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'(" ")')
|
||||
!
|
||||
! initialize the preconditioner
|
||||
!
|
||||
call prec%init(ctxt,p_choice%ptype,info)
|
||||
select case(trim(psb_toupper(p_choice%ptype)))
|
||||
case ('NONE','NOPREC')
|
||||
! Do nothing, keep defaults
|
||||
|
||||
case ('JACOBI','L1-JACOBI','GS','FWGS','FBGS')
|
||||
! 1-level sweeps from "outer_sweeps"
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
|
||||
case ('BJAC','POLY')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case('AS')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case ('ML')
|
||||
! multilevel preconditioner
|
||||
|
||||
call prec%set('ml_cycle', p_choice%mlcycle, info)
|
||||
call prec%set('outer_sweeps', p_choice%outer_sweeps,info)
|
||||
if (p_choice%csizepp>0)&
|
||||
& call prec%set('min_coarse_size_per_process', p_choice%csizepp, info)
|
||||
if (p_choice%mncrratio>1)&
|
||||
& call prec%set('min_cr_ratio', p_choice%mncrratio, info)
|
||||
if (p_choice%maxlevs>0)&
|
||||
& call prec%set('max_levs', p_choice%maxlevs, info)
|
||||
if (p_choice%athres >= dzero) &
|
||||
& call prec%set('aggr_thresh', p_choice%athres, info)
|
||||
if (p_choice%thrvsz>0) then
|
||||
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
|
||||
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
|
||||
end do
|
||||
end if
|
||||
|
||||
call prec%set('aggr_prol', p_choice%aggr_prol, info)
|
||||
call prec%set('par_aggr_alg', p_choice%par_aggr_alg, info)
|
||||
call prec%set('aggr_type', p_choice%aggr_type, info)
|
||||
call prec%set('aggr_size', p_choice%aggr_size, info)
|
||||
|
||||
call prec%set('aggr_ord', p_choice%aggr_ord, info)
|
||||
call prec%set('aggr_filter', p_choice%aggr_filter,info)
|
||||
|
||||
|
||||
call prec%set('smoother_type', p_choice%smther, info)
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (p_choice%prhovalue > dzero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue, info)
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant, info)
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
select case(trim(psb_toupper(p_choice%solve)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
|
||||
if (psb_toupper(p_choice%smther2) /= 'NONE') then
|
||||
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
|
||||
call prec%set('poly_degree', p_choice%degree2, info,pos='post')
|
||||
call prec%set('poly_variant', p_choice%pvariant2, info,pos='post')
|
||||
if (p_choice%prhovalue > dzero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue2, info,pos='post')
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant2, info,pos='post')
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther2))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
select case(trim(psb_toupper(p_choice%solve2)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
end if
|
||||
|
||||
call prec%set('coarse_solve', p_choice%csolve, info)
|
||||
call prec%set('coarse_mat', p_choice%cmat, info)
|
||||
! Set for the case of a KRM solver
|
||||
if (psb_toupper(p_choice%csolve) == 'KRM') then
|
||||
call prec%set('krm_method', p_choice%krm_method, info)
|
||||
call prec%set('krm_kprec', p_choice%krm_prec, info)
|
||||
call prec%set('krm_sub_solve', p_choice%krm_subsolve, info)
|
||||
call prec%set('krm_global', p_choice%krm_global, info)
|
||||
call prec%set('krm_eps', p_choice%krm_eps, info)
|
||||
call prec%set('krm_irst', p_choice%krm_irst, info)
|
||||
call prec%set('krm_istopc', p_choice%krm_istop, info)
|
||||
call prec%set('krm_itmax', p_choice%krm_itmax, info)
|
||||
call prec%set('krm_itrace', p_choice%krm_itrace, info)
|
||||
call prec%set('krm_fillin', p_choice%krm_fillin, info)
|
||||
else
|
||||
if (psb_toupper(p_choice%csolve) == 'BJAC') &
|
||||
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
|
||||
call prec%set('coarse_fillin', p_choice%cfill, info)
|
||||
call prec%set('coarse_iluthrs', p_choice%cthres, info)
|
||||
call prec%set('coarse_sweeps', p_choice%cjswp, info)
|
||||
end if
|
||||
end select
|
||||
|
||||
! build the preconditioner
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%hierarchy_build(a,desc_a,info)
|
||||
thier = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_hierarchy_bld')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tsmth = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_amx(ctxt, thier)
|
||||
call psb_amx(ctxt, tprec)
|
||||
|
||||
if(iam == psb_root_) then
|
||||
write(psb_out_unit,'(" ")')
|
||||
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
|
||||
write(psb_out_unit,'(" ")')
|
||||
end if
|
||||
|
||||
if (p_choice%dump) then
|
||||
call prec%dump(info,istart=p_choice%dlmin,iend=p_choice%dlmax,&
|
||||
& ac=p_choice%dump_ac,rp=p_choice%dump_rp,tprol=p_choice%dump_tprol,&
|
||||
& smoother=p_choice%dump_smoother, solver=p_choice%dump_solver, &
|
||||
& global_num=p_choice%dump_global_num)
|
||||
end if
|
||||
!
|
||||
! iterative method parameters
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
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)
|
||||
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)
|
||||
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
|
||||
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='solver routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tslv = psb_wtime() - t1
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
! compute residual norms
|
||||
call psb_geall(r,desc_a,info)
|
||||
call r%zero()
|
||||
call psb_geasb(r,desc_a,info)
|
||||
call psb_geaxpby(done,b,dzero,r,desc_a,info)
|
||||
call psb_spmm(-done,a,x,done,r,desc_a,info)
|
||||
resmx = psb_genrm2(r,desc_a,info)
|
||||
resmxp = psb_geamax(r,desc_a,info)
|
||||
|
||||
vecsize = x%sizeof()
|
||||
amatsize = a%sizeof()
|
||||
descsize = desc_a%sizeof()
|
||||
precsize = prec%sizeof()
|
||||
system_size = desc_a%get_global_rows()
|
||||
call psb_sum(ctxt,vecsize)
|
||||
call psb_sum(ctxt,amatsize)
|
||||
call psb_sum(ctxt,descsize)
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Discretization domain size : ",i12)') idim
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Problem setup time : ",es12.5)') tpgen
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tsmth
|
||||
write(psb_out_unit,'("Total preconditioner setup time : ",es12.5)') tsmth+thier
|
||||
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
|
||||
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
|
||||
write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
|
||||
write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
|
||||
write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
|
||||
write(psb_out_unit,'("Total memory occupation for X : ",i16)') vecsize
|
||||
write(psb_out_unit,'("Total memory occupation for A : ",i16)') amatsize
|
||||
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i16)') descsize
|
||||
write(psb_out_unit,'("Total memory occupation for PREC : ",i16)') precsize
|
||||
write(psb_out_unit,'("Total memory occupation : ",i16)') &
|
||||
& amatsize + descsize+precsize+2*vecsize
|
||||
write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
call psb_gefree(b,desc_a,info)
|
||||
call psb_gefree(x,desc_a,info)
|
||||
call psb_spfree(a,desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='free routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
|
||||
9999 continue
|
||||
call psb_error(ctxt)
|
||||
|
||||
contains
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
subroutine get_parms(ctxt,afmt,idim,solve,prec,pdecoeff)
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: idim
|
||||
character(len=*) :: afmt
|
||||
type(solverdata) :: solve
|
||||
type(precdata) :: prec
|
||||
character(len=*) :: pdecoeff
|
||||
integer(psb_ipk_) :: iam, nm, np, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (iam == psb_root_) then
|
||||
if (command_argument_count()>0) then
|
||||
call get_command_argument(1,filename)
|
||||
inp_unit = 30
|
||||
open(inp_unit,file=filename,action='read',iostat=info)
|
||||
if (info /= 0) then
|
||||
write(psb_err_unit,*) 'Could not open file ',filename,' for input'
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
else
|
||||
write(psb_err_unit,*) 'Opened file ',trim(filename),' for input'
|
||||
end if
|
||||
else
|
||||
write(psb_err_unit,*) 'Usage: amg_d_pde2d ctrl-file '
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
end if
|
||||
! read input data
|
||||
!
|
||||
call read_data(afmt,inp_unit) ! matrix storage format
|
||||
call read_data(idim,inp_unit) ! Discretization grid size
|
||||
call read_data(pdecoeff,inp_unit) ! PDE Coefficients
|
||||
! Krylov solver data
|
||||
call read_data(solve%kmethd,inp_unit) ! Krylov solver
|
||||
call read_data(solve%istopc,inp_unit) ! stopping criterion
|
||||
call read_data(solve%itmax,inp_unit) ! max num iterations
|
||||
call read_data(solve%itrace,inp_unit) ! tracing
|
||||
call read_data(solve%irst,inp_unit) ! restart
|
||||
call read_data(solve%eps,inp_unit) ! tolerance
|
||||
! preconditioner type
|
||||
call read_data(prec%descr,inp_unit) ! verbose description of the prec
|
||||
call read_data(prec%ptype,inp_unit) ! preconditioner type
|
||||
|
||||
! First smoother / 1-lev preconditioner
|
||||
call read_data(prec%smther,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%degree,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%pvariant,inp_unit) !
|
||||
call read_data(prec%prhovariant,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr,inp_unit) ! threshold for ILUT
|
||||
! Second smoother/ AMG post-smoother (if NONE ignored in main)
|
||||
call read_data(prec%smther2,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%degree2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%pvariant2,inp_unit) !
|
||||
call read_data(prec%prhovariant2,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue2,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr2,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr2,inp_unit) ! threshold for ILUT
|
||||
! general AMG data
|
||||
call read_data(prec%mlcycle,inp_unit) ! AMG cycle type
|
||||
call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps
|
||||
call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec
|
||||
call read_data(prec%csizepp,inp_unit) ! min size coarsest mat
|
||||
! aggregation
|
||||
call read_data(prec%aggr_prol,inp_unit) ! aggregation type
|
||||
call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg
|
||||
call read_data(prec%aggr_type,inp_unit) ! type of aggregation
|
||||
call read_data(prec%aggr_size,inp_unit) ! Requested size of the aggregates for MATCHBOXP
|
||||
call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%aggr_filter,inp_unit) ! filtering
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector
|
||||
if (prec%thrvsz > 0) then
|
||||
call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call read_data(prec%athresv,inp_unit) ! aggr thresh vector
|
||||
else
|
||||
read(inp_unit,*) ! dummy read to skip a record
|
||||
end if
|
||||
! coasest-level solver
|
||||
call read_data(prec%csolve,inp_unit) ! coarsest-lev solver
|
||||
call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver
|
||||
call read_data(prec%cmat,inp_unit) ! coarsest mat layout
|
||||
call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU
|
||||
call read_data(prec%cthres,inp_unit) ! Threshold for ILUT
|
||||
call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver
|
||||
! Krylov method for coarsest level
|
||||
call read_data(prec%krm_method,inp_unit) ! Krylov method for coarsest level
|
||||
call read_data(prec%krm_prec,inp_unit) ! Preconditioner for coarsest level
|
||||
call read_data(prec%krm_subsolve,inp_unit) ! Subsolver for coarsest level
|
||||
call read_data(prec%krm_global,inp_unit) ! Is the solver global or local? TRUE or FALSE
|
||||
call read_data(prec%krm_eps,inp_unit) ! Stopping tolerance
|
||||
call read_data(prec%krm_irst,inp_unit) ! Restart for Krylov method
|
||||
call read_data(prec%krm_istop,inp_unit) ! Stopping criterion
|
||||
call read_data(prec%krm_itmax,inp_unit) ! Maximum number of iterations
|
||||
call read_data(prec%krm_itrace,inp_unit) ! Trace of the lower Krylov iterations
|
||||
call read_data(prec%krm_fillin,inp_unit) ! Fill-in for incomplete LU factorization
|
||||
! dump
|
||||
call read_data(prec%dump,inp_unit) ! Dump on file?
|
||||
call read_data(prec%dlmin,inp_unit) ! Minimum level to dump
|
||||
call read_data(prec%dlmax,inp_unit) ! Maximum level to dump
|
||||
call read_data(prec%dump_ac,inp_unit)
|
||||
call read_data(prec%dump_rp,inp_unit)
|
||||
call read_data(prec%dump_tprol,inp_unit)
|
||||
call read_data(prec%dump_smoother,inp_unit)
|
||||
call read_data(prec%dump_solver,inp_unit)
|
||||
call read_data(prec%dump_global_num,inp_unit)
|
||||
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
end if
|
||||
|
||||
call psb_bcast(ctxt,afmt)
|
||||
call psb_bcast(ctxt,idim)
|
||||
call psb_bcast(ctxt,pdecoeff)
|
||||
|
||||
call psb_bcast(ctxt,solve%kmethd)
|
||||
call psb_bcast(ctxt,solve%istopc)
|
||||
call psb_bcast(ctxt,solve%itmax)
|
||||
call psb_bcast(ctxt,solve%itrace)
|
||||
call psb_bcast(ctxt,solve%irst)
|
||||
call psb_bcast(ctxt,solve%eps)
|
||||
|
||||
call psb_bcast(ctxt,prec%descr)
|
||||
call psb_bcast(ctxt,prec%ptype)
|
||||
|
||||
! broadcast first (pre-)smoother / 1-lev prec data
|
||||
call psb_bcast(ctxt,prec%smther)
|
||||
call psb_bcast(ctxt,prec%jsweeps)
|
||||
call psb_bcast(ctxt,prec%degree)
|
||||
call psb_bcast(ctxt,prec%pvariant)
|
||||
call psb_bcast(ctxt,prec%prhovariant)
|
||||
call psb_bcast(ctxt,prec%prhovalue)
|
||||
call psb_bcast(ctxt,prec%novr)
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
call psb_bcast(ctxt,prec%thr)
|
||||
! broadcast second (post-)smoother
|
||||
call psb_bcast(ctxt,prec%smther2)
|
||||
call psb_bcast(ctxt,prec%jsweeps2)
|
||||
call psb_bcast(ctxt,prec%degree2)
|
||||
call psb_bcast(ctxt,prec%pvariant2)
|
||||
call psb_bcast(ctxt,prec%prhovariant2)
|
||||
call psb_bcast(ctxt,prec%prhovalue2)
|
||||
call psb_bcast(ctxt,prec%novr2)
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
call psb_bcast(ctxt,prec%thr2)
|
||||
|
||||
! broadcast AMG parameters
|
||||
call psb_bcast(ctxt,prec%mlcycle)
|
||||
call psb_bcast(ctxt,prec%outer_sweeps)
|
||||
call psb_bcast(ctxt,prec%maxlevs)
|
||||
call psb_bcast(ctxt,prec%csizepp)
|
||||
|
||||
call psb_bcast(ctxt,prec%aggr_prol)
|
||||
call psb_bcast(ctxt,prec%par_aggr_alg)
|
||||
call psb_bcast(ctxt,prec%aggr_type)
|
||||
call psb_bcast(ctxt,prec%aggr_size)
|
||||
call psb_bcast(ctxt,prec%aggr_ord)
|
||||
call psb_bcast(ctxt,prec%aggr_filter)
|
||||
call psb_bcast(ctxt,prec%mncrratio)
|
||||
call psb_bcast(ctxt,prec%thrvsz)
|
||||
if (prec%thrvsz > 0) then
|
||||
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call psb_bcast(ctxt,prec%athresv)
|
||||
end if
|
||||
call psb_bcast(ctxt,prec%athres)
|
||||
|
||||
call psb_bcast(ctxt,prec%cmat)
|
||||
call psb_bcast(ctxt,prec%csolve)
|
||||
call psb_bcast(ctxt,prec%csbsolve)
|
||||
call psb_bcast(ctxt,prec%cfill)
|
||||
call psb_bcast(ctxt,prec%cthres)
|
||||
call psb_bcast(ctxt,prec%cjswp)
|
||||
! Krylov method for coarsest level (broadcast)
|
||||
call psb_bcast(ctxt,prec%krm_method)
|
||||
call psb_bcast(ctxt,prec%krm_prec)
|
||||
call psb_bcast(ctxt,prec%krm_subsolve)
|
||||
call psb_bcast(ctxt,prec%krm_global)
|
||||
call psb_bcast(ctxt,prec%krm_eps)
|
||||
call psb_bcast(ctxt,prec%krm_irst)
|
||||
call psb_bcast(ctxt,prec%krm_istop)
|
||||
call psb_bcast(ctxt,prec%krm_itmax)
|
||||
call psb_bcast(ctxt,prec%krm_itrace)
|
||||
call psb_bcast(ctxt,prec%krm_fillin)
|
||||
! dump
|
||||
call psb_bcast(ctxt,prec%dump)
|
||||
call psb_bcast(ctxt,prec%dlmin)
|
||||
call psb_bcast(ctxt,prec%dlmax)
|
||||
|
||||
call psb_bcast(ctxt,prec%dump_ac)
|
||||
call psb_bcast(ctxt,prec%dump_rp)
|
||||
call psb_bcast(ctxt,prec%dump_tprol)
|
||||
call psb_bcast(ctxt,prec%dump_smoother)
|
||||
call psb_bcast(ctxt,prec%dump_solver)
|
||||
call psb_bcast(ctxt,prec%dump_global_num)
|
||||
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
end program amg_d_pde2d
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde2d_box_mod
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_box(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_box = done/1.414_psb_dpk_
|
||||
end function b1_box
|
||||
function b2_box(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_box = done/1.414_psb_dpk_
|
||||
end function b2_box
|
||||
function c_box(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_box = dzero
|
||||
end function c_box
|
||||
function a1_box(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1_box=done*epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2_box=done*epsilon
|
||||
end function a2_box
|
||||
function g_box(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_box
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_box = dzero
|
||||
if (x == done) then
|
||||
g_box = done
|
||||
else if (x == dzero) then
|
||||
g_box = done
|
||||
end if
|
||||
end function g_box
|
||||
end module amg_d_pde2d_box_mod
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde2d_exp_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_exp(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_exp = dzero
|
||||
end function b1_exp
|
||||
function b2_exp(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_exp = dzero
|
||||
end function b2_exp
|
||||
function c_exp(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_exp = dzero
|
||||
end function c_exp
|
||||
function a1_exp(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1_exp=done*epsilon*exp(-(x+y))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2_exp=done*epsilon*exp(-(x+y))
|
||||
end function a2_exp
|
||||
function g_exp(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_exp
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_exp = dzero
|
||||
if (x == done) then
|
||||
g_exp = done
|
||||
else if (x == dzero) then
|
||||
g_exp = done
|
||||
end if
|
||||
end function g_exp
|
||||
end module amg_d_pde2d_exp_mod
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde2d_gauss_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_gauss(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_gauss=done/sqrt(3.0_psb_dpk_)-2*x*exp(-(x**2+y**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_gauss=done/sqrt(3.0_psb_dpk_)-2*y*exp(-(x**2+y**2))
|
||||
end function b2_gauss
|
||||
function c_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_gauss=dzero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a2_gauss
|
||||
function g_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_gauss = dzero
|
||||
if (x == done) then
|
||||
g_gauss = done
|
||||
else if (x == dzero) then
|
||||
g_gauss = done
|
||||
end if
|
||||
end function g_gauss
|
||||
end module amg_d_pde2d_gauss_mod
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde2d_poisson_mod
|
||||
use psb_base_mod, only : psb_dpk_, dzero, done
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_poisson(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_poisson
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b1_poisson = dzero
|
||||
end function b1_poisson
|
||||
function b2_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
b2_poisson = dzero
|
||||
end function b2_poisson
|
||||
function c_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
c_poisson = dzero
|
||||
end function c_poisson
|
||||
function a1_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a1_poisson=done*epsilon
|
||||
end function a1_poisson
|
||||
function a2_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
a2_poisson=done*epsilon
|
||||
end function a2_poisson
|
||||
function g_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y
|
||||
g_poisson = dzero
|
||||
if (x == done) then
|
||||
g_poisson = done
|
||||
else if (x == dzero) then
|
||||
g_poisson = done
|
||||
end if
|
||||
end function g_poisson
|
||||
end module amg_d_pde2d_poisson_mod
|
||||
@ -0,0 +1,852 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: amg_d_pde3d.f90
|
||||
!
|
||||
! Program: amg_d_pde3d
|
||||
! This sample program solves a linear system obtained by discretizing a
|
||||
! PDE with Dirichlet BCs.
|
||||
!
|
||||
!
|
||||
! The PDE is a general second order equation in 3d
|
||||
!
|
||||
! a1 dd(u) a2 dd(u) a3 dd(u) b1 d(u) b2 d(u) b3 d(u)
|
||||
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
||||
! dxdx dydy dzdz dx dy dz
|
||||
!
|
||||
! with Dirichlet boundary conditions
|
||||
! u = g
|
||||
!
|
||||
! on the unit cube 0<=x,y,z<=1.
|
||||
!
|
||||
!
|
||||
! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation.
|
||||
!
|
||||
! There are three choices available for data distribution:
|
||||
! 1. A simple BLOCK distribution
|
||||
! 2. A ditribution based on arbitrary assignment of indices to processes,
|
||||
! typically from a graph partitioner
|
||||
! 3. A 3D distribution in which the unit cube is partitioned
|
||||
! into subcubes, each one assigned to a process.
|
||||
!
|
||||
program amg_d_pde3d
|
||||
use psb_base_mod
|
||||
use amg_prec_mod
|
||||
use psb_linsolve_mod
|
||||
use psb_util_mod
|
||||
use data_input
|
||||
use amg_d_pde3d_poisson_mod
|
||||
use amg_d_pde3d_exp_mod
|
||||
use amg_d_pde3d_box_mod
|
||||
use amg_d_pde3d_gauss_mod
|
||||
use amg_d_genpde_mod
|
||||
#if defined(PSB_OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
character(len=20) :: kmethd, ptype
|
||||
character(len=5) :: afmt
|
||||
character(len=32) :: pdecoeff
|
||||
integer(psb_ipk_) :: idim
|
||||
integer(psb_epk_) :: system_size
|
||||
|
||||
! miscellaneous
|
||||
real(psb_dpk_) :: t1, t2, tprec, thier, tslv, tsmth, tpgen
|
||||
|
||||
! sparse matrix and preconditioner
|
||||
type(psb_dspmat_type) :: a
|
||||
type(amg_dprec_type) :: prec
|
||||
! descriptor
|
||||
type(psb_desc_type) :: desc_a
|
||||
! dense vectors
|
||||
type(psb_d_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
integer(psb_epk_) :: amatsize, precsize, descsize, vecsize
|
||||
real(psb_dpk_) :: err, resmx, resmxp
|
||||
|
||||
! Solver data
|
||||
type solverdata
|
||||
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
|
||||
integer(psb_ipk_) :: irst ! restart
|
||||
real(psb_dpk_) :: eps ! stopping tolerance
|
||||
end type solverdata
|
||||
type(solverdata) :: s_choice
|
||||
|
||||
! preconditioner data
|
||||
type precdata
|
||||
|
||||
! preconditioner type
|
||||
character(len=40) :: descr ! verbose description of the prec
|
||||
character(len=10) :: ptype ! preconditioner type
|
||||
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_dpk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
logical :: remap = .false. ! do_remap
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: degree ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant ! polynomial variant
|
||||
character(len=32) :: prhovariant ! how to estimate rho(M^{-1}A)
|
||||
real(psb_dpk_) :: prhovalue ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: degree2 ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant2 ! polynomial variant
|
||||
character(len=32) :: prhovariant2 ! how to estimate rho(M^{-1}A)
|
||||
real(psb_dpk_) :: prhovalue2 ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
! settings for the Krylov method
|
||||
character(len=16) :: krm_method ! Krylov method for coarsest level
|
||||
character(len=16) :: krm_prec ! Preconditioner for coarsest level
|
||||
character(len=16) :: krm_subsolve ! Subsolver for coarsest level
|
||||
character(len=16) :: krm_global ! Is the solver global or local? TRUE or FALSE
|
||||
real(psb_dpk_) :: krm_eps ! Stopping tolerance
|
||||
integer(psb_ipk_) :: krm_irst ! Restart for Krylov method
|
||||
integer(psb_ipk_) :: krm_istop ! Stopping criterion
|
||||
integer(psb_ipk_) :: krm_itmax ! Maximum number of iterations
|
||||
integer(psb_ipk_) :: krm_itrace ! Trace of the lower Krylov iterations
|
||||
integer(psb_ipk_) :: krm_fillin ! Fill-in for incomplete LU factorization
|
||||
|
||||
! Dump data
|
||||
logical :: dump = .false.
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
logical :: dump_ac = .false.
|
||||
logical :: dump_rp = .false.
|
||||
logical :: dump_tprol = .false.
|
||||
logical :: dump_smoother = .false.
|
||||
logical :: dump_solver = .false.
|
||||
logical :: dump_global_num = .false.
|
||||
|
||||
end type precdata
|
||||
type(precdata) :: p_choice
|
||||
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(PSB_OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
endif
|
||||
if(psb_get_errstatus() /= 0) goto 9999
|
||||
name='amg_d_pde3d'
|
||||
call psb_set_errverbosity(itwo)
|
||||
!
|
||||
! Hello world
|
||||
!
|
||||
if (iam == psb_root_) then
|
||||
write(*,*) 'Welcome to AMG4PSBLAS version: ',amg_version_string_
|
||||
write(*,*) 'This is the ',trim(name),' sample program'
|
||||
end if
|
||||
|
||||
!
|
||||
! get parameters
|
||||
!
|
||||
call get_parms(ctxt,afmt,idim,s_choice,p_choice,pdecoeff)
|
||||
|
||||
!
|
||||
! allocate and fill in the coefficient matrix, rhs and initial guess
|
||||
!
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("POISSON")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_poisson,a2_poisson,a3_poisson,&
|
||||
& b1_poisson,b2_poisson,b3_poisson,c_poisson,g_poisson,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,a3_exp,&
|
||||
& b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,a3_box,&
|
||||
& b1_box,b2_box,b3_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,a3_gauss,&
|
||||
& b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tpgen = psb_wtime() - t1
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pde3d'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("PDE Coefficients : ",a)')pdecoeff
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("Overall matrix creation time : ",es12.5)')tpgen
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'(" ")')
|
||||
!
|
||||
! initialize the preconditioner
|
||||
!
|
||||
call prec%init(ctxt,p_choice%ptype,info)
|
||||
select case(trim(psb_toupper(p_choice%ptype)))
|
||||
case ('NONE','NOPREC')
|
||||
! Do nothing, keep defaults
|
||||
|
||||
case ('JACOBI','L1-JACOBI','GS','FWGS','FBGS')
|
||||
! 1-level sweeps from "outer_sweeps"
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
|
||||
case ('BJAC','POLY')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case('AS')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case ('ML')
|
||||
! multilevel preconditioner
|
||||
|
||||
call prec%set('ml_cycle', p_choice%mlcycle, info)
|
||||
call prec%set('outer_sweeps', p_choice%outer_sweeps,info)
|
||||
if (p_choice%csizepp>0)&
|
||||
& call prec%set('min_coarse_size_per_process', p_choice%csizepp, info)
|
||||
call amg_set_do_remap(p_choice%remap)
|
||||
if (p_choice%mncrratio>1)&
|
||||
& call prec%set('min_cr_ratio', p_choice%mncrratio, info)
|
||||
if (p_choice%maxlevs>0)&
|
||||
& call prec%set('max_levs', p_choice%maxlevs, info)
|
||||
if (p_choice%athres >= dzero) &
|
||||
& call prec%set('aggr_thresh', p_choice%athres, info)
|
||||
if (p_choice%thrvsz>0) then
|
||||
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
|
||||
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
|
||||
end do
|
||||
end if
|
||||
|
||||
call prec%set('aggr_prol', p_choice%aggr_prol, info)
|
||||
call prec%set('par_aggr_alg', p_choice%par_aggr_alg, info)
|
||||
call prec%set('aggr_type', p_choice%aggr_type, info)
|
||||
call prec%set('aggr_size', p_choice%aggr_size, info)
|
||||
|
||||
call prec%set('aggr_ord', p_choice%aggr_ord, info)
|
||||
call prec%set('aggr_filter', p_choice%aggr_filter,info)
|
||||
|
||||
|
||||
call prec%set('smoother_type', p_choice%smther, info)
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (p_choice%prhovalue > dzero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue, info)
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant, info)
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
select case(trim(psb_toupper(p_choice%solve)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
|
||||
if (psb_toupper(p_choice%smther2) /= 'NONE') then
|
||||
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
|
||||
call prec%set('poly_degree', p_choice%degree2, info,pos='post')
|
||||
call prec%set('poly_variant', p_choice%pvariant2, info,pos='post')
|
||||
if (p_choice%prhovalue > dzero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue2, info,pos='post')
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant2, info,pos='post')
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther2))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
select case(trim(psb_toupper(p_choice%solve2)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
end if
|
||||
|
||||
call prec%set('coarse_solve', p_choice%csolve, info)
|
||||
call prec%set('coarse_mat', p_choice%cmat, info)
|
||||
! Set for the case of a KRM solver
|
||||
if (psb_toupper(p_choice%csolve) == 'KRM') then
|
||||
call prec%set('krm_method', p_choice%krm_method, info)
|
||||
call prec%set('krm_kprec', p_choice%krm_prec, info)
|
||||
call prec%set('krm_sub_solve', p_choice%krm_subsolve, info)
|
||||
call prec%set('krm_global', p_choice%krm_global, info)
|
||||
call prec%set('krm_eps', p_choice%krm_eps, info)
|
||||
call prec%set('krm_irst', p_choice%krm_irst, info)
|
||||
call prec%set('krm_istopc', p_choice%krm_istop, info)
|
||||
call prec%set('krm_itmax', p_choice%krm_itmax, info)
|
||||
call prec%set('krm_itrace', p_choice%krm_itrace, info)
|
||||
call prec%set('krm_fillin', p_choice%krm_fillin, info)
|
||||
else
|
||||
if (psb_toupper(p_choice%csolve) == 'BJAC') &
|
||||
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
|
||||
call prec%set('coarse_fillin', p_choice%cfill, info)
|
||||
call prec%set('coarse_iluthrs', p_choice%cthres, info)
|
||||
call prec%set('coarse_sweeps', p_choice%cjswp, info)
|
||||
end if
|
||||
end select
|
||||
|
||||
! build the preconditioner
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%hierarchy_build(a,desc_a,info)
|
||||
thier = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_hierarchy_bld')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tsmth = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_amx(ctxt, thier)
|
||||
call psb_amx(ctxt, tprec)
|
||||
|
||||
if(iam == psb_root_) then
|
||||
write(psb_out_unit,'(" ")')
|
||||
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
|
||||
write(psb_out_unit,'(" ")')
|
||||
end if
|
||||
|
||||
if (p_choice%dump) then
|
||||
call prec%dump(info,istart=p_choice%dlmin,iend=p_choice%dlmax,&
|
||||
& ac=p_choice%dump_ac,rp=p_choice%dump_rp,tprol=p_choice%dump_tprol,&
|
||||
& smoother=p_choice%dump_smoother, solver=p_choice%dump_solver, &
|
||||
& global_num=p_choice%dump_global_num)
|
||||
end if
|
||||
!
|
||||
! iterative method parameters
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
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)
|
||||
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)
|
||||
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
|
||||
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='solver routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tslv = psb_wtime() - t1
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
! compute residual norms
|
||||
call psb_geall(r,desc_a,info)
|
||||
call r%zero()
|
||||
call psb_geasb(r,desc_a,info)
|
||||
call psb_geaxpby(done,b,dzero,r,desc_a,info)
|
||||
call psb_spmm(-done,a,x,done,r,desc_a,info)
|
||||
resmx = psb_genrm2(r,desc_a,info)
|
||||
resmxp = psb_geamax(r,desc_a,info)
|
||||
|
||||
vecsize = x%sizeof()
|
||||
amatsize = a%sizeof()
|
||||
descsize = desc_a%sizeof()
|
||||
precsize = prec%sizeof()
|
||||
system_size = desc_a%get_global_rows()
|
||||
call psb_sum(ctxt,vecsize)
|
||||
call psb_sum(ctxt,amatsize)
|
||||
call psb_sum(ctxt,descsize)
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Discretization domain size : ",i12)') idim
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Problem setup time : ",es12.5)') tpgen
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tsmth
|
||||
write(psb_out_unit,'("Total preconditioner setup time : ",es12.5)') tsmth+thier
|
||||
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
|
||||
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
|
||||
write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
|
||||
write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
|
||||
write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
|
||||
write(psb_out_unit,'("Total memory occupation for X : ",i16)') vecsize
|
||||
write(psb_out_unit,'("Total memory occupation for A : ",i16)') amatsize
|
||||
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i16)') descsize
|
||||
write(psb_out_unit,'("Total memory occupation for PREC : ",i16)') precsize
|
||||
write(psb_out_unit,'("Total memory occupation : ",i16)') &
|
||||
& amatsize + descsize+precsize+2*vecsize
|
||||
write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
! call psb_print_timers(ctxt)
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
call psb_gefree(b,desc_a,info)
|
||||
call psb_gefree(x,desc_a,info)
|
||||
call psb_spfree(a,desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='free routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
|
||||
9999 continue
|
||||
call psb_error(ctxt)
|
||||
|
||||
contains
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
subroutine get_parms(ctxt,afmt,idim,solve,prec,pdecoeff)
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: idim
|
||||
character(len=*) :: afmt
|
||||
type(solverdata) :: solve
|
||||
type(precdata) :: prec
|
||||
character(len=*) :: pdecoeff
|
||||
integer(psb_ipk_) :: iam, nm, np, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (iam == psb_root_) then
|
||||
if (command_argument_count()>0) then
|
||||
call get_command_argument(1,filename)
|
||||
inp_unit = 30
|
||||
open(inp_unit,file=filename,action='read',iostat=info)
|
||||
if (info /= 0) then
|
||||
write(psb_err_unit,*) 'Could not open file ',filename,' for input'
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
else
|
||||
write(psb_err_unit,*) 'Opened file ',trim(filename),' for input'
|
||||
end if
|
||||
else
|
||||
write(psb_err_unit,*) 'Usage: amg_d_pde3d ctrl-file '
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
end if
|
||||
! read input data
|
||||
!
|
||||
call read_data(afmt,inp_unit) ! matrix storage format
|
||||
call read_data(idim,inp_unit) ! Discretization grid size
|
||||
call read_data(pdecoeff,inp_unit) ! PDE Coefficients
|
||||
! Krylov solver data
|
||||
call read_data(solve%kmethd,inp_unit) ! Krylov solver
|
||||
call read_data(solve%istopc,inp_unit) ! stopping criterion
|
||||
call read_data(solve%itmax,inp_unit) ! max num iterations
|
||||
call read_data(solve%itrace,inp_unit) ! tracing
|
||||
call read_data(solve%irst,inp_unit) ! restart
|
||||
call read_data(solve%eps,inp_unit) ! tolerance
|
||||
! preconditioner type
|
||||
call read_data(prec%descr,inp_unit) ! verbose description of the prec
|
||||
call read_data(prec%ptype,inp_unit) ! preconditioner type
|
||||
|
||||
! First smoother / 1-lev preconditioner
|
||||
call read_data(prec%smther,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%degree,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%pvariant,inp_unit) !
|
||||
call read_data(prec%prhovariant,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr,inp_unit) ! threshold for ILUT
|
||||
! Second smoother/ AMG post-smoother (if NONE ignored in main)
|
||||
call read_data(prec%smther2,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%degree2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%pvariant2,inp_unit) !
|
||||
call read_data(prec%prhovariant2,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue2,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr2,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr2,inp_unit) ! threshold for ILUT
|
||||
! general AMG data
|
||||
call read_data(prec%mlcycle,inp_unit) ! AMG cycle type
|
||||
call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps
|
||||
call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec
|
||||
call read_data(prec%csizepp,inp_unit) ! min size coarsest mat
|
||||
call read_data(prec%remap,inp_unit) ! min size coarsest mat
|
||||
! aggregation
|
||||
call read_data(prec%aggr_prol,inp_unit) ! aggregation type
|
||||
call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg
|
||||
call read_data(prec%aggr_type,inp_unit) ! type of aggregation
|
||||
call read_data(prec%aggr_size,inp_unit) ! Requested size of the aggregates for MATCHBOXP
|
||||
call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%aggr_filter,inp_unit) ! filtering
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector
|
||||
if (prec%thrvsz > 0) then
|
||||
call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call read_data(prec%athresv,inp_unit) ! aggr thresh vector
|
||||
else
|
||||
read(inp_unit,*) ! dummy read to skip a record
|
||||
end if
|
||||
! coasest-level solver
|
||||
call read_data(prec%csolve,inp_unit) ! coarsest-lev solver
|
||||
call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver
|
||||
call read_data(prec%cmat,inp_unit) ! coarsest mat layout
|
||||
call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU
|
||||
call read_data(prec%cthres,inp_unit) ! Threshold for ILUT
|
||||
call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver
|
||||
! Krylov method for coarsest level
|
||||
call read_data(prec%krm_method,inp_unit) ! Krylov method for coarsest level
|
||||
call read_data(prec%krm_prec,inp_unit) ! Preconditioner for coarsest level
|
||||
call read_data(prec%krm_subsolve,inp_unit) ! Subsolver for coarsest level
|
||||
call read_data(prec%krm_global,inp_unit) ! Is the solver global or local? TRUE or FALSE
|
||||
call read_data(prec%krm_eps,inp_unit) ! Stopping tolerance
|
||||
call read_data(prec%krm_irst,inp_unit) ! Restart for Krylov method
|
||||
call read_data(prec%krm_istop,inp_unit) ! Stopping criterion
|
||||
call read_data(prec%krm_itmax,inp_unit) ! Maximum number of iterations
|
||||
call read_data(prec%krm_itrace,inp_unit) ! Trace of the lower Krylov iterations
|
||||
call read_data(prec%krm_fillin,inp_unit) ! Fill-in for incomplete LU factorization
|
||||
! dump
|
||||
call read_data(prec%dump,inp_unit) ! Dump on file?
|
||||
call read_data(prec%dlmin,inp_unit) ! Minimum level to dump
|
||||
call read_data(prec%dlmax,inp_unit) ! Maximum level to dump
|
||||
call read_data(prec%dump_ac,inp_unit)
|
||||
call read_data(prec%dump_rp,inp_unit)
|
||||
call read_data(prec%dump_tprol,inp_unit)
|
||||
call read_data(prec%dump_smoother,inp_unit)
|
||||
call read_data(prec%dump_solver,inp_unit)
|
||||
call read_data(prec%dump_global_num,inp_unit)
|
||||
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
end if
|
||||
|
||||
call psb_bcast(ctxt,afmt)
|
||||
call psb_bcast(ctxt,idim)
|
||||
call psb_bcast(ctxt,pdecoeff)
|
||||
|
||||
call psb_bcast(ctxt,solve%kmethd)
|
||||
call psb_bcast(ctxt,solve%istopc)
|
||||
call psb_bcast(ctxt,solve%itmax)
|
||||
call psb_bcast(ctxt,solve%itrace)
|
||||
call psb_bcast(ctxt,solve%irst)
|
||||
call psb_bcast(ctxt,solve%eps)
|
||||
|
||||
call psb_bcast(ctxt,prec%descr)
|
||||
call psb_bcast(ctxt,prec%ptype)
|
||||
|
||||
! broadcast first (pre-)smoother / 1-lev prec data
|
||||
call psb_bcast(ctxt,prec%smther)
|
||||
call psb_bcast(ctxt,prec%jsweeps)
|
||||
call psb_bcast(ctxt,prec%degree)
|
||||
call psb_bcast(ctxt,prec%pvariant)
|
||||
call psb_bcast(ctxt,prec%prhovariant)
|
||||
call psb_bcast(ctxt,prec%prhovalue)
|
||||
call psb_bcast(ctxt,prec%novr)
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
call psb_bcast(ctxt,prec%thr)
|
||||
! broadcast second (post-)smoother
|
||||
call psb_bcast(ctxt,prec%smther2)
|
||||
call psb_bcast(ctxt,prec%jsweeps2)
|
||||
call psb_bcast(ctxt,prec%degree2)
|
||||
call psb_bcast(ctxt,prec%pvariant2)
|
||||
call psb_bcast(ctxt,prec%prhovariant2)
|
||||
call psb_bcast(ctxt,prec%prhovalue2)
|
||||
call psb_bcast(ctxt,prec%novr2)
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
call psb_bcast(ctxt,prec%thr2)
|
||||
|
||||
! broadcast AMG parameters
|
||||
call psb_bcast(ctxt,prec%mlcycle)
|
||||
call psb_bcast(ctxt,prec%outer_sweeps)
|
||||
call psb_bcast(ctxt,prec%maxlevs)
|
||||
call psb_bcast(ctxt,prec%csizepp)
|
||||
call psb_bcast(ctxt,prec%remap)
|
||||
|
||||
call psb_bcast(ctxt,prec%aggr_prol)
|
||||
call psb_bcast(ctxt,prec%par_aggr_alg)
|
||||
call psb_bcast(ctxt,prec%aggr_type)
|
||||
call psb_bcast(ctxt,prec%aggr_size)
|
||||
call psb_bcast(ctxt,prec%aggr_ord)
|
||||
call psb_bcast(ctxt,prec%aggr_filter)
|
||||
call psb_bcast(ctxt,prec%mncrratio)
|
||||
call psb_bcast(ctxt,prec%thrvsz)
|
||||
if (prec%thrvsz > 0) then
|
||||
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call psb_bcast(ctxt,prec%athresv)
|
||||
end if
|
||||
call psb_bcast(ctxt,prec%athres)
|
||||
|
||||
call psb_bcast(ctxt,prec%cmat)
|
||||
call psb_bcast(ctxt,prec%csolve)
|
||||
call psb_bcast(ctxt,prec%csbsolve)
|
||||
call psb_bcast(ctxt,prec%cfill)
|
||||
call psb_bcast(ctxt,prec%cthres)
|
||||
call psb_bcast(ctxt,prec%cjswp)
|
||||
! Krylov method for coarsest level (broadcast)
|
||||
call psb_bcast(ctxt,prec%krm_method)
|
||||
call psb_bcast(ctxt,prec%krm_prec)
|
||||
call psb_bcast(ctxt,prec%krm_subsolve)
|
||||
call psb_bcast(ctxt,prec%krm_global)
|
||||
call psb_bcast(ctxt,prec%krm_eps)
|
||||
call psb_bcast(ctxt,prec%krm_irst)
|
||||
call psb_bcast(ctxt,prec%krm_istop)
|
||||
call psb_bcast(ctxt,prec%krm_itmax)
|
||||
call psb_bcast(ctxt,prec%krm_itrace)
|
||||
call psb_bcast(ctxt,prec%krm_fillin)
|
||||
! dump
|
||||
call psb_bcast(ctxt,prec%dump)
|
||||
call psb_bcast(ctxt,prec%dlmin)
|
||||
call psb_bcast(ctxt,prec%dlmax)
|
||||
|
||||
call psb_bcast(ctxt,prec%dump_ac)
|
||||
call psb_bcast(ctxt,prec%dump_rp)
|
||||
call psb_bcast(ctxt,prec%dump_tprol)
|
||||
call psb_bcast(ctxt,prec%dump_smoother)
|
||||
call psb_bcast(ctxt,prec%dump_solver)
|
||||
call psb_bcast(ctxt,prec%dump_global_num)
|
||||
|
||||
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
end program amg_d_pde3d
|
||||
@ -0,0 +1,662 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: amg_d_pde3d.f90
|
||||
!
|
||||
! Program: amg_d_pde3d
|
||||
! This sample program solves a linear system obtained by discretizing a
|
||||
! PDE with Dirichlet BCs.
|
||||
!
|
||||
!
|
||||
! The PDE is a general second order equation in 3d
|
||||
!
|
||||
! a1 dd(u) a2 dd(u) a3 dd(u) b1 d(u) b2 d(u) b3 d(u)
|
||||
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
||||
! dxdx dydy dzdz dx dy dz
|
||||
!
|
||||
! with Dirichlet boundary conditions
|
||||
! u = g
|
||||
!
|
||||
! on the unit cube 0<=x,y,z<=1.
|
||||
!
|
||||
!
|
||||
! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation.
|
||||
!
|
||||
! There are three choices available for data distribution:
|
||||
! 1. A simple BLOCK distribution
|
||||
! 2. A ditribution based on arbitrary assignment of indices to processes,
|
||||
! typically from a graph partitioner
|
||||
! 3. A 3D distribution in which the unit cube is partitioned
|
||||
! into subcubes, each one assigned to a process.
|
||||
!
|
||||
program amg_d_pde3d
|
||||
use psb_base_mod
|
||||
use amg_prec_mod
|
||||
use psb_krylov_mod
|
||||
use psb_util_mod
|
||||
use data_input
|
||||
use amg_d_pde3d_base_mod
|
||||
use amg_d_pde3d_exp_mod
|
||||
use amg_d_pde3d_gauss_mod
|
||||
use amg_d_genpde_mod
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
character(len=20) :: kmethd, ptype
|
||||
character(len=5) :: afmt, pdecoeff
|
||||
integer(psb_ipk_) :: idim
|
||||
integer(psb_epk_) :: system_size
|
||||
|
||||
! miscellaneous
|
||||
real(psb_dpk_) :: t1, t2, tprec, thier, tslv
|
||||
|
||||
! sparse matrix and preconditioner
|
||||
type(psb_dspmat_type) :: a
|
||||
type(amg_dprec_type) :: prec
|
||||
! descriptor
|
||||
type(psb_desc_type) :: desc_a
|
||||
! dense vectors
|
||||
type(psb_d_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
integer(psb_epk_) :: amatsize, precsize, descsize
|
||||
real(psb_dpk_) :: err, resmx, resmxp
|
||||
|
||||
! Krylov solver data
|
||||
type solverdata
|
||||
character(len=40) :: kmethd ! Krylov solver
|
||||
integer(psb_ipk_) :: istopc ! stopping criterion
|
||||
integer(psb_ipk_) :: itmax ! maximum number of iterations
|
||||
integer(psb_ipk_) :: itrace ! tracing
|
||||
integer(psb_ipk_) :: irst ! restart
|
||||
real(psb_dpk_) :: eps ! stopping tolerance
|
||||
end type solverdata
|
||||
type(solverdata) :: s_choice
|
||||
|
||||
! preconditioner data
|
||||
type precdata
|
||||
|
||||
! preconditioner type
|
||||
character(len=40) :: descr ! verbose description of the prec
|
||||
character(len=10) :: ptype ! preconditioner type
|
||||
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=16) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=16) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=16) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=16) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=16) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=16) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_dpk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_dpk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_dpk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=16) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=16) :: restr ! restriction over application of AS
|
||||
character(len=16) :: prol ! prolongation over application of AS
|
||||
character(len=16) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=16) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=16) :: restr2 ! restriction over application of AS
|
||||
character(len=16) :: prol2 ! prolongation over application of AS
|
||||
character(len=16) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
character(len=16) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=16) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=16) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=16) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
|
||||
end type precdata
|
||||
type(precdata) :: p_choice
|
||||
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
logical, parameter :: dump=.true.
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
endif
|
||||
if(psb_get_errstatus() /= 0) goto 9999
|
||||
name='amg_d_pde3d'
|
||||
call psb_set_errverbosity(itwo)
|
||||
!
|
||||
! Hello world
|
||||
!
|
||||
if (iam == psb_root_) then
|
||||
write(*,*) 'Welcome to AMG4PSBLAS version: ',amg_version_string_
|
||||
write(*,*) 'This is the ',trim(name),' sample program'
|
||||
end if
|
||||
|
||||
!
|
||||
! get parameters
|
||||
!
|
||||
call get_parms(ctxt,afmt,idim,s_choice,p_choice,pdecoeff)
|
||||
|
||||
!
|
||||
! allocate and fill in the coefficient matrix, rhs and initial guess
|
||||
!
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("CONST")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1,a2,a3,b1,b2,b3,c,g,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,a3_exp,b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,a3_gauss,b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
t2 = psb_wtime() - t1
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pde3d'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("PDE Coefficients : ",a)')pdecoeff
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("Overall matrix creation time : ",es12.5)')t2
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'(" ")')
|
||||
!
|
||||
! initialize the preconditioner
|
||||
!
|
||||
call prec%init(ctxt,p_choice%ptype,info)
|
||||
select case(trim(psb_toupper(p_choice%ptype)))
|
||||
case ('NONE','NOPREC')
|
||||
! Do nothing, keep defaults
|
||||
|
||||
case ('JACOBI','L1-JACOBI','GS','FWGS','FBGS')
|
||||
! 1-level sweeps from "outer_sweeps"
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
|
||||
case ('BJAC')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case('AS')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case ('ML')
|
||||
! multilevel preconditioner
|
||||
|
||||
call prec%set('ml_cycle', p_choice%mlcycle, info)
|
||||
call prec%set('outer_sweeps', p_choice%outer_sweeps,info)
|
||||
if (p_choice%csizepp>0)&
|
||||
& call prec%set('min_coarse_size_per_process', p_choice%csizepp, info)
|
||||
if (p_choice%mncrratio>1)&
|
||||
& call prec%set('min_cr_ratio', p_choice%mncrratio, info)
|
||||
if (p_choice%maxlevs>0)&
|
||||
& call prec%set('max_levs', p_choice%maxlevs, info)
|
||||
if (p_choice%athres >= dzero) &
|
||||
& call prec%set('aggr_thresh', p_choice%athres, info)
|
||||
if (p_choice%thrvsz>0) then
|
||||
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
|
||||
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
|
||||
end do
|
||||
end if
|
||||
|
||||
call prec%set('aggr_prol', p_choice%aggr_prol, info)
|
||||
call prec%set('par_aggr_alg', p_choice%par_aggr_alg, info)
|
||||
call prec%set('aggr_type', p_choice%aggr_type, info)
|
||||
call prec%set('aggr_size', p_choice%aggr_size, info)
|
||||
|
||||
call prec%set('aggr_ord', p_choice%aggr_ord, info)
|
||||
call prec%set('aggr_filter', p_choice%aggr_filter,info)
|
||||
|
||||
|
||||
call prec%set('smoother_type', p_choice%smther, info)
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
|
||||
select case (psb_toupper(p_choice%smther))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
select case(trim(psb_toupper(p_choice%solve)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
end select
|
||||
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
|
||||
if (psb_toupper(p_choice%smther2) /= 'NONE') then
|
||||
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
|
||||
select case (psb_toupper(p_choice%smther2))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
select case(trim(psb_toupper(p_choice%solve2)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
end select
|
||||
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
end if
|
||||
|
||||
call prec%set('coarse_solve', p_choice%csolve, info)
|
||||
if (psb_toupper(p_choice%csolve) == 'BJAC') &
|
||||
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
|
||||
call prec%set('coarse_mat', p_choice%cmat, info)
|
||||
call prec%set('coarse_fillin', p_choice%cfill, info)
|
||||
call prec%set('coarse_iluthrs', p_choice%cthres, info)
|
||||
call prec%set('coarse_sweeps', p_choice%cjswp, info)
|
||||
|
||||
end select
|
||||
|
||||
! build the preconditioner
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%hierarchy_build(a,desc_a,info)
|
||||
thier = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_hierarchy_bld')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tprec = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_amx(ctxt, thier)
|
||||
call psb_amx(ctxt, tprec)
|
||||
|
||||
if(iam == psb_root_) then
|
||||
write(psb_out_unit,'(" ")')
|
||||
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
|
||||
write(psb_out_unit,'(" ")')
|
||||
end if
|
||||
if (dump) then
|
||||
call prec%dump(info,istart=1,ac=.true.,rp=.true.)
|
||||
end if
|
||||
!
|
||||
! iterative method parameters
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
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)
|
||||
call psb_barrier(ctxt)
|
||||
tslv = psb_wtime() - t1
|
||||
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='solver routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tslv = psb_wtime() - t1
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
! compute residual norms
|
||||
call psb_geall(r,desc_a,info)
|
||||
call r%zero()
|
||||
call psb_geasb(r,desc_a,info)
|
||||
call psb_geaxpby(done,b,dzero,r,desc_a,info)
|
||||
call psb_spmm(-done,a,x,done,r,desc_a,info)
|
||||
resmx = psb_genrm2(r,desc_a,info)
|
||||
resmxp = psb_geamax(r,desc_a,info)
|
||||
|
||||
amatsize = a%sizeof()
|
||||
descsize = desc_a%sizeof()
|
||||
precsize = prec%sizeof()
|
||||
system_size = desc_a%get_global_rows()
|
||||
call psb_sum(ctxt,amatsize)
|
||||
call psb_sum(ctxt,descsize)
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," processors")') np
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tprec
|
||||
write(psb_out_unit,'("Total time for preconditioner : ",es12.5)') tprec+thier
|
||||
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
|
||||
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
|
||||
write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
|
||||
write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
|
||||
write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
|
||||
write(psb_out_unit,'("Total memory occupation for A : ",i12)') amatsize
|
||||
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i12)') descsize
|
||||
write(psb_out_unit,'("Total memory occupation for PREC : ",i12)') precsize
|
||||
write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
call psb_gefree(b,desc_a,info)
|
||||
call psb_gefree(x,desc_a,info)
|
||||
call psb_spfree(a,desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='free routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
|
||||
9999 continue
|
||||
call psb_error(ctxt)
|
||||
|
||||
contains
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
subroutine get_parms(ctxt,afmt,idim,solve,prec,pdecoeff)
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: idim
|
||||
character(len=*) :: afmt
|
||||
type(solverdata) :: solve
|
||||
type(precdata) :: prec
|
||||
character(len=*) :: pdecoeff
|
||||
integer(psb_ipk_) :: iam, nm, np, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (iam == psb_root_) then
|
||||
if (command_argument_count()>0) then
|
||||
call get_command_argument(1,filename)
|
||||
inp_unit = 30
|
||||
open(inp_unit,file=filename,action='read',iostat=info)
|
||||
if (info /= 0) then
|
||||
write(psb_err_unit,*) 'Could not open file ',filename,' for input'
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
else
|
||||
write(psb_err_unit,*) 'Opened file ',trim(filename),' for input'
|
||||
end if
|
||||
else
|
||||
inp_unit=psb_inp_unit
|
||||
end if
|
||||
! read input data
|
||||
!
|
||||
call read_data(afmt,inp_unit) ! matrix storage format
|
||||
call read_data(idim,inp_unit) ! Discretization grid size
|
||||
call read_data(pdecoeff,inp_unit) ! PDE Coefficients
|
||||
! Krylov solver data
|
||||
call read_data(solve%kmethd,inp_unit) ! Krylov solver
|
||||
call read_data(solve%istopc,inp_unit) ! stopping criterion
|
||||
call read_data(solve%itmax,inp_unit) ! max num iterations
|
||||
call read_data(solve%itrace,inp_unit) ! tracing
|
||||
call read_data(solve%irst,inp_unit) ! restart
|
||||
call read_data(solve%eps,inp_unit) ! tolerance
|
||||
! preconditioner type
|
||||
call read_data(prec%descr,inp_unit) ! verbose description of the prec
|
||||
call read_data(prec%ptype,inp_unit) ! preconditioner type
|
||||
! First smoother / 1-lev preconditioner
|
||||
call read_data(prec%smther,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%novr,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr,inp_unit) ! threshold for ILUT
|
||||
! Second smoother/ AMG post-smoother (if NONE ignored in main)
|
||||
call read_data(prec%smther2,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%novr2,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr2,inp_unit) ! threshold for ILUT
|
||||
! general AMG data
|
||||
call read_data(prec%mlcycle,inp_unit) ! AMG cycle type
|
||||
call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps
|
||||
call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec
|
||||
call read_data(prec%csizepp,inp_unit) ! min size coarsest mat
|
||||
! aggregation
|
||||
call read_data(prec%aggr_prol,inp_unit) ! aggregation type
|
||||
call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg
|
||||
call read_data(prec%aggr_type,inp_unit) ! type of aggregation
|
||||
call read_data(prec%aggr_size,inp_unit) ! Requested size of the aggregates for MATCHBOXP
|
||||
call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation
|
||||
call read_data(prec%aggr_filter,inp_unit) ! filtering
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector
|
||||
if (prec%thrvsz > 0) then
|
||||
call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call read_data(prec%athresv,inp_unit) ! aggr thresh vector
|
||||
else
|
||||
read(inp_unit,*) ! dummy read to skip a record
|
||||
end if
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
! coasest-level solver
|
||||
call read_data(prec%csolve,inp_unit) ! coarsest-lev solver
|
||||
call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver
|
||||
call read_data(prec%cmat,inp_unit) ! coarsest mat layout
|
||||
call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU
|
||||
call read_data(prec%cthres,inp_unit) ! Threshold for ILUT
|
||||
call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
end if
|
||||
|
||||
call psb_bcast(ctxt,afmt)
|
||||
call psb_bcast(ctxt,idim)
|
||||
call psb_bcast(ctxt,pdecoeff)
|
||||
|
||||
call psb_bcast(ctxt,solve%kmethd)
|
||||
call psb_bcast(ctxt,solve%istopc)
|
||||
call psb_bcast(ctxt,solve%itmax)
|
||||
call psb_bcast(ctxt,solve%itrace)
|
||||
call psb_bcast(ctxt,solve%irst)
|
||||
call psb_bcast(ctxt,solve%eps)
|
||||
|
||||
call psb_bcast(ctxt,prec%descr)
|
||||
call psb_bcast(ctxt,prec%ptype)
|
||||
|
||||
! broadcast first (pre-)smoother / 1-lev prec data
|
||||
call psb_bcast(ctxt,prec%smther)
|
||||
call psb_bcast(ctxt,prec%jsweeps)
|
||||
call psb_bcast(ctxt,prec%novr)
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
call psb_bcast(ctxt,prec%thr)
|
||||
! broadcast second (post-)smoother
|
||||
call psb_bcast(ctxt,prec%smther2)
|
||||
call psb_bcast(ctxt,prec%jsweeps2)
|
||||
call psb_bcast(ctxt,prec%novr2)
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
call psb_bcast(ctxt,prec%thr2)
|
||||
|
||||
! broadcast AMG parameters
|
||||
call psb_bcast(ctxt,prec%mlcycle)
|
||||
call psb_bcast(ctxt,prec%outer_sweeps)
|
||||
call psb_bcast(ctxt,prec%maxlevs)
|
||||
call psb_bcast(ctxt,prec%csizepp)
|
||||
|
||||
call psb_bcast(ctxt,prec%aggr_prol)
|
||||
call psb_bcast(ctxt,prec%par_aggr_alg)
|
||||
call psb_bcast(ctxt,prec%aggr_type)
|
||||
call psb_bcast(ctxt,prec%aggr_size)
|
||||
call psb_bcast(ctxt,prec%aggr_ord)
|
||||
call psb_bcast(ctxt,prec%aggr_filter)
|
||||
call psb_bcast(ctxt,prec%mncrratio)
|
||||
call psb_bcast(ctxt,prec%thrvsz)
|
||||
if (prec%thrvsz > 0) then
|
||||
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call psb_bcast(ctxt,prec%athresv)
|
||||
end if
|
||||
call psb_bcast(ctxt,prec%athres)
|
||||
|
||||
call psb_bcast(ctxt,prec%cmat)
|
||||
call psb_bcast(ctxt,prec%csolve)
|
||||
call psb_bcast(ctxt,prec%csbsolve)
|
||||
call psb_bcast(ctxt,prec%cfill)
|
||||
call psb_bcast(ctxt,prec%cthres)
|
||||
call psb_bcast(ctxt,prec%cjswp)
|
||||
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
end program amg_d_pde3d
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_box_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_box(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_box=done/sqrt(3.0_psb_dpk_)
|
||||
end function b1_box
|
||||
function b2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_box=done/sqrt(3.0_psb_dpk_)
|
||||
end function b2_box
|
||||
function b3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_box=done/sqrt(3.0_psb_dpk_)
|
||||
end function b3_box
|
||||
function c_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c_box=dzero
|
||||
end function c_box
|
||||
function a1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_box=epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_box=epsilon
|
||||
end function a2_box
|
||||
function a3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_box=epsilon
|
||||
end function a3_box
|
||||
function g_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_box
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_box= dzero
|
||||
if (x == done) then
|
||||
g_box = done
|
||||
else if (x == dzero) then
|
||||
g_box = done
|
||||
end if
|
||||
end function g_box
|
||||
end module amg_d_pde3d_box_mod
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_exp_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/160
|
||||
contains
|
||||
subroutine pde_set_parm3d_exp(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_exp=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b1_exp
|
||||
function b2_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_exp=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b2_exp
|
||||
function b3_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_exp=dzero/sqrt(3.0_psb_dpk_)
|
||||
end function b3_exp
|
||||
function c_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c_exp=dzero
|
||||
end function c_exp
|
||||
function a1_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_exp=epsilon*exp(-(x+y+z))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_exp=epsilon*exp(-(x+y+z))
|
||||
end function a2_exp
|
||||
function a3_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_exp=epsilon*exp(-(x+y+z))
|
||||
end function a3_exp
|
||||
function g_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_exp
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_exp = dzero
|
||||
if (x == done) then
|
||||
g_exp = done
|
||||
else if (x == dzero) then
|
||||
g_exp = done
|
||||
end if
|
||||
end function g_exp
|
||||
end module amg_d_pde3d_exp_mod
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_gauss_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_gauss(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_gauss=done/sqrt(3.0_psb_dpk_)-2*x*exp(-(x**2+y**2+z**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_gauss=done/sqrt(3.0_psb_dpk_)-2*y*exp(-(x**2+y**2+z**2))
|
||||
end function b2_gauss
|
||||
function b3_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_gauss=done/sqrt(3.0_psb_dpk_)-2*z*exp(-(x**2+y**2+z**2))
|
||||
end function b3_gauss
|
||||
function c_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c_gauss=dzero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a2_gauss
|
||||
function a3_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a3_gauss
|
||||
function g_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_gauss
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_gauss = dzero
|
||||
if (x == done) then
|
||||
g_gauss = done
|
||||
else if (x == dzero) then
|
||||
g_gauss = done
|
||||
end if
|
||||
end function g_gauss
|
||||
end module amg_d_pde3d_gauss_mod
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_d_pde3d_poisson_mod
|
||||
use psb_base_mod, only : psb_dpk_, done, dzero
|
||||
real(psb_dpk_), save, private :: epsilon=done/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_poisson(dat)
|
||||
real(psb_dpk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_poisson
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b1_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b1_poisson=dzero
|
||||
end function b1_poisson
|
||||
function b2_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b2_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b2_poisson=dzero
|
||||
end function b2_poisson
|
||||
function b3_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: b3_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
b3_poisson=dzero
|
||||
end function b3_poisson
|
||||
function c_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: c_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
c_poisson=dzero
|
||||
end function c_poisson
|
||||
function a1_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a1_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a1_poisson=epsilon
|
||||
end function a1_poisson
|
||||
function a2_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a2_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a2_poisson=epsilon
|
||||
end function a2_poisson
|
||||
function a3_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: a3_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
a3_poisson=epsilon
|
||||
end function a3_poisson
|
||||
function g_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_dpk_) :: g_poisson
|
||||
real(psb_dpk_), intent(in) :: x,y,z
|
||||
g_poisson = dzero
|
||||
if (x == done) then
|
||||
g_poisson = done
|
||||
else if (x == dzero) then
|
||||
g_poisson = done
|
||||
end if
|
||||
end function g_poisson
|
||||
end module amg_d_pde3d_poisson_mod
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,843 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
! File: amg_s_pde2d.f90
|
||||
!
|
||||
! Program: amg_s_pde2d
|
||||
! This sample program solves a linear system obtained by discretizing a
|
||||
! PDE with Dirichlet BCs.
|
||||
!
|
||||
!
|
||||
! The PDE is a general second order equation in 2d
|
||||
!
|
||||
! a1 dd(u) a2 dd(u) b1 d(u) b2 d(u)
|
||||
! - ------ - ------ ----- + ------ + c u = f
|
||||
! dxdx dydy dx dy
|
||||
!
|
||||
! with Dirichlet boundary conditions
|
||||
! u = g
|
||||
!
|
||||
! on the unit square 0<=x,y<=1.
|
||||
!
|
||||
!
|
||||
! Note that if b1=b2=c=0., the PDE is the Laplace equation.
|
||||
!
|
||||
! There are three choices available for data distribution:
|
||||
! 1. A simple BLOCK distribution
|
||||
! 2. A ditribution based on arbitrary assignment of indices to processes,
|
||||
! typically from a graph partitioner
|
||||
! 3. A 2D distribution in which the unit square is partitioned
|
||||
! into rectangles, each one assigned to a process.
|
||||
!
|
||||
program amg_s_pde2d
|
||||
use psb_base_mod
|
||||
use amg_prec_mod
|
||||
use psb_linsolve_mod
|
||||
use psb_util_mod
|
||||
use data_input
|
||||
use amg_s_pde2d_poisson_mod
|
||||
use amg_s_pde2d_exp_mod
|
||||
use amg_s_pde2d_box_mod
|
||||
use amg_s_pde2d_gauss_mod
|
||||
use amg_s_genpde_mod
|
||||
#if defined(PSB_OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
character(len=20) :: kmethd, ptype
|
||||
character(len=5) :: afmt
|
||||
character(len=32) :: pdecoeff
|
||||
integer(psb_ipk_) :: idim
|
||||
integer(psb_epk_) :: system_size
|
||||
|
||||
! miscellaneous
|
||||
real(psb_dpk_) :: t1, t2, tprec, thier, tslv, tsmth, tpgen
|
||||
|
||||
! sparse matrix and preconditioner
|
||||
type(psb_sspmat_type) :: a
|
||||
type(amg_sprec_type) :: prec
|
||||
! descriptor
|
||||
type(psb_desc_type) :: desc_a
|
||||
! dense vectors
|
||||
type(psb_s_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
integer(psb_epk_) :: amatsize, precsize, descsize, vecsize
|
||||
real(psb_spk_) :: err, resmx, resmxp
|
||||
|
||||
! Solver data
|
||||
type solverdata
|
||||
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
|
||||
integer(psb_ipk_) :: irst ! restart
|
||||
real(psb_spk_) :: eps ! stopping tolerance
|
||||
end type solverdata
|
||||
type(solverdata) :: s_choice
|
||||
|
||||
! preconditioner data
|
||||
type precdata
|
||||
|
||||
! preconditioner type
|
||||
character(len=40) :: descr ! verbose description of the prec
|
||||
character(len=10) :: ptype ! preconditioner type
|
||||
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_spk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: degree ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant ! polynomial variant
|
||||
character(len=32) :: prhovariant ! how to estimate rho(M^{-1}A)
|
||||
real(psb_spk_) :: prhovalue ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: degree2 ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant2 ! polynomial variant
|
||||
character(len=32) :: prhovariant2 ! how to estimate rho(M^{-1}A)
|
||||
real(psb_spk_) :: prhovalue2 ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
! settings for the Krylov method
|
||||
character(len=16) :: krm_method ! Krylov method for coarsest level
|
||||
character(len=16) :: krm_prec ! Preconditioner for coarsest level
|
||||
character(len=16) :: krm_subsolve ! Subsolver for coarsest level
|
||||
character(len=16) :: krm_global ! Is the solver global or local? TRUE or FALSE
|
||||
real(psb_spk_) :: krm_eps ! Stopping tolerance
|
||||
integer(psb_ipk_) :: krm_irst ! Restart for Krylov method
|
||||
integer(psb_ipk_) :: krm_istop ! Stopping criterion
|
||||
integer(psb_ipk_) :: krm_itmax ! Maximum number of iterations
|
||||
integer(psb_ipk_) :: krm_itrace ! Trace of the lower Krylov iterations
|
||||
integer(psb_ipk_) :: krm_fillin ! Fill-in for incomplete LU factorization
|
||||
|
||||
! Dump data
|
||||
logical :: dump = .false.
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
logical :: dump_ac = .false.
|
||||
logical :: dump_rp = .false.
|
||||
logical :: dump_tprol = .false.
|
||||
logical :: dump_smoother = .false.
|
||||
logical :: dump_solver = .false.
|
||||
logical :: dump_global_num = .false.
|
||||
|
||||
end type precdata
|
||||
type(precdata) :: p_choice
|
||||
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(PSB_OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
endif
|
||||
if(psb_get_errstatus() /= 0) goto 9999
|
||||
name='amg_s_pde2d'
|
||||
call psb_set_errverbosity(itwo)
|
||||
!
|
||||
! Hello world
|
||||
!
|
||||
if (iam == psb_root_) then
|
||||
write(*,*) 'Welcome to AMG4PSBLAS version: ',amg_version_string_
|
||||
write(*,*) 'This is the ',trim(name),' sample program'
|
||||
end if
|
||||
|
||||
!
|
||||
! get parameters
|
||||
!
|
||||
call get_parms(ctxt,afmt,idim,s_choice,p_choice,pdecoeff)
|
||||
|
||||
!
|
||||
! allocate and fill in the coefficient matrix, rhs and initial guess
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("POISSON")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_poisson,a2_poisson,&
|
||||
& b1_poisson,b2_poisson,c_poisson,g_poisson,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,&
|
||||
& b1_exp,b2_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,&
|
||||
& b1_box,b2_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde2d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,&
|
||||
& b1_gauss,b2_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end select
|
||||
call psb_barrier(ctxt)
|
||||
tpgen = psb_wtime() - t1
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pde2d'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("PDE Coefficients : ",a)')pdecoeff
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("Overall matrix creation time : ",es12.5)')tpgen
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'(" ")')
|
||||
!
|
||||
! initialize the preconditioner
|
||||
!
|
||||
call prec%init(ctxt,p_choice%ptype,info)
|
||||
select case(trim(psb_toupper(p_choice%ptype)))
|
||||
case ('NONE','NOPREC')
|
||||
! Do nothing, keep defaults
|
||||
|
||||
case ('JACOBI','L1-JACOBI','GS','FWGS','FBGS')
|
||||
! 1-level sweeps from "outer_sweeps"
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
|
||||
case ('BJAC','POLY')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case('AS')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case ('ML')
|
||||
! multilevel preconditioner
|
||||
|
||||
call prec%set('ml_cycle', p_choice%mlcycle, info)
|
||||
call prec%set('outer_sweeps', p_choice%outer_sweeps,info)
|
||||
if (p_choice%csizepp>0)&
|
||||
& call prec%set('min_coarse_size_per_process', p_choice%csizepp, info)
|
||||
if (p_choice%mncrratio>1)&
|
||||
& call prec%set('min_cr_ratio', p_choice%mncrratio, info)
|
||||
if (p_choice%maxlevs>0)&
|
||||
& call prec%set('max_levs', p_choice%maxlevs, info)
|
||||
if (p_choice%athres >= dzero) &
|
||||
& call prec%set('aggr_thresh', p_choice%athres, info)
|
||||
if (p_choice%thrvsz>0) then
|
||||
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
|
||||
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
|
||||
end do
|
||||
end if
|
||||
|
||||
call prec%set('aggr_prol', p_choice%aggr_prol, info)
|
||||
call prec%set('par_aggr_alg', p_choice%par_aggr_alg, info)
|
||||
call prec%set('aggr_type', p_choice%aggr_type, info)
|
||||
call prec%set('aggr_size', p_choice%aggr_size, info)
|
||||
|
||||
call prec%set('aggr_ord', p_choice%aggr_ord, info)
|
||||
call prec%set('aggr_filter', p_choice%aggr_filter,info)
|
||||
|
||||
|
||||
call prec%set('smoother_type', p_choice%smther, info)
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (p_choice%prhovalue > szero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue, info)
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant, info)
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
select case(trim(psb_toupper(p_choice%solve)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
|
||||
if (psb_toupper(p_choice%smther2) /= 'NONE') then
|
||||
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
|
||||
call prec%set('poly_degree', p_choice%degree2, info,pos='post')
|
||||
call prec%set('poly_variant', p_choice%pvariant2, info,pos='post')
|
||||
if (p_choice%prhovalue > szero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue2, info,pos='post')
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant2, info,pos='post')
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther2))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
select case(trim(psb_toupper(p_choice%solve2)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
end if
|
||||
|
||||
call prec%set('coarse_solve', p_choice%csolve, info)
|
||||
call prec%set('coarse_mat', p_choice%cmat, info)
|
||||
! Set for the case of a KRM solver
|
||||
if (psb_toupper(p_choice%csolve) == 'KRM') then
|
||||
call prec%set('krm_method', p_choice%krm_method, info)
|
||||
call prec%set('krm_kprec', p_choice%krm_prec, info)
|
||||
call prec%set('krm_sub_solve', p_choice%krm_subsolve, info)
|
||||
call prec%set('krm_global', p_choice%krm_global, info)
|
||||
call prec%set('krm_eps', p_choice%krm_eps, info)
|
||||
call prec%set('krm_irst', p_choice%krm_irst, info)
|
||||
call prec%set('krm_istopc', p_choice%krm_istop, info)
|
||||
call prec%set('krm_itmax', p_choice%krm_itmax, info)
|
||||
call prec%set('krm_itrace', p_choice%krm_itrace, info)
|
||||
call prec%set('krm_fillin', p_choice%krm_fillin, info)
|
||||
else
|
||||
if (psb_toupper(p_choice%csolve) == 'BJAC') &
|
||||
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
|
||||
call prec%set('coarse_fillin', p_choice%cfill, info)
|
||||
call prec%set('coarse_iluthrs', p_choice%cthres, info)
|
||||
call prec%set('coarse_sweeps', p_choice%cjswp, info)
|
||||
end if
|
||||
end select
|
||||
|
||||
! build the preconditioner
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%hierarchy_build(a,desc_a,info)
|
||||
thier = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_hierarchy_bld')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tsmth = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_amx(ctxt, thier)
|
||||
call psb_amx(ctxt, tprec)
|
||||
|
||||
if(iam == psb_root_) then
|
||||
write(psb_out_unit,'(" ")')
|
||||
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
|
||||
write(psb_out_unit,'(" ")')
|
||||
end if
|
||||
|
||||
if (p_choice%dump) then
|
||||
call prec%dump(info,istart=p_choice%dlmin,iend=p_choice%dlmax,&
|
||||
& ac=p_choice%dump_ac,rp=p_choice%dump_rp,tprol=p_choice%dump_tprol,&
|
||||
& smoother=p_choice%dump_smoother, solver=p_choice%dump_solver, &
|
||||
& global_num=p_choice%dump_global_num)
|
||||
end if
|
||||
!
|
||||
! iterative method parameters
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
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)
|
||||
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)
|
||||
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
|
||||
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='solver routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tslv = psb_wtime() - t1
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
! compute residual norms
|
||||
call psb_geall(r,desc_a,info)
|
||||
call r%zero()
|
||||
call psb_geasb(r,desc_a,info)
|
||||
call psb_geaxpby(sone,b,szero,r,desc_a,info)
|
||||
call psb_spmm(-sone,a,x,sone,r,desc_a,info)
|
||||
resmx = psb_genrm2(r,desc_a,info)
|
||||
resmxp = psb_geamax(r,desc_a,info)
|
||||
|
||||
vecsize = x%sizeof()
|
||||
amatsize = a%sizeof()
|
||||
descsize = desc_a%sizeof()
|
||||
precsize = prec%sizeof()
|
||||
system_size = desc_a%get_global_rows()
|
||||
call psb_sum(ctxt,vecsize)
|
||||
call psb_sum(ctxt,amatsize)
|
||||
call psb_sum(ctxt,descsize)
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Discretization domain size : ",i12)') idim
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Problem setup time : ",es12.5)') tpgen
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tsmth
|
||||
write(psb_out_unit,'("Total preconditioner setup time : ",es12.5)') tsmth+thier
|
||||
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
|
||||
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
|
||||
write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
|
||||
write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
|
||||
write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
|
||||
write(psb_out_unit,'("Total memory occupation for X : ",i16)') vecsize
|
||||
write(psb_out_unit,'("Total memory occupation for A : ",i16)') amatsize
|
||||
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i16)') descsize
|
||||
write(psb_out_unit,'("Total memory occupation for PREC : ",i16)') precsize
|
||||
write(psb_out_unit,'("Total memory occupation : ",i16)') &
|
||||
& amatsize + descsize+precsize+2*vecsize
|
||||
write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
call psb_gefree(b,desc_a,info)
|
||||
call psb_gefree(x,desc_a,info)
|
||||
call psb_spfree(a,desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='free routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
|
||||
9999 continue
|
||||
call psb_error(ctxt)
|
||||
|
||||
contains
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
subroutine get_parms(ctxt,afmt,idim,solve,prec,pdecoeff)
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: idim
|
||||
character(len=*) :: afmt
|
||||
type(solverdata) :: solve
|
||||
type(precdata) :: prec
|
||||
character(len=*) :: pdecoeff
|
||||
integer(psb_ipk_) :: iam, nm, np, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (iam == psb_root_) then
|
||||
if (command_argument_count()>0) then
|
||||
call get_command_argument(1,filename)
|
||||
inp_unit = 30
|
||||
open(inp_unit,file=filename,action='read',iostat=info)
|
||||
if (info /= 0) then
|
||||
write(psb_err_unit,*) 'Could not open file ',filename,' for input'
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
else
|
||||
write(psb_err_unit,*) 'Opened file ',trim(filename),' for input'
|
||||
end if
|
||||
else
|
||||
write(psb_err_unit,*) 'Usage: amg_s_pde2d ctrl-file '
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
end if
|
||||
! read input data
|
||||
!
|
||||
call read_data(afmt,inp_unit) ! matrix storage format
|
||||
call read_data(idim,inp_unit) ! Discretization grid size
|
||||
call read_data(pdecoeff,inp_unit) ! PDE Coefficients
|
||||
! Krylov solver data
|
||||
call read_data(solve%kmethd,inp_unit) ! Krylov solver
|
||||
call read_data(solve%istopc,inp_unit) ! stopping criterion
|
||||
call read_data(solve%itmax,inp_unit) ! max num iterations
|
||||
call read_data(solve%itrace,inp_unit) ! tracing
|
||||
call read_data(solve%irst,inp_unit) ! restart
|
||||
call read_data(solve%eps,inp_unit) ! tolerance
|
||||
! preconditioner type
|
||||
call read_data(prec%descr,inp_unit) ! verbose description of the prec
|
||||
call read_data(prec%ptype,inp_unit) ! preconditioner type
|
||||
|
||||
! First smoother / 1-lev preconditioner
|
||||
call read_data(prec%smther,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%degree,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%pvariant,inp_unit) !
|
||||
call read_data(prec%prhovariant,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr,inp_unit) ! threshold for ILUT
|
||||
! Second smoother/ AMG post-smoother (if NONE ignored in main)
|
||||
call read_data(prec%smther2,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%degree2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%pvariant2,inp_unit) !
|
||||
call read_data(prec%prhovariant2,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue2,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr2,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr2,inp_unit) ! threshold for ILUT
|
||||
! general AMG data
|
||||
call read_data(prec%mlcycle,inp_unit) ! AMG cycle type
|
||||
call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps
|
||||
call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec
|
||||
call read_data(prec%csizepp,inp_unit) ! min size coarsest mat
|
||||
! aggregation
|
||||
call read_data(prec%aggr_prol,inp_unit) ! aggregation type
|
||||
call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg
|
||||
call read_data(prec%aggr_type,inp_unit) ! type of aggregation
|
||||
call read_data(prec%aggr_size,inp_unit) ! Requested size of the aggregates for MATCHBOXP
|
||||
call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%aggr_filter,inp_unit) ! filtering
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector
|
||||
if (prec%thrvsz > 0) then
|
||||
call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call read_data(prec%athresv,inp_unit) ! aggr thresh vector
|
||||
else
|
||||
read(inp_unit,*) ! dummy read to skip a record
|
||||
end if
|
||||
! coasest-level solver
|
||||
call read_data(prec%csolve,inp_unit) ! coarsest-lev solver
|
||||
call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver
|
||||
call read_data(prec%cmat,inp_unit) ! coarsest mat layout
|
||||
call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU
|
||||
call read_data(prec%cthres,inp_unit) ! Threshold for ILUT
|
||||
call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver
|
||||
! Krylov method for coarsest level
|
||||
call read_data(prec%krm_method,inp_unit) ! Krylov method for coarsest level
|
||||
call read_data(prec%krm_prec,inp_unit) ! Preconditioner for coarsest level
|
||||
call read_data(prec%krm_subsolve,inp_unit) ! Subsolver for coarsest level
|
||||
call read_data(prec%krm_global,inp_unit) ! Is the solver global or local? TRUE or FALSE
|
||||
call read_data(prec%krm_eps,inp_unit) ! Stopping tolerance
|
||||
call read_data(prec%krm_irst,inp_unit) ! Restart for Krylov method
|
||||
call read_data(prec%krm_istop,inp_unit) ! Stopping criterion
|
||||
call read_data(prec%krm_itmax,inp_unit) ! Maximum number of iterations
|
||||
call read_data(prec%krm_itrace,inp_unit) ! Trace of the lower Krylov iterations
|
||||
call read_data(prec%krm_fillin,inp_unit) ! Fill-in for incomplete LU factorization
|
||||
! dump
|
||||
call read_data(prec%dump,inp_unit) ! Dump on file?
|
||||
call read_data(prec%dlmin,inp_unit) ! Minimum level to dump
|
||||
call read_data(prec%dlmax,inp_unit) ! Maximum level to dump
|
||||
call read_data(prec%dump_ac,inp_unit)
|
||||
call read_data(prec%dump_rp,inp_unit)
|
||||
call read_data(prec%dump_tprol,inp_unit)
|
||||
call read_data(prec%dump_smoother,inp_unit)
|
||||
call read_data(prec%dump_solver,inp_unit)
|
||||
call read_data(prec%dump_global_num,inp_unit)
|
||||
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
end if
|
||||
|
||||
call psb_bcast(ctxt,afmt)
|
||||
call psb_bcast(ctxt,idim)
|
||||
call psb_bcast(ctxt,pdecoeff)
|
||||
|
||||
call psb_bcast(ctxt,solve%kmethd)
|
||||
call psb_bcast(ctxt,solve%istopc)
|
||||
call psb_bcast(ctxt,solve%itmax)
|
||||
call psb_bcast(ctxt,solve%itrace)
|
||||
call psb_bcast(ctxt,solve%irst)
|
||||
call psb_bcast(ctxt,solve%eps)
|
||||
|
||||
call psb_bcast(ctxt,prec%descr)
|
||||
call psb_bcast(ctxt,prec%ptype)
|
||||
|
||||
! broadcast first (pre-)smoother / 1-lev prec data
|
||||
call psb_bcast(ctxt,prec%smther)
|
||||
call psb_bcast(ctxt,prec%jsweeps)
|
||||
call psb_bcast(ctxt,prec%degree)
|
||||
call psb_bcast(ctxt,prec%pvariant)
|
||||
call psb_bcast(ctxt,prec%prhovariant)
|
||||
call psb_bcast(ctxt,prec%prhovalue)
|
||||
call psb_bcast(ctxt,prec%novr)
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
call psb_bcast(ctxt,prec%thr)
|
||||
! broadcast second (post-)smoother
|
||||
call psb_bcast(ctxt,prec%smther2)
|
||||
call psb_bcast(ctxt,prec%jsweeps2)
|
||||
call psb_bcast(ctxt,prec%degree2)
|
||||
call psb_bcast(ctxt,prec%pvariant2)
|
||||
call psb_bcast(ctxt,prec%prhovariant2)
|
||||
call psb_bcast(ctxt,prec%prhovalue2)
|
||||
call psb_bcast(ctxt,prec%novr2)
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
call psb_bcast(ctxt,prec%thr2)
|
||||
|
||||
! broadcast AMG parameters
|
||||
call psb_bcast(ctxt,prec%mlcycle)
|
||||
call psb_bcast(ctxt,prec%outer_sweeps)
|
||||
call psb_bcast(ctxt,prec%maxlevs)
|
||||
call psb_bcast(ctxt,prec%csizepp)
|
||||
|
||||
call psb_bcast(ctxt,prec%aggr_prol)
|
||||
call psb_bcast(ctxt,prec%par_aggr_alg)
|
||||
call psb_bcast(ctxt,prec%aggr_type)
|
||||
call psb_bcast(ctxt,prec%aggr_size)
|
||||
call psb_bcast(ctxt,prec%aggr_ord)
|
||||
call psb_bcast(ctxt,prec%aggr_filter)
|
||||
call psb_bcast(ctxt,prec%mncrratio)
|
||||
call psb_bcast(ctxt,prec%thrvsz)
|
||||
if (prec%thrvsz > 0) then
|
||||
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call psb_bcast(ctxt,prec%athresv)
|
||||
end if
|
||||
call psb_bcast(ctxt,prec%athres)
|
||||
|
||||
call psb_bcast(ctxt,prec%cmat)
|
||||
call psb_bcast(ctxt,prec%csolve)
|
||||
call psb_bcast(ctxt,prec%csbsolve)
|
||||
call psb_bcast(ctxt,prec%cfill)
|
||||
call psb_bcast(ctxt,prec%cthres)
|
||||
call psb_bcast(ctxt,prec%cjswp)
|
||||
! Krylov method for coarsest level (broadcast)
|
||||
call psb_bcast(ctxt,prec%krm_method)
|
||||
call psb_bcast(ctxt,prec%krm_prec)
|
||||
call psb_bcast(ctxt,prec%krm_subsolve)
|
||||
call psb_bcast(ctxt,prec%krm_global)
|
||||
call psb_bcast(ctxt,prec%krm_eps)
|
||||
call psb_bcast(ctxt,prec%krm_irst)
|
||||
call psb_bcast(ctxt,prec%krm_istop)
|
||||
call psb_bcast(ctxt,prec%krm_itmax)
|
||||
call psb_bcast(ctxt,prec%krm_itrace)
|
||||
call psb_bcast(ctxt,prec%krm_fillin)
|
||||
! dump
|
||||
call psb_bcast(ctxt,prec%dump)
|
||||
call psb_bcast(ctxt,prec%dlmin)
|
||||
call psb_bcast(ctxt,prec%dlmax)
|
||||
|
||||
call psb_bcast(ctxt,prec%dump_ac)
|
||||
call psb_bcast(ctxt,prec%dump_rp)
|
||||
call psb_bcast(ctxt,prec%dump_tprol)
|
||||
call psb_bcast(ctxt,prec%dump_smoother)
|
||||
call psb_bcast(ctxt,prec%dump_solver)
|
||||
call psb_bcast(ctxt,prec%dump_global_num)
|
||||
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
end program amg_s_pde2d
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde2d_box_mod
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_box(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_box = sone/1.414_psb_spk_
|
||||
end function b1_box
|
||||
function b2_box(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_box = sone/1.414_psb_spk_
|
||||
end function b2_box
|
||||
function c_box(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_box = szero
|
||||
end function c_box
|
||||
function a1_box(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1_box=sone*epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2_box=sone*epsilon
|
||||
end function a2_box
|
||||
function g_box(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_box
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_box = szero
|
||||
if (x == sone) then
|
||||
g_box = sone
|
||||
else if (x == szero) then
|
||||
g_box = sone
|
||||
end if
|
||||
end function g_box
|
||||
end module amg_s_pde2d_box_mod
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde2d_exp_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_exp(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_exp = szero
|
||||
end function b1_exp
|
||||
function b2_exp(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_exp = szero
|
||||
end function b2_exp
|
||||
function c_exp(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_exp = szero
|
||||
end function c_exp
|
||||
function a1_exp(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1_exp=sone*epsilon*exp(-(x+y))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2_exp=sone*epsilon*exp(-(x+y))
|
||||
end function a2_exp
|
||||
function g_exp(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_exp
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_exp = szero
|
||||
if (x == sone) then
|
||||
g_exp = sone
|
||||
else if (x == szero) then
|
||||
g_exp = sone
|
||||
end if
|
||||
end function g_exp
|
||||
end module amg_s_pde2d_exp_mod
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde2d_gauss_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_gauss(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_gauss=sone/sqrt(3.0_psb_spk_)-2*x*exp(-(x**2+y**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_gauss=sone/sqrt(3.0_psb_spk_)-2*y*exp(-(x**2+y**2))
|
||||
end function b2_gauss
|
||||
function c_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_gauss=szero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2))
|
||||
end function a2_gauss
|
||||
function g_gauss(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_gauss
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_gauss = szero
|
||||
if (x == sone) then
|
||||
g_gauss = sone
|
||||
else if (x == szero) then
|
||||
g_gauss = sone
|
||||
end if
|
||||
end function g_gauss
|
||||
end module amg_s_pde2d_gauss_mod
|
||||
@ -0,0 +1,89 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde2d_poisson_mod
|
||||
use psb_base_mod, only : psb_spk_, szero, sone
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm2d_poisson(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm2d_poisson
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_poisson
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b1_poisson = szero
|
||||
end function b1_poisson
|
||||
function b2_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_poisson
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
b2_poisson = szero
|
||||
end function b2_poisson
|
||||
function c_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_poisson
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
c_poisson = szero
|
||||
end function c_poisson
|
||||
function a1_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_poisson
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a1_poisson=sone*epsilon
|
||||
end function a1_poisson
|
||||
function a2_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_poisson
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
a2_poisson=sone*epsilon
|
||||
end function a2_poisson
|
||||
function g_poisson(x,y)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_poisson
|
||||
real(psb_spk_), intent(in) :: x,y
|
||||
g_poisson = szero
|
||||
if (x == sone) then
|
||||
g_poisson = sone
|
||||
else if (x == szero) then
|
||||
g_poisson = sone
|
||||
end if
|
||||
end function g_poisson
|
||||
end module amg_s_pde2d_poisson_mod
|
||||
@ -0,0 +1,848 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
!
|
||||
! File: amg_s_pde3d.f90
|
||||
!
|
||||
! Program: amg_s_pde3d
|
||||
! This sample program solves a linear system obtained by discretizing a
|
||||
! PDE with Dirichlet BCs.
|
||||
!
|
||||
!
|
||||
! The PDE is a general second order equation in 3d
|
||||
!
|
||||
! a1 dd(u) a2 dd(u) a3 dd(u) b1 d(u) b2 d(u) b3 d(u)
|
||||
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
||||
! dxdx dydy dzdz dx dy dz
|
||||
!
|
||||
! with Dirichlet boundary conditions
|
||||
! u = g
|
||||
!
|
||||
! on the unit cube 0<=x,y,z<=1.
|
||||
!
|
||||
!
|
||||
! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation.
|
||||
!
|
||||
! There are three choices available for data distribution:
|
||||
! 1. A simple BLOCK distribution
|
||||
! 2. A ditribution based on arbitrary assignment of indices to processes,
|
||||
! typically from a graph partitioner
|
||||
! 3. A 3D distribution in which the unit cube is partitioned
|
||||
! into subcubes, each one assigned to a process.
|
||||
!
|
||||
program amg_s_pde3d
|
||||
use psb_base_mod
|
||||
use amg_prec_mod
|
||||
use psb_linsolve_mod
|
||||
use psb_util_mod
|
||||
use data_input
|
||||
use amg_s_pde3d_poisson_mod
|
||||
use amg_s_pde3d_exp_mod
|
||||
use amg_s_pde3d_box_mod
|
||||
use amg_s_pde3d_gauss_mod
|
||||
use amg_s_genpde_mod
|
||||
#if defined(PSB_OPENMP)
|
||||
use omp_lib
|
||||
#endif
|
||||
implicit none
|
||||
|
||||
! input parameters
|
||||
character(len=20) :: kmethd, ptype
|
||||
character(len=5) :: afmt
|
||||
character(len=32) :: pdecoeff
|
||||
integer(psb_ipk_) :: idim
|
||||
integer(psb_epk_) :: system_size
|
||||
|
||||
! miscellaneous
|
||||
real(psb_dpk_) :: t1, t2, tprec, thier, tslv, tsmth, tpgen
|
||||
|
||||
! sparse matrix and preconditioner
|
||||
type(psb_sspmat_type) :: a
|
||||
type(amg_sprec_type) :: prec
|
||||
! descriptor
|
||||
type(psb_desc_type) :: desc_a
|
||||
! dense vectors
|
||||
type(psb_s_vect_type) :: x,b,r
|
||||
! parallel environment
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: iam, np, nth
|
||||
|
||||
! solver parameters
|
||||
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
|
||||
integer(psb_epk_) :: amatsize, precsize, descsize, vecsize
|
||||
real(psb_spk_) :: err, resmx, resmxp
|
||||
|
||||
! Solver data
|
||||
type solverdata
|
||||
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
|
||||
integer(psb_ipk_) :: irst ! restart
|
||||
real(psb_spk_) :: eps ! stopping tolerance
|
||||
end type solverdata
|
||||
type(solverdata) :: s_choice
|
||||
|
||||
! preconditioner data
|
||||
type precdata
|
||||
|
||||
! preconditioner type
|
||||
character(len=40) :: descr ! verbose description of the prec
|
||||
character(len=10) :: ptype ! preconditioner type
|
||||
|
||||
integer(psb_ipk_) :: outer_sweeps ! number of outer sweeps: sweeps for 1-level,
|
||||
! AMG cycles for ML
|
||||
! general AMG data
|
||||
character(len=32) :: mlcycle ! AMG cycle type
|
||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||
|
||||
! AMG aggregation
|
||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
||||
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||
real(psb_spk_) :: athres ! smoothed aggregation threshold
|
||||
integer(psb_ipk_) :: csizepp ! minimum size of coarsest matrix per process
|
||||
|
||||
! AMG smoother or pre-smoother; also 1-lev preconditioner
|
||||
character(len=32) :: smther ! (pre-)smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps ! (pre-)smoother / 1-lev prec. sweeps
|
||||
integer(psb_ipk_) :: degree ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant ! polynomial variant
|
||||
character(len=32) :: prhovariant ! how to estimate rho(M^{-1}A)
|
||||
real(psb_spk_) :: prhovalue ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr ! number of overlap layers
|
||||
character(len=32) :: restr ! restriction over application of AS
|
||||
character(len=32) :: prol ! prolongation over application of AS
|
||||
character(len=32) :: solve ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps ! inner solver sweeps
|
||||
character(len=32) :: variant ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr ! threshold for ILUT factorization
|
||||
|
||||
! AMG post-smoother; ignored by 1-lev preconditioner
|
||||
character(len=32) :: smther2 ! post-smoother type: BJAC, AS
|
||||
integer(psb_ipk_) :: jsweeps2 ! post-smoother sweeps
|
||||
integer(psb_ipk_) :: degree2 ! degree for polynomial smoother
|
||||
character(len=32) :: pvariant2 ! polynomial variant
|
||||
character(len=32) :: prhovariant2 ! how to estimate rho(M^{-1}A)
|
||||
real(psb_spk_) :: prhovalue2 ! if previous is set value, we set it from this one
|
||||
integer(psb_ipk_) :: novr2 ! number of overlap layers
|
||||
character(len=32) :: restr2 ! restriction over application of AS
|
||||
character(len=32) :: prol2 ! prolongation over application of AS
|
||||
character(len=32) :: solve2 ! local subsolver type: ILU, MILU, ILUT,
|
||||
! UMF, MUMPS, SLU, FWGS, BWGS, JAC
|
||||
integer(psb_ipk_) :: ssweeps2 ! inner solver sweeps
|
||||
character(len=32) :: variant2 ! AINV variant: LLK, etc
|
||||
integer(psb_ipk_) :: fill2 ! fill-in for incomplete LU factorization
|
||||
integer(psb_ipk_) :: invfill2 ! Inverse fill-in for INVK
|
||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||
|
||||
! coarsest-level solver
|
||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||
! (repl. mat.)
|
||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||
! MILU, UMF, MUMPS, SLU
|
||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||
! settings for the Krylov method
|
||||
character(len=16) :: krm_method ! Krylov method for coarsest level
|
||||
character(len=16) :: krm_prec ! Preconditioner for coarsest level
|
||||
character(len=16) :: krm_subsolve ! Subsolver for coarsest level
|
||||
character(len=16) :: krm_global ! Is the solver global or local? TRUE or FALSE
|
||||
real(psb_spk_) :: krm_eps ! Stopping tolerance
|
||||
integer(psb_ipk_) :: krm_irst ! Restart for Krylov method
|
||||
integer(psb_ipk_) :: krm_istop ! Stopping criterion
|
||||
integer(psb_ipk_) :: krm_itmax ! Maximum number of iterations
|
||||
integer(psb_ipk_) :: krm_itrace ! Trace of the lower Krylov iterations
|
||||
integer(psb_ipk_) :: krm_fillin ! Fill-in for incomplete LU factorization
|
||||
|
||||
! Dump data
|
||||
logical :: dump = .false.
|
||||
integer(psb_ipk_) :: dlmin ! Minimum level to dump
|
||||
integer(psb_ipk_) :: dlmax ! Maximum level to dump
|
||||
logical :: dump_ac = .false.
|
||||
logical :: dump_rp = .false.
|
||||
logical :: dump_tprol = .false.
|
||||
logical :: dump_smoother = .false.
|
||||
logical :: dump_solver = .false.
|
||||
logical :: dump_global_num = .false.
|
||||
|
||||
end type precdata
|
||||
type(precdata) :: p_choice
|
||||
|
||||
! other variables
|
||||
integer(psb_ipk_) :: info, i, k
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info=psb_success_
|
||||
|
||||
|
||||
call psb_init(ctxt)
|
||||
call psb_info(ctxt,iam,np)
|
||||
#if defined(PSB_OPENMP)
|
||||
!$OMP parallel shared(nth)
|
||||
!$OMP master
|
||||
nth = omp_get_num_threads()
|
||||
!$OMP end master
|
||||
!$OMP end parallel
|
||||
#else
|
||||
nth = 1
|
||||
#endif
|
||||
|
||||
if (iam < 0) then
|
||||
! This should not happen, but just in case
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
endif
|
||||
if(psb_get_errstatus() /= 0) goto 9999
|
||||
name='amg_s_pde3d'
|
||||
call psb_set_errverbosity(itwo)
|
||||
!
|
||||
! Hello world
|
||||
!
|
||||
if (iam == psb_root_) then
|
||||
write(*,*) 'Welcome to AMG4PSBLAS version: ',amg_version_string_
|
||||
write(*,*) 'This is the ',trim(name),' sample program'
|
||||
end if
|
||||
|
||||
!
|
||||
! get parameters
|
||||
!
|
||||
call get_parms(ctxt,afmt,idim,s_choice,p_choice,pdecoeff)
|
||||
|
||||
!
|
||||
! allocate and fill in the coefficient matrix, rhs and initial guess
|
||||
!
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
select case(psb_toupper(trim(pdecoeff)))
|
||||
case("POISSON")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_poisson,a2_poisson,a3_poisson,&
|
||||
& b1_poisson,b2_poisson,b3_poisson,c_poisson,g_poisson,info)
|
||||
case("EXP")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_exp,a2_exp,a3_exp,&
|
||||
& b1_exp,b2_exp,b3_exp,c_exp,g_exp,info)
|
||||
case("BOX")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_box,a2_box,a3_box,&
|
||||
& b1_box,b2_box,b3_box,c_box,g_box,info)
|
||||
case("GAUSS")
|
||||
call amg_gen_pde3d(ctxt,idim,a,b,x,desc_a,afmt,&
|
||||
& a1_gauss,a2_gauss,a3_gauss,&
|
||||
& b1_gauss,b2_gauss,b3_gauss,c_gauss,g_gauss,info)
|
||||
case default
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pdecoeff'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tpgen = psb_wtime() - t1
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='amg_gen_pde3d'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("PDE Coefficients : ",a)')pdecoeff
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'("Overall matrix creation time : ",es12.5)')tpgen
|
||||
if (iam == psb_root_) &
|
||||
& write(psb_out_unit,'(" ")')
|
||||
!
|
||||
! initialize the preconditioner
|
||||
!
|
||||
call prec%init(ctxt,p_choice%ptype,info)
|
||||
select case(trim(psb_toupper(p_choice%ptype)))
|
||||
case ('NONE','NOPREC')
|
||||
! Do nothing, keep defaults
|
||||
|
||||
case ('JACOBI','L1-JACOBI','GS','FWGS','FBGS')
|
||||
! 1-level sweeps from "outer_sweeps"
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
|
||||
case ('BJAC','POLY')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case('AS')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
|
||||
case ('ML')
|
||||
! multilevel preconditioner
|
||||
|
||||
call prec%set('ml_cycle', p_choice%mlcycle, info)
|
||||
call prec%set('outer_sweeps', p_choice%outer_sweeps,info)
|
||||
if (p_choice%csizepp>0)&
|
||||
& call prec%set('min_coarse_size_per_process', p_choice%csizepp, info)
|
||||
if (p_choice%mncrratio>1)&
|
||||
& call prec%set('min_cr_ratio', p_choice%mncrratio, info)
|
||||
if (p_choice%maxlevs>0)&
|
||||
& call prec%set('max_levs', p_choice%maxlevs, info)
|
||||
if (p_choice%athres >= dzero) &
|
||||
& call prec%set('aggr_thresh', p_choice%athres, info)
|
||||
if (p_choice%thrvsz>0) then
|
||||
do k=1,min(p_choice%thrvsz,size(prec%precv)-1)
|
||||
call prec%set('aggr_thresh', p_choice%athresv(k), info,ilev=(k+1))
|
||||
end do
|
||||
end if
|
||||
|
||||
call prec%set('aggr_prol', p_choice%aggr_prol, info)
|
||||
call prec%set('par_aggr_alg', p_choice%par_aggr_alg, info)
|
||||
call prec%set('aggr_type', p_choice%aggr_type, info)
|
||||
call prec%set('aggr_size', p_choice%aggr_size, info)
|
||||
|
||||
call prec%set('aggr_ord', p_choice%aggr_ord, info)
|
||||
call prec%set('aggr_filter', p_choice%aggr_filter,info)
|
||||
|
||||
|
||||
call prec%set('smoother_type', p_choice%smther, info)
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps, info)
|
||||
call prec%set('poly_degree', p_choice%degree, info)
|
||||
call prec%set('poly_variant', p_choice%pvariant, info)
|
||||
if (p_choice%prhovalue > szero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue, info)
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant, info)
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr, info)
|
||||
call prec%set('sub_restr', p_choice%restr, info)
|
||||
call prec%set('sub_prol', p_choice%prol, info)
|
||||
select case(trim(psb_toupper(p_choice%solve)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
call prec%set('ainv_alg', p_choice%variant, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve, info)
|
||||
if (psb_toupper(p_choice%solve)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps, info)
|
||||
call prec%set('sub_fillin', p_choice%fill, info)
|
||||
call prec%set('inv_fillin', p_choice%invfill, info)
|
||||
call prec%set('sub_iluthrs', p_choice%thr, info)
|
||||
end select
|
||||
|
||||
if (psb_toupper(p_choice%smther2) /= 'NONE') then
|
||||
call prec%set('smoother_type', p_choice%smther2, info,pos='post')
|
||||
call prec%set('smoother_sweeps', p_choice%jsweeps2, info,pos='post')
|
||||
call prec%set('poly_degree', p_choice%degree2, info,pos='post')
|
||||
call prec%set('poly_variant', p_choice%pvariant2, info,pos='post')
|
||||
if (p_choice%prhovalue > szero ) then
|
||||
call prec%set('poly_rho_ba', p_choice%prhovalue2, info,pos='post')
|
||||
else
|
||||
call prec%set('poly_rho_estimate', p_choice%prhovariant2, info,pos='post')
|
||||
end if
|
||||
|
||||
select case (psb_toupper(p_choice%smther2))
|
||||
case ('GS','BWGS','FBGS','JACOBI','L1-JACOBI','L1-FBGS')
|
||||
! do nothing
|
||||
case default
|
||||
call prec%set('sub_ovr', p_choice%novr2, info,pos='post')
|
||||
call prec%set('sub_restr', p_choice%restr2, info,pos='post')
|
||||
call prec%set('sub_prol', p_choice%prol2, info,pos='post')
|
||||
select case(trim(psb_toupper(p_choice%solve2)))
|
||||
case('INVK')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('INVT')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
case('AINV')
|
||||
call prec%set('sub_solve', p_choice%solve2, info)
|
||||
call prec%set('ainv_alg', p_choice%variant2, info)
|
||||
case default
|
||||
call prec%set('sub_solve', p_choice%solve2, info, pos='post')
|
||||
if (psb_toupper(p_choice%solve2)=='MUMPS') &
|
||||
& call prec%set('mumps_loc_glob','local_solver',info)
|
||||
end select
|
||||
call prec%set('solver_sweeps', p_choice%ssweeps2, info,pos='post')
|
||||
call prec%set('sub_fillin', p_choice%fill2, info,pos='post')
|
||||
call prec%set('inv_fillin', p_choice%invfill2, info,pos='post')
|
||||
call prec%set('sub_iluthrs', p_choice%thr2, info,pos='post')
|
||||
end select
|
||||
end if
|
||||
|
||||
call prec%set('coarse_solve', p_choice%csolve, info)
|
||||
call prec%set('coarse_mat', p_choice%cmat, info)
|
||||
! Set for the case of a KRM solver
|
||||
if (psb_toupper(p_choice%csolve) == 'KRM') then
|
||||
call prec%set('krm_method', p_choice%krm_method, info)
|
||||
call prec%set('krm_kprec', p_choice%krm_prec, info)
|
||||
call prec%set('krm_sub_solve', p_choice%krm_subsolve, info)
|
||||
call prec%set('krm_global', p_choice%krm_global, info)
|
||||
call prec%set('krm_eps', p_choice%krm_eps, info)
|
||||
call prec%set('krm_irst', p_choice%krm_irst, info)
|
||||
call prec%set('krm_istopc', p_choice%krm_istop, info)
|
||||
call prec%set('krm_itmax', p_choice%krm_itmax, info)
|
||||
call prec%set('krm_itrace', p_choice%krm_itrace, info)
|
||||
call prec%set('krm_fillin', p_choice%krm_fillin, info)
|
||||
else
|
||||
if (psb_toupper(p_choice%csolve) == 'BJAC') &
|
||||
& call prec%set('coarse_subsolve', p_choice%csbsolve, info)
|
||||
call prec%set('coarse_fillin', p_choice%cfill, info)
|
||||
call prec%set('coarse_iluthrs', p_choice%cthres, info)
|
||||
call prec%set('coarse_sweeps', p_choice%cjswp, info)
|
||||
end if
|
||||
end select
|
||||
|
||||
! build the preconditioner
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%hierarchy_build(a,desc_a,info)
|
||||
thier = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_hierarchy_bld')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
call prec%smoothers_build(a,desc_a,info)
|
||||
tsmth = psb_wtime()-t1
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='amg_smoothers_bld')
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_amx(ctxt, thier)
|
||||
call psb_amx(ctxt, tprec)
|
||||
|
||||
if(iam == psb_root_) then
|
||||
write(psb_out_unit,'(" ")')
|
||||
write(psb_out_unit,'("Preconditioner: ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Preconditioner time: ",es12.5)')thier+tprec
|
||||
write(psb_out_unit,'(" ")')
|
||||
end if
|
||||
|
||||
if (p_choice%dump) then
|
||||
call prec%dump(info,istart=p_choice%dlmin,iend=p_choice%dlmax,&
|
||||
& ac=p_choice%dump_ac,rp=p_choice%dump_rp,tprol=p_choice%dump_tprol,&
|
||||
& smoother=p_choice%dump_smoother, solver=p_choice%dump_solver, &
|
||||
& global_num=p_choice%dump_global_num)
|
||||
end if
|
||||
!
|
||||
! iterative method parameters
|
||||
!
|
||||
call psb_barrier(ctxt)
|
||||
t1 = psb_wtime()
|
||||
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)
|
||||
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)
|
||||
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
|
||||
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='solver routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call psb_barrier(ctxt)
|
||||
tslv = psb_wtime() - t1
|
||||
call psb_amx(ctxt,tslv)
|
||||
|
||||
! compute residual norms
|
||||
call psb_geall(r,desc_a,info)
|
||||
call r%zero()
|
||||
call psb_geasb(r,desc_a,info)
|
||||
call psb_geaxpby(sone,b,szero,r,desc_a,info)
|
||||
call psb_spmm(-sone,a,x,sone,r,desc_a,info)
|
||||
resmx = psb_genrm2(r,desc_a,info)
|
||||
resmxp = psb_geamax(r,desc_a,info)
|
||||
|
||||
vecsize = x%sizeof()
|
||||
amatsize = a%sizeof()
|
||||
descsize = desc_a%sizeof()
|
||||
precsize = prec%sizeof()
|
||||
system_size = desc_a%get_global_rows()
|
||||
call psb_sum(ctxt,vecsize)
|
||||
call psb_sum(ctxt,amatsize)
|
||||
call psb_sum(ctxt,descsize)
|
||||
call psb_sum(ctxt,precsize)
|
||||
call prec%descr(info,iout=psb_out_unit)
|
||||
if (iam == psb_root_) then
|
||||
write(psb_out_unit,'("Computed solution on ",i8," process(es)")') np
|
||||
write(psb_out_unit,'("Number of threads : ",i12)') nth
|
||||
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
|
||||
write(psb_out_unit,'("Discretization domain size : ",i12)') idim
|
||||
write(psb_out_unit,'("Linear system size : ",i12)') system_size
|
||||
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
|
||||
write(psb_out_unit,'("Problem setup time : ",es12.5)') tpgen
|
||||
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
|
||||
write(psb_out_unit,'("Preconditioner : ",a)') trim(p_choice%descr)
|
||||
write(psb_out_unit,'("Iterations to convergence : ",i12)') iter
|
||||
write(psb_out_unit,'("Relative error estimate on exit : ",es12.5)') err
|
||||
write(psb_out_unit,'("Number of levels in hierarchy : ",i12)') prec%get_nlevs()
|
||||
write(psb_out_unit,'("Time to build hierarchy : ",es12.5)') thier
|
||||
write(psb_out_unit,'("Time to build smoothers : ",es12.5)') tsmth
|
||||
write(psb_out_unit,'("Total preconditioner setup time : ",es12.5)') tsmth+thier
|
||||
write(psb_out_unit,'("Time to solve system : ",es12.5)') tslv
|
||||
write(psb_out_unit,'("Time per iteration : ",es12.5)') tslv/iter
|
||||
write(psb_out_unit,'("Total time : ",es12.5)') tslv+tprec+thier
|
||||
write(psb_out_unit,'("Residual 2-norm : ",es12.5)') resmx
|
||||
write(psb_out_unit,'("Residual inf-norm : ",es12.5)') resmxp
|
||||
write(psb_out_unit,'("Total memory occupation for X : ",i16)') vecsize
|
||||
write(psb_out_unit,'("Total memory occupation for A : ",i16)') amatsize
|
||||
write(psb_out_unit,'("Total memory occupation for DESC_A : ",i16)') descsize
|
||||
write(psb_out_unit,'("Total memory occupation for PREC : ",i16)') precsize
|
||||
write(psb_out_unit,'("Total memory occupation : ",i16)') &
|
||||
& amatsize + descsize+precsize+2*vecsize
|
||||
write(psb_out_unit,'("Storage format for A : ",a )') a%get_fmt()
|
||||
write(psb_out_unit,'("Storage format for DESC_A : ",a )') desc_a%get_fmt()
|
||||
|
||||
end if
|
||||
! call psb_print_timers(ctxt)
|
||||
!
|
||||
! cleanup storage and exit
|
||||
!
|
||||
call psb_gefree(b,desc_a,info)
|
||||
call psb_gefree(x,desc_a,info)
|
||||
call psb_spfree(a,desc_a,info)
|
||||
call prec%free(info)
|
||||
call psb_cdfree(desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='free routine'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
call psb_exit(ctxt)
|
||||
stop
|
||||
|
||||
9999 continue
|
||||
call psb_error(ctxt)
|
||||
|
||||
contains
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
!
|
||||
! get iteration parameters from standard input
|
||||
!
|
||||
subroutine get_parms(ctxt,afmt,idim,solve,prec,pdecoeff)
|
||||
|
||||
implicit none
|
||||
|
||||
type(psb_ctxt_type) :: ctxt
|
||||
integer(psb_ipk_) :: idim
|
||||
character(len=*) :: afmt
|
||||
type(solverdata) :: solve
|
||||
type(precdata) :: prec
|
||||
character(len=*) :: pdecoeff
|
||||
integer(psb_ipk_) :: iam, nm, np, inp_unit
|
||||
character(len=1024) :: filename
|
||||
|
||||
call psb_info(ctxt,iam,np)
|
||||
|
||||
if (iam == psb_root_) then
|
||||
if (command_argument_count()>0) then
|
||||
call get_command_argument(1,filename)
|
||||
inp_unit = 30
|
||||
open(inp_unit,file=filename,action='read',iostat=info)
|
||||
if (info /= 0) then
|
||||
write(psb_err_unit,*) 'Could not open file ',filename,' for input'
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
else
|
||||
write(psb_err_unit,*) 'Opened file ',trim(filename),' for input'
|
||||
end if
|
||||
else
|
||||
write(psb_err_unit,*) 'Usage: amg_s_pde3d ctrl-file '
|
||||
call psb_abort(ctxt)
|
||||
stop
|
||||
end if
|
||||
! read input data
|
||||
!
|
||||
call read_data(afmt,inp_unit) ! matrix storage format
|
||||
call read_data(idim,inp_unit) ! Discretization grid size
|
||||
call read_data(pdecoeff,inp_unit) ! PDE Coefficients
|
||||
! Krylov solver data
|
||||
call read_data(solve%kmethd,inp_unit) ! Krylov solver
|
||||
call read_data(solve%istopc,inp_unit) ! stopping criterion
|
||||
call read_data(solve%itmax,inp_unit) ! max num iterations
|
||||
call read_data(solve%itrace,inp_unit) ! tracing
|
||||
call read_data(solve%irst,inp_unit) ! restart
|
||||
call read_data(solve%eps,inp_unit) ! tolerance
|
||||
! preconditioner type
|
||||
call read_data(prec%descr,inp_unit) ! verbose description of the prec
|
||||
call read_data(prec%ptype,inp_unit) ! preconditioner type
|
||||
|
||||
! First smoother / 1-lev preconditioner
|
||||
call read_data(prec%smther,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%degree,inp_unit) ! (pre-)smoother / 1-lev prec sweeps
|
||||
call read_data(prec%pvariant,inp_unit) !
|
||||
call read_data(prec%prhovariant,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr,inp_unit) ! threshold for ILUT
|
||||
! Second smoother/ AMG post-smoother (if NONE ignored in main)
|
||||
call read_data(prec%smther2,inp_unit) ! smoother type
|
||||
call read_data(prec%jsweeps2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%degree2,inp_unit) ! (post-)smoother sweeps
|
||||
call read_data(prec%pvariant2,inp_unit) !
|
||||
call read_data(prec%prhovariant2,inp_unit)! how to estimate rho(M^{-1}A)
|
||||
call read_data(prec%prhovalue2,inp_unit) ! if previous is set value, we set it from this one
|
||||
call read_data(prec%novr2,inp_unit) ! number of overlap layers
|
||||
call read_data(prec%restr2,inp_unit) ! restriction over application of AS
|
||||
call read_data(prec%prol2,inp_unit) ! prolongation over application of AS
|
||||
call read_data(prec%solve2,inp_unit) ! local subsolver
|
||||
call read_data(prec%ssweeps2,inp_unit) ! inner solver sweeps
|
||||
call read_data(prec%variant2,inp_unit) ! AINV variant
|
||||
call read_data(prec%fill2,inp_unit) ! fill-in for incomplete LU
|
||||
call read_data(prec%invfill2,inp_unit) !Inverse fill-in for INVK
|
||||
call read_data(prec%thr2,inp_unit) ! threshold for ILUT
|
||||
! general AMG data
|
||||
call read_data(prec%mlcycle,inp_unit) ! AMG cycle type
|
||||
call read_data(prec%outer_sweeps,inp_unit) ! number of 1lev/outer sweeps
|
||||
call read_data(prec%maxlevs,inp_unit) ! max number of levels in AMG prec
|
||||
call read_data(prec%csizepp,inp_unit) ! min size coarsest mat
|
||||
! aggregation
|
||||
call read_data(prec%aggr_prol,inp_unit) ! aggregation type
|
||||
call read_data(prec%par_aggr_alg,inp_unit) ! parallel aggregation alg
|
||||
call read_data(prec%aggr_type,inp_unit) ! type of aggregation
|
||||
call read_data(prec%aggr_size,inp_unit) ! Requested size of the aggregates for MATCHBOXP
|
||||
call read_data(prec%aggr_ord,inp_unit) ! ordering for aggregation
|
||||
call read_data(prec%mncrratio,inp_unit) ! minimum aggregation ratio
|
||||
call read_data(prec%aggr_filter,inp_unit) ! filtering
|
||||
call read_data(prec%athres,inp_unit) ! smoothed aggr thresh
|
||||
call read_data(prec%thrvsz,inp_unit) ! size of aggr thresh vector
|
||||
if (prec%thrvsz > 0) then
|
||||
call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call read_data(prec%athresv,inp_unit) ! aggr thresh vector
|
||||
else
|
||||
read(inp_unit,*) ! dummy read to skip a record
|
||||
end if
|
||||
! coasest-level solver
|
||||
call read_data(prec%csolve,inp_unit) ! coarsest-lev solver
|
||||
call read_data(prec%csbsolve,inp_unit) ! coarsest-lev subsolver
|
||||
call read_data(prec%cmat,inp_unit) ! coarsest mat layout
|
||||
call read_data(prec%cfill,inp_unit) ! fill-in for incompl LU
|
||||
call read_data(prec%cthres,inp_unit) ! Threshold for ILUT
|
||||
call read_data(prec%cjswp,inp_unit) ! sweeps for GS/JAC subsolver
|
||||
! Krylov method for coarsest level
|
||||
call read_data(prec%krm_method,inp_unit) ! Krylov method for coarsest level
|
||||
call read_data(prec%krm_prec,inp_unit) ! Preconditioner for coarsest level
|
||||
call read_data(prec%krm_subsolve,inp_unit) ! Subsolver for coarsest level
|
||||
call read_data(prec%krm_global,inp_unit) ! Is the solver global or local? TRUE or FALSE
|
||||
call read_data(prec%krm_eps,inp_unit) ! Stopping tolerance
|
||||
call read_data(prec%krm_irst,inp_unit) ! Restart for Krylov method
|
||||
call read_data(prec%krm_istop,inp_unit) ! Stopping criterion
|
||||
call read_data(prec%krm_itmax,inp_unit) ! Maximum number of iterations
|
||||
call read_data(prec%krm_itrace,inp_unit) ! Trace of the lower Krylov iterations
|
||||
call read_data(prec%krm_fillin,inp_unit) ! Fill-in for incomplete LU factorization
|
||||
! dump
|
||||
call read_data(prec%dump,inp_unit) ! Dump on file?
|
||||
call read_data(prec%dlmin,inp_unit) ! Minimum level to dump
|
||||
call read_data(prec%dlmax,inp_unit) ! Maximum level to dump
|
||||
call read_data(prec%dump_ac,inp_unit)
|
||||
call read_data(prec%dump_rp,inp_unit)
|
||||
call read_data(prec%dump_tprol,inp_unit)
|
||||
call read_data(prec%dump_smoother,inp_unit)
|
||||
call read_data(prec%dump_solver,inp_unit)
|
||||
call read_data(prec%dump_global_num,inp_unit)
|
||||
|
||||
if (inp_unit /= psb_inp_unit) then
|
||||
close(inp_unit)
|
||||
end if
|
||||
end if
|
||||
|
||||
call psb_bcast(ctxt,afmt)
|
||||
call psb_bcast(ctxt,idim)
|
||||
call psb_bcast(ctxt,pdecoeff)
|
||||
|
||||
call psb_bcast(ctxt,solve%kmethd)
|
||||
call psb_bcast(ctxt,solve%istopc)
|
||||
call psb_bcast(ctxt,solve%itmax)
|
||||
call psb_bcast(ctxt,solve%itrace)
|
||||
call psb_bcast(ctxt,solve%irst)
|
||||
call psb_bcast(ctxt,solve%eps)
|
||||
|
||||
call psb_bcast(ctxt,prec%descr)
|
||||
call psb_bcast(ctxt,prec%ptype)
|
||||
|
||||
! broadcast first (pre-)smoother / 1-lev prec data
|
||||
call psb_bcast(ctxt,prec%smther)
|
||||
call psb_bcast(ctxt,prec%jsweeps)
|
||||
call psb_bcast(ctxt,prec%degree)
|
||||
call psb_bcast(ctxt,prec%pvariant)
|
||||
call psb_bcast(ctxt,prec%prhovariant)
|
||||
call psb_bcast(ctxt,prec%prhovalue)
|
||||
call psb_bcast(ctxt,prec%novr)
|
||||
call psb_bcast(ctxt,prec%restr)
|
||||
call psb_bcast(ctxt,prec%prol)
|
||||
call psb_bcast(ctxt,prec%solve)
|
||||
call psb_bcast(ctxt,prec%ssweeps)
|
||||
call psb_bcast(ctxt,prec%variant)
|
||||
call psb_bcast(ctxt,prec%fill)
|
||||
call psb_bcast(ctxt,prec%invfill)
|
||||
call psb_bcast(ctxt,prec%thr)
|
||||
! broadcast second (post-)smoother
|
||||
call psb_bcast(ctxt,prec%smther2)
|
||||
call psb_bcast(ctxt,prec%jsweeps2)
|
||||
call psb_bcast(ctxt,prec%degree2)
|
||||
call psb_bcast(ctxt,prec%pvariant2)
|
||||
call psb_bcast(ctxt,prec%prhovariant2)
|
||||
call psb_bcast(ctxt,prec%prhovalue2)
|
||||
call psb_bcast(ctxt,prec%novr2)
|
||||
call psb_bcast(ctxt,prec%restr2)
|
||||
call psb_bcast(ctxt,prec%prol2)
|
||||
call psb_bcast(ctxt,prec%solve2)
|
||||
call psb_bcast(ctxt,prec%ssweeps2)
|
||||
call psb_bcast(ctxt,prec%variant2)
|
||||
call psb_bcast(ctxt,prec%fill2)
|
||||
call psb_bcast(ctxt,prec%invfill2)
|
||||
call psb_bcast(ctxt,prec%thr2)
|
||||
|
||||
! broadcast AMG parameters
|
||||
call psb_bcast(ctxt,prec%mlcycle)
|
||||
call psb_bcast(ctxt,prec%outer_sweeps)
|
||||
call psb_bcast(ctxt,prec%maxlevs)
|
||||
call psb_bcast(ctxt,prec%csizepp)
|
||||
|
||||
call psb_bcast(ctxt,prec%aggr_prol)
|
||||
call psb_bcast(ctxt,prec%par_aggr_alg)
|
||||
call psb_bcast(ctxt,prec%aggr_type)
|
||||
call psb_bcast(ctxt,prec%aggr_size)
|
||||
call psb_bcast(ctxt,prec%aggr_ord)
|
||||
call psb_bcast(ctxt,prec%aggr_filter)
|
||||
call psb_bcast(ctxt,prec%mncrratio)
|
||||
call psb_bcast(ctxt,prec%thrvsz)
|
||||
if (prec%thrvsz > 0) then
|
||||
if (iam /= psb_root_) call psb_realloc(prec%thrvsz,prec%athresv,info)
|
||||
call psb_bcast(ctxt,prec%athresv)
|
||||
end if
|
||||
call psb_bcast(ctxt,prec%athres)
|
||||
|
||||
call psb_bcast(ctxt,prec%cmat)
|
||||
call psb_bcast(ctxt,prec%csolve)
|
||||
call psb_bcast(ctxt,prec%csbsolve)
|
||||
call psb_bcast(ctxt,prec%cfill)
|
||||
call psb_bcast(ctxt,prec%cthres)
|
||||
call psb_bcast(ctxt,prec%cjswp)
|
||||
! Krylov method for coarsest level (broadcast)
|
||||
call psb_bcast(ctxt,prec%krm_method)
|
||||
call psb_bcast(ctxt,prec%krm_prec)
|
||||
call psb_bcast(ctxt,prec%krm_subsolve)
|
||||
call psb_bcast(ctxt,prec%krm_global)
|
||||
call psb_bcast(ctxt,prec%krm_eps)
|
||||
call psb_bcast(ctxt,prec%krm_irst)
|
||||
call psb_bcast(ctxt,prec%krm_istop)
|
||||
call psb_bcast(ctxt,prec%krm_itmax)
|
||||
call psb_bcast(ctxt,prec%krm_itrace)
|
||||
call psb_bcast(ctxt,prec%krm_fillin)
|
||||
! dump
|
||||
call psb_bcast(ctxt,prec%dump)
|
||||
call psb_bcast(ctxt,prec%dlmin)
|
||||
call psb_bcast(ctxt,prec%dlmax)
|
||||
|
||||
call psb_bcast(ctxt,prec%dump_ac)
|
||||
call psb_bcast(ctxt,prec%dump_rp)
|
||||
call psb_bcast(ctxt,prec%dump_tprol)
|
||||
call psb_bcast(ctxt,prec%dump_smoother)
|
||||
call psb_bcast(ctxt,prec%dump_solver)
|
||||
call psb_bcast(ctxt,prec%dump_global_num)
|
||||
|
||||
|
||||
|
||||
end subroutine get_parms
|
||||
|
||||
end program amg_s_pde3d
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_box_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_box(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_box
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_box=sone/sqrt(3.0_psb_spk_)
|
||||
end function b1_box
|
||||
function b2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_box=sone/sqrt(3.0_psb_spk_)
|
||||
end function b2_box
|
||||
function b3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_box=sone/sqrt(3.0_psb_spk_)
|
||||
end function b3_box
|
||||
function c_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c_box=szero
|
||||
end function c_box
|
||||
function a1_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_box=epsilon
|
||||
end function a1_box
|
||||
function a2_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_box=epsilon
|
||||
end function a2_box
|
||||
function a3_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_box=epsilon
|
||||
end function a3_box
|
||||
function g_box(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_box
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_box= szero
|
||||
if (x == sone) then
|
||||
g_box = sone
|
||||
else if (x == szero) then
|
||||
g_box = sone
|
||||
end if
|
||||
end function g_box
|
||||
end module amg_s_pde3d_box_mod
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_exp_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/160
|
||||
contains
|
||||
subroutine pde_set_parm3d_exp(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_exp
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_exp=szero/sqrt(3.0_psb_spk_)
|
||||
end function b1_exp
|
||||
function b2_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_exp=szero/sqrt(3.0_psb_spk_)
|
||||
end function b2_exp
|
||||
function b3_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_exp=szero/sqrt(3.0_psb_spk_)
|
||||
end function b3_exp
|
||||
function c_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c_exp=szero
|
||||
end function c_exp
|
||||
function a1_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_exp=epsilon*exp(-(x+y+z))
|
||||
end function a1_exp
|
||||
function a2_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_exp=epsilon*exp(-(x+y+z))
|
||||
end function a2_exp
|
||||
function a3_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_exp=epsilon*exp(-(x+y+z))
|
||||
end function a3_exp
|
||||
function g_exp(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_exp
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_exp = szero
|
||||
if (x == sone) then
|
||||
g_exp = sone
|
||||
else if (x == szero) then
|
||||
g_exp = sone
|
||||
end if
|
||||
end function g_exp
|
||||
end module amg_s_pde3d_exp_mod
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_gauss_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_gauss(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_gauss
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_gauss=sone/sqrt(3.0_psb_spk_)-2*x*exp(-(x**2+y**2+z**2))
|
||||
end function b1_gauss
|
||||
function b2_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_gauss=sone/sqrt(3.0_psb_spk_)-2*y*exp(-(x**2+y**2+z**2))
|
||||
end function b2_gauss
|
||||
function b3_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_gauss=sone/sqrt(3.0_psb_spk_)-2*z*exp(-(x**2+y**2+z**2))
|
||||
end function b3_gauss
|
||||
function c_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c_gauss=szero
|
||||
end function c_gauss
|
||||
function a1_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a1_gauss
|
||||
function a2_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a2_gauss
|
||||
function a3_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_gauss=epsilon*exp(-(x**2+y**2+z**2))
|
||||
end function a3_gauss
|
||||
function g_gauss(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_gauss
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_gauss = szero
|
||||
if (x == sone) then
|
||||
g_gauss = sone
|
||||
else if (x == szero) then
|
||||
g_gauss = sone
|
||||
end if
|
||||
end function g_gauss
|
||||
end module amg_s_pde3d_gauss_mod
|
||||
@ -0,0 +1,101 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
module amg_s_pde3d_poisson_mod
|
||||
use psb_base_mod, only : psb_spk_, sone, szero
|
||||
real(psb_spk_), save, private :: epsilon=sone/80
|
||||
contains
|
||||
subroutine pde_set_parm3d_poisson(dat)
|
||||
real(psb_spk_), intent(in) :: dat
|
||||
epsilon = dat
|
||||
end subroutine pde_set_parm3d_poisson
|
||||
!
|
||||
! functions parametrizing the differential equation
|
||||
!
|
||||
function b1_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b1_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b1_poisson=szero
|
||||
end function b1_poisson
|
||||
function b2_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b2_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b2_poisson=szero
|
||||
end function b2_poisson
|
||||
function b3_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: b3_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
b3_poisson=szero
|
||||
end function b3_poisson
|
||||
function c_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: c_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
c_poisson=szero
|
||||
end function c_poisson
|
||||
function a1_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a1_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a1_poisson=epsilon
|
||||
end function a1_poisson
|
||||
function a2_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a2_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a2_poisson=epsilon
|
||||
end function a2_poisson
|
||||
function a3_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: a3_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
a3_poisson=epsilon
|
||||
end function a3_poisson
|
||||
function g_poisson(x,y,z)
|
||||
implicit none
|
||||
real(psb_spk_) :: g_poisson
|
||||
real(psb_spk_), intent(in) :: x,y,z
|
||||
g_poisson = szero
|
||||
if (x == sone) then
|
||||
g_poisson = sone
|
||||
else if (x == szero) then
|
||||
g_poisson = sone
|
||||
end if
|
||||
end function g_poisson
|
||||
end module amg_s_pde3d_poisson_mod
|
||||
@ -0,0 +1,324 @@
|
||||
!
|
||||
!
|
||||
! AMG4PSBLAS version 1.0
|
||||
! Algebraic Multigrid Package
|
||||
! based on PSBLAS (Parallel Sparse BLAS version 3.7)
|
||||
!
|
||||
! (C) Copyright 2021
|
||||
!
|
||||
! Salvatore Filippone
|
||||
! Pasqua D'Ambra
|
||||
! Fabio Durastante
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions, and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. The name of the AMG4PSBLAS group or the names of its contributors may
|
||||
! not be used to endorse or promote products derived from this
|
||||
! software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AMG4PSBLAS GROUP OR ITS CONTRIBUTORS
|
||||
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
! POSSIBILITY OF SUCH DAMAGE.
|
||||
!
|
||||
!
|
||||
module data_input
|
||||
use psb_base_mod, only : psb_spk_, psb_dpk_, psb_ipk_
|
||||
|
||||
interface read_data
|
||||
module procedure read_char, read_int, read_int_array,&
|
||||
& read_double, read_double_array, &
|
||||
& read_single, read_single_array, read_logical,&
|
||||
& string_read_char, string_read_int, string_read_int_array,&
|
||||
& string_read_double, string_read_double_array,&
|
||||
& string_read_single, string_read_single_array, &
|
||||
& string_read_logical
|
||||
end interface read_data
|
||||
interface trim_string
|
||||
module procedure trim_string
|
||||
end interface
|
||||
|
||||
character(len=4096), private :: charbuf
|
||||
character, private, parameter :: def_marker="!"
|
||||
character, private, parameter :: cmt_marker="%"
|
||||
|
||||
contains
|
||||
subroutine get_buffer(file,buffer)
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=*), intent(inout) :: buffer
|
||||
integer :: idx
|
||||
do
|
||||
read(file,'(a)',end=999) buffer
|
||||
buffer = adjustl(buffer)
|
||||
idx=index(charbuf,cmt_marker)
|
||||
if (idx == 1 ) then
|
||||
cycle
|
||||
else
|
||||
exit
|
||||
end if
|
||||
end do
|
||||
999 continue
|
||||
return
|
||||
end subroutine get_buffer
|
||||
|
||||
subroutine read_logical(val,file,marker)
|
||||
logical, intent(out) :: val
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_logical
|
||||
|
||||
subroutine read_char(val,file,marker)
|
||||
character(len=*), intent(out) :: val
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_char
|
||||
|
||||
subroutine read_int(val,file,marker)
|
||||
integer(psb_ipk_), intent(out) :: val
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_int
|
||||
|
||||
subroutine read_int_array(val,file,marker)
|
||||
integer(psb_ipk_), intent(out) :: val(:)
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_int_array
|
||||
|
||||
subroutine read_single(val,file,marker)
|
||||
real(psb_spk_), intent(out) :: val
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_single
|
||||
|
||||
subroutine read_single_array(val,file,marker)
|
||||
real(psb_spk_), intent(out) :: val(:)
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_single_array
|
||||
|
||||
subroutine read_double(val,file,marker)
|
||||
real(psb_dpk_), intent(out) :: val
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_double
|
||||
|
||||
subroutine read_double_array(val,file,marker)
|
||||
real(psb_dpk_), intent(out) :: val(:)
|
||||
integer(psb_ipk_), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
|
||||
call get_buffer(file,charbuf)
|
||||
call read_data(val,charbuf,marker)
|
||||
|
||||
end subroutine read_double_array
|
||||
|
||||
subroutine string_read_char(val,file,marker)
|
||||
character(len=*), intent(out) :: val
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),'(a)') val
|
||||
end subroutine string_read_char
|
||||
|
||||
subroutine string_read_int(val,file,marker)
|
||||
integer(psb_ipk_), intent(out) :: val
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val
|
||||
end subroutine string_read_int
|
||||
|
||||
subroutine string_read_int_array(val,file,marker)
|
||||
integer(psb_ipk_), intent(out) :: val(:)
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val(:)
|
||||
end subroutine string_read_int_array
|
||||
|
||||
subroutine string_read_single(val,file,marker)
|
||||
real(psb_spk_), intent(out) :: val
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val
|
||||
end subroutine string_read_single
|
||||
|
||||
subroutine string_read_single_array(val,file,marker)
|
||||
real(psb_spk_), intent(out) :: val(:)
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val(:)
|
||||
end subroutine string_read_single_array
|
||||
|
||||
subroutine string_read_double(val,file,marker)
|
||||
real(psb_dpk_), intent(out) :: val
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val
|
||||
end subroutine string_read_double
|
||||
|
||||
subroutine string_read_double_array(val,file,marker)
|
||||
real(psb_dpk_), intent(out) :: val(:)
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val(:)
|
||||
end subroutine string_read_double_array
|
||||
|
||||
subroutine string_read_logical(val,file,marker)
|
||||
logical, intent(out) :: val
|
||||
character(len=*), intent(in) :: file
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=1) :: marker_
|
||||
character(len=1024) :: charbuf
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
read(file,'(a)')charbuf
|
||||
charbuf = adjustl(charbuf)
|
||||
idx=index(charbuf,marker_)
|
||||
if (idx == 0) idx = len(charbuf)+1
|
||||
read(charbuf(1:idx-1),*) val
|
||||
end subroutine string_read_logical
|
||||
|
||||
function trim_string(string,marker)
|
||||
character(len=*), intent(in) :: string
|
||||
character(len=1), optional, intent(in) :: marker
|
||||
character(len=len(string)) :: trim_string
|
||||
character(len=1) :: marker_
|
||||
integer(psb_ipk_) :: idx
|
||||
if (present(marker)) then
|
||||
marker_ = marker
|
||||
else
|
||||
marker_ = def_marker
|
||||
end if
|
||||
idx=index(string,marker_)
|
||||
trim_string = adjustl(string(idx:))
|
||||
end function trim_string
|
||||
end module data_input
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
%%%%%%%%%%% General arguments % Lines starting with % are ignored.
|
||||
CSR ! Storage format CSR COO JAD
|
||||
0150 ! IDIM; domain size. Linear system size is IDIM**2
|
||||
POISSON ! PDECOEFF: POISSON, EXP, BOX, GAUSS
|
||||
% ! Coefficients of the PDE
|
||||
CG ! Iterative method:
|
||||
% ! BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES RICHARDSON
|
||||
2 ! ISTOPC
|
||||
00500 ! ITMAX
|
||||
1 ! ITRACE
|
||||
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
||||
1.d-6 ! EPS
|
||||
%%%%%%%%%%% Main preconditioner choices %%%%%%%%%%%%%%%%
|
||||
ML-VBM-VCYCLE-FBGS-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
|
||||
ML ! Preconditioner type: NONE JACOBI GS FBGS BJAC AS ML POLY
|
||||
%
|
||||
%%%%%%%%%%% First smoother (for all levels but coarsest) %%%%%%%%%%%%%%%%
|
||||
FBGS ! Smoother type JACOBI FBGS GS BWGS BJAC AS POLY r 1-level, repeats previous.
|
||||
6 ! Number of sweeps for smoother
|
||||
1 ! degree for polynomial smoother
|
||||
CHEB_4_OPT ! Polynomial variant
|
||||
% Fields to be added for POLY
|
||||
POLY_RHO_EST_POWER ! POLY_RHO_ESTIMATE Currently only POLY_RHO_EST_POWER
|
||||
% POLY_RHO_ESTIMATE_ITERATIONS default = 20
|
||||
% POLY_RHO_BA set to value
|
||||
1.0
|
||||
%
|
||||
0 ! Number of overlap layers for AS preconditioner
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
L1-JACOBI ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
1 ! Inner solver sweeps (GS and JACOBI)
|
||||
LLK ! AINV variant
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
1 ! Inverse Fill level P for INVK
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
%%%%%%%%%%% Second smoother, always ignored for non-ML %%%%%%%%%%%%%%%%
|
||||
NONE ! Second (post) smoother, ignored if NONE
|
||||
6 ! Number of sweeps for (post) smoother
|
||||
1 ! degree for polynomial smoother
|
||||
CHEB_4_OPT ! Polynomial variant
|
||||
POLY_RHO_EST_POWER % POLY_RHO_ESTIMATE Currently only POLY_RHO_EST_POWER
|
||||
% POLY_RHO_ESTIMATE_ITERATIONS default = 20
|
||||
% POLY_RHO_BA set to value
|
||||
1.0
|
||||
0 ! Number of overlap layers for AS preconditioner
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
ILU ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
8 ! Inner solver sweeps (GS and JACOBI)
|
||||
LLK ! AINV variant, ignored otherwise
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
8 ! Inverse Fill level P for INVK
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
%%%%%%%%%%% Multilevel parameters %%%%%%%%%%%%%%%%
|
||||
VCYCLE ! Type of multilevel CYCLE: VCYCLE WCYCLE KCYCLE MULT ADD
|
||||
4 ! Number of outer sweeps for ML
|
||||
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
|
||||
-3 ! Target coarse matrix size per process; if <0, lib default
|
||||
SMOOTHED ! Type of aggregation: SMOOTHED UNSMOOTHED
|
||||
COUPLED ! Parallel aggregation: DEC, SYMDEC, COUPLED
|
||||
MATCHBOXP ! aggregation measure SOC1, MATCHBOXP
|
||||
8 ! Requested size of the aggregates for MATCHBOXP
|
||||
NATURAL ! Ordering of aggregation NATURAL DEGREE
|
||||
-1.5 ! Coarsening ratio, if < 0 use library default
|
||||
FILTER ! Filtering of matrix: FILTER NOFILTER
|
||||
-0.0100d0 ! Smoothed aggregation threshold, ignored if < 0
|
||||
-2 ! Number of thresholds in vector, next line ignored if <= 0
|
||||
0.05 0.025 ! Thresholds
|
||||
%%%%%%%%%%% Coarse level solver %%%%%%%%%%%%%%%%
|
||||
BJAC ! Coarsest-level solver: MUMPS UMF SLU SLUDIST JACOBI GS BJAC
|
||||
ILU ! Coarsest-level subsolver for BJAC: ILU ILUT MILU UMF MUMPS SLU
|
||||
DIST ! Coarsest-level matrix distribution: DIST REPL
|
||||
1 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
|
||||
1.d-4 ! Coarsest-level threshold T for ILU(T,P)
|
||||
1 ! Number of sweeps for JACOBI/GS/BJAC coarsest-level solver
|
||||
%%%%%%%%%% Krylov coarse solver options %%%%%%%%%%
|
||||
FCG ! Krylov method for coarsest level
|
||||
BJAC ! Preconditioner for coarsest level
|
||||
ILU ! Subsolver for coarsest level
|
||||
FALSE ! Is the solver global (TRUE) or local (FALSE)?
|
||||
1.d-4 ! Tolerance
|
||||
-1 ! Restart for Krylov method
|
||||
2 ! Stopping criterion
|
||||
30 ! Maximum number of iterations
|
||||
-1 ! Trace of the lower Krylov iterations
|
||||
0 ! Fill-in for incomplete LU factorization
|
||||
%%%%%%%%%% Dump parms %%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
F ! Dump preconditioner on file
|
||||
1 ! Min level
|
||||
20 ! Max level
|
||||
T ! Dump AC
|
||||
T ! Dump RP
|
||||
F ! Dump TPROL
|
||||
F ! Dump SMOOTHER
|
||||
F ! Dump SOLVER
|
||||
F ! Global numering ?
|
||||
@ -0,0 +1,98 @@
|
||||
%%%%%%%%%%% General arguments % Lines starting with % are ignored.
|
||||
CSR ! Storage format CSR COO JAD
|
||||
0150 ! IDIM; domain size. Linear system size is IDIM**3
|
||||
POISSON ! PDECOEFF: POISSON, EXP, BOX, GAUSS
|
||||
% ! Coefficients of the PDE
|
||||
CG ! Iterative method:
|
||||
% ! BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES RICHARDSON
|
||||
2 ! ISTOPC
|
||||
00500 ! ITMAX
|
||||
1 ! ITRACE
|
||||
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
||||
1.d-6 ! EPS
|
||||
%%%%%%%%%%% Main preconditioner choices %%%%%%%%%%%%%%%%
|
||||
ML-VBM-VCYC-POLY-L1-D-BJAC ! Longer descriptive name for preconditioner (up to 20 chars)
|
||||
ML ! Preconditioner type: NONE JACOBI GS FBGS BJAC AS ML POLY
|
||||
%
|
||||
%%%%%%%%%%% First smoother (for all levels but coarsest) %%%%%%%%%%%%%%%%
|
||||
POLY ! Smoother type JACOBI FBGS GS BWGS BJAC AS POLY r 1-level, repeats previous.
|
||||
6 ! Number of sweeps for smoother
|
||||
6 ! degree for polynomial smoother
|
||||
CHEB_4_OPT ! Polynomial variant
|
||||
% Fields to be added for POLY
|
||||
POLY_RHO_EST_POWER ! POLY_RHO_ESTIMATE Currently only POLY_RHO_EST_POWER
|
||||
% POLY_RHO_ESTIMATE_ITERATIONS default = 20
|
||||
% POLY_RHO_BA set to value
|
||||
1.0
|
||||
%
|
||||
0 ! Number of overlap layers for AS preconditioner
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
L1-JACOBI ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
1 ! Inner solver sweeps (GS and JACOBI)
|
||||
LLK ! AINV variant
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
1 ! Inverse Fill level P for INVK
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
%%%%%%%%%%% Second smoother, always ignored for non-ML %%%%%%%%%%%%%%%%
|
||||
NONE ! Second (post) smoother, ignored if NONE
|
||||
6 ! Number of sweeps for (post) smoother
|
||||
1 ! degree for polynomial smoother
|
||||
CHEB_4_OPT ! Polynomial variant
|
||||
POLY_RHO_EST_POWER % POLY_RHO_ESTIMATE Currently only POLY_RHO_EST_POWER
|
||||
% POLY_RHO_ESTIMATE_ITERATIONS default = 20
|
||||
% POLY_RHO_BA set to value
|
||||
1.0
|
||||
0 ! Number of overlap layers for AS preconditioner
|
||||
HALO ! AS restriction operator: NONE HALO
|
||||
NONE ! AS prolongation operator: NONE SUM AVG
|
||||
L1-JACOBI ! Subdomain solver for BJAC/AS: JACOBI GS BGS ILU ILUT MILU MUMPS SLU UMF
|
||||
1 ! Inner solver sweeps (GS and JACOBI)
|
||||
LLK ! AINV variant
|
||||
0 ! Fill level P for ILU(P) and ILU(T,P)
|
||||
8 ! Inverse Fill level P for INVK
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
%%%%%%%%%%% Multilevel parameters %%%%%%%%%%%%%%%%
|
||||
VCYCLE ! Type of multilevel CYCLE: VCYCLE WCYCLE KCYCLE MULT ADD
|
||||
1 ! Number of outer sweeps for ML
|
||||
-3 ! Max Number of levels in a multilevel preconditioner; if <0, lib default
|
||||
-3 ! Target coarse matrix size per process; if <0, lib default
|
||||
T ! Do remap?
|
||||
SMOOTHED ! Type of aggregation: SMOOTHED UNSMOOTHED
|
||||
DEC !COUPLED ! Parallel aggregation: DEC, SYMDEC, COUPLED
|
||||
SOC1 !MATCHBOXP ! aggregation measure SOC1, MATCHBOXP
|
||||
8 ! Requested size of the aggregates for MATCHBOXP
|
||||
NATURAL ! Ordering of aggregation NATURAL DEGREE
|
||||
-1.5 ! Coarsening ratio, if < 0 use library default
|
||||
FILTER ! Filtering of matrix: FILTER NOFILTER
|
||||
-0.0100d0 ! Smoothed aggregation threshold, ignored if < 0
|
||||
-2 ! Number of thresholds in vector, next line ignored if <= 0
|
||||
0.05 0.025 ! Thresholds
|
||||
%%%%%%%%%%% Coarse level solver %%%%%%%%%%%%%%%%
|
||||
L1-JACOBI ! Coarsest-level solver: MUMPS UMF SLU SLUDIST JACOBI GS BJAC KRM
|
||||
ILU ! Coarsest-level subsolver for BJAC: ILU ILUT MILU UMF MUMPS SLU
|
||||
DIST ! Coarsest-level matrix distribution: DIST REPL
|
||||
1 ! Coarsest-level fillin P for ILU(P) and ILU(T,P)
|
||||
1.d-4 ! Coarsest-level threshold T for ILU(T,P)
|
||||
30 ! Number of sweeps for JACOBI/GS/BJAC coarsest-level solver
|
||||
%%%%%%%%%% Krylov coarse solver options %%%%%%%%%%
|
||||
FCG ! Krylov method for coarsest level
|
||||
BJAC ! Preconditioner for coarsest level
|
||||
ILU ! Subsolver for coarsest level
|
||||
FALSE ! Is the solver global (TRUE) or local (FALSE)?
|
||||
1.d-4 ! Tolerance
|
||||
-1 ! Restart for Krylov method
|
||||
2 ! Stopping criterion
|
||||
30 ! Maximum number of iterations
|
||||
-1 ! Trace of the lower Krylov iterations
|
||||
0 ! Fill-in for incomplete LU factorization
|
||||
%%%%%%%%%%% Dump parms %%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
F ! Dump preconditioner on file
|
||||
1 ! Min level
|
||||
20 ! Max level
|
||||
T ! Dump AC
|
||||
T ! Dump RP
|
||||
F ! Dump TPROL
|
||||
F ! Dump SMOOTHER
|
||||
F ! Dump SOLVER
|
||||
F ! Global numering ?
|
||||
Loading…
Reference in New Issue