|
|
|
@ -1,9 +1,9 @@
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Parallel Sparse BLAS version 3.5
|
|
|
|
! Parallel Sparse BLAS version 3.5
|
|
|
|
! (C) Copyright 2006-2018
|
|
|
|
! (C) Copyright 2006-2018
|
|
|
|
! Salvatore Filippone
|
|
|
|
! Salvatore Filippone
|
|
|
|
! Alfredo Buttari
|
|
|
|
! Alfredo Buttari
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Redistribution and use in source and binary forms, with or without
|
|
|
|
! Redistribution and use in source and binary forms, with or without
|
|
|
|
! modification, are permitted provided that the following conditions
|
|
|
|
! modification, are permitted provided that the following conditions
|
|
|
|
! are met:
|
|
|
|
! are met:
|
|
|
|
@ -15,7 +15,7 @@
|
|
|
|
! 3. The name of the PSBLAS group or the names of its contributors may
|
|
|
|
! 3. The name of the PSBLAS group or the names of its contributors may
|
|
|
|
! not be used to endorse or promote products derived from this
|
|
|
|
! not be used to endorse or promote products derived from this
|
|
|
|
! software without specific written permission.
|
|
|
|
! software without specific written permission.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
@ -27,23 +27,23 @@
|
|
|
|
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
! 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
|
|
|
|
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
! POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
! POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! File: psb_d_pde3d.f90
|
|
|
|
! File: psb_d_pde3d.f90
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Program: psb_d_pde3d
|
|
|
|
! Program: psb_d_pde3d
|
|
|
|
! This sample program solves a linear system obtained by discretizing a
|
|
|
|
! This sample program solves a linear system obtained by discretizing a
|
|
|
|
! PDE with Dirichlet BCs.
|
|
|
|
! PDE with Dirichlet BCs.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! The PDE is a general second order equation in 3d
|
|
|
|
! 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)
|
|
|
|
! a1 dd(u) a2 dd(u) a3 dd(u) b1 d(u) b2 d(u) b3 d(u)
|
|
|
|
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
|
|
|
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
|
|
|
! dxdx dydy dzdz dx dy dz
|
|
|
|
! dxdx dydy dzdz dx dy dz
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! with Dirichlet boundary conditions
|
|
|
|
! with Dirichlet boundary conditions
|
|
|
|
! u = g
|
|
|
|
! u = g
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! on the unit cube 0<=x,y,z<=1.
|
|
|
|
! on the unit cube 0<=x,y,z<=1.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
@ -60,37 +60,37 @@
|
|
|
|
!
|
|
|
|
!
|
|
|
|
module psb_d_pde3d_mod
|
|
|
|
module psb_d_pde3d_mod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use psb_base_mod, only : psb_dpk_, psb_ipk_, psb_lpk_, psb_desc_type,&
|
|
|
|
use psb_base_mod, only : psb_dpk_, psb_ipk_, psb_lpk_, psb_desc_type,&
|
|
|
|
& psb_dspmat_type, psb_d_vect_type, dzero,&
|
|
|
|
& psb_dspmat_type, psb_d_vect_type, dzero,&
|
|
|
|
& psb_d_base_sparse_mat, psb_d_base_vect_type, &
|
|
|
|
& psb_d_base_sparse_mat, psb_d_base_vect_type, &
|
|
|
|
& psb_i_base_vect_type, psb_l_base_vect_type
|
|
|
|
& psb_i_base_vect_type, psb_l_base_vect_type
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
interface
|
|
|
|
function d_func_3d(x,y,z) result(val)
|
|
|
|
function d_func_3d(x,y,z) result(val)
|
|
|
|
import :: psb_dpk_
|
|
|
|
import :: psb_dpk_
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_) :: val
|
|
|
|
real(psb_dpk_) :: val
|
|
|
|
end function d_func_3d
|
|
|
|
end function d_func_3d
|
|
|
|
end interface
|
|
|
|
end interface
|
|
|
|
|
|
|
|
|
|
|
|
interface psb_gen_pde3d
|
|
|
|
interface psb_gen_pde3d
|
|
|
|
module procedure psb_d_gen_pde3d
|
|
|
|
module procedure psb_d_gen_pde3d
|
|
|
|
end interface psb_gen_pde3d
|
|
|
|
end interface psb_gen_pde3d
|
|
|
|
|
|
|
|
|
|
|
|
contains
|
|
|
|
contains
|
|
|
|
|
|
|
|
|
|
|
|
function d_null_func_3d(x,y,z) result(val)
|
|
|
|
function d_null_func_3d(x,y,z) result(val)
|
|
|
|
|
|
|
|
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_) :: val
|
|
|
|
real(psb_dpk_) :: val
|
|
|
|
|
|
|
|
|
|
|
|
val = dzero
|
|
|
|
val = dzero
|
|
|
|
|
|
|
|
|
|
|
|
end function d_null_func_3d
|
|
|
|
end function d_null_func_3d
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! functions parametrizing the differential equation
|
|
|
|
! functions parametrizing the differential equation
|
|
|
|
!
|
|
|
|
!
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Note: b1, b2 and b3 are the coefficients of the first
|
|
|
|
! Note: b1, b2 and b3 are the coefficients of the first
|
|
|
|
@ -103,70 +103,70 @@ contains
|
|
|
|
!
|
|
|
|
!
|
|
|
|
function b1(x,y,z)
|
|
|
|
function b1(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: b1
|
|
|
|
real(psb_dpk_) :: b1
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
b1=dzero
|
|
|
|
b1=dzero
|
|
|
|
end function b1
|
|
|
|
end function b1
|
|
|
|
function b2(x,y,z)
|
|
|
|
function b2(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: b2
|
|
|
|
real(psb_dpk_) :: b2
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
b2=dzero
|
|
|
|
b2=dzero
|
|
|
|
end function b2
|
|
|
|
end function b2
|
|
|
|
function b3(x,y,z)
|
|
|
|
function b3(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: b3
|
|
|
|
real(psb_dpk_) :: b3
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
b3=dzero
|
|
|
|
b3=dzero
|
|
|
|
end function b3
|
|
|
|
end function b3
|
|
|
|
function c(x,y,z)
|
|
|
|
function c(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: c
|
|
|
|
real(psb_dpk_) :: c
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
c=dzero
|
|
|
|
c=dzero
|
|
|
|
end function c
|
|
|
|
end function c
|
|
|
|
function a1(x,y,z)
|
|
|
|
function a1(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: a1
|
|
|
|
real(psb_dpk_) :: a1
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
a1=done/80
|
|
|
|
a1=done/80
|
|
|
|
end function a1
|
|
|
|
end function a1
|
|
|
|
function a2(x,y,z)
|
|
|
|
function a2(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: a2
|
|
|
|
real(psb_dpk_) :: a2
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
a2=done/80
|
|
|
|
a2=done/80
|
|
|
|
end function a2
|
|
|
|
end function a2
|
|
|
|
function a3(x,y,z)
|
|
|
|
function a3(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: a3
|
|
|
|
real(psb_dpk_) :: a3
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
a3=done/80
|
|
|
|
a3=done/80
|
|
|
|
end function a3
|
|
|
|
end function a3
|
|
|
|
function g(x,y,z)
|
|
|
|
function g(x,y,z)
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
use psb_base_mod, only : psb_dpk_, done, dzero
|
|
|
|
implicit none
|
|
|
|
implicit none
|
|
|
|
real(psb_dpk_) :: g
|
|
|
|
real(psb_dpk_) :: g
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
real(psb_dpk_), intent(in) :: x,y,z
|
|
|
|
g = dzero
|
|
|
|
g = dzero
|
|
|
|
if (x == done) then
|
|
|
|
if (x == done) then
|
|
|
|
g = done
|
|
|
|
g = done
|
|
|
|
else if (x == dzero) then
|
|
|
|
else if (x == dzero) then
|
|
|
|
g = exp(y**2-z**2)
|
|
|
|
g = exp(y**2-z**2)
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end function g
|
|
|
|
end function g
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! subroutine to allocate and fill in the coefficient matrix and
|
|
|
|
! subroutine to allocate and fill in the coefficient matrix and
|
|
|
|
! the rhs.
|
|
|
|
! the rhs.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
subroutine psb_d_gen_pde3d(ictxt,idim,a,bv,xv,desc_a,afmt,info,&
|
|
|
|
subroutine psb_d_gen_pde3d(ictxt,idim,a,bv,xv,desc_a,afmt,info,&
|
|
|
|
& f,amold,vmold,imold,partition,nrl,iv)
|
|
|
|
& f,amold,vmold,imold,partition,nrl,iv)
|
|
|
|
@ -174,13 +174,13 @@ contains
|
|
|
|
use psb_util_mod
|
|
|
|
use psb_util_mod
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Discretizes the partial differential equation
|
|
|
|
! Discretizes the partial differential equation
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! a1 dd(u) a2 dd(u) a3 dd(u) b1 d(u) b2 d(u) b3 d(u)
|
|
|
|
! a1 dd(u) a2 dd(u) a3 dd(u) b1 d(u) b2 d(u) b3 d(u)
|
|
|
|
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
|
|
|
! - ------ - ------ - ------ + ----- + ------ + ------ + c u = f
|
|
|
|
! dxdx dydy dzdz dx dy dz
|
|
|
|
! dxdx dydy dzdz dx dy dz
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! with Dirichlet boundary conditions
|
|
|
|
! with Dirichlet boundary conditions
|
|
|
|
! u = g
|
|
|
|
! u = g
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! on the unit cube 0<=x,y,z<=1.
|
|
|
|
! on the unit cube 0<=x,y,z<=1.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
@ -196,7 +196,7 @@ contains
|
|
|
|
character(len=*) :: afmt
|
|
|
|
character(len=*) :: afmt
|
|
|
|
procedure(d_func_3d), optional :: f
|
|
|
|
procedure(d_func_3d), optional :: f
|
|
|
|
class(psb_d_base_sparse_mat), optional :: amold
|
|
|
|
class(psb_d_base_sparse_mat), optional :: amold
|
|
|
|
class(psb_d_base_vect_type), optional :: vmold
|
|
|
|
class(psb_d_base_vect_type), optional :: vmold
|
|
|
|
class(psb_i_base_vect_type), optional :: imold
|
|
|
|
class(psb_i_base_vect_type), optional :: imold
|
|
|
|
integer(psb_ipk_), optional :: partition, nrl,iv(:)
|
|
|
|
integer(psb_ipk_), optional :: partition, nrl,iv(:)
|
|
|
|
|
|
|
|
|
|
|
|
@ -237,7 +237,7 @@ contains
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (present(f)) then
|
|
|
|
if (present(f)) then
|
|
|
|
f_ => f
|
|
|
|
f_ => f
|
|
|
|
else
|
|
|
|
else
|
|
|
|
f_ => d_null_func_3d
|
|
|
|
f_ => d_null_func_3d
|
|
|
|
@ -257,10 +257,10 @@ contains
|
|
|
|
else
|
|
|
|
else
|
|
|
|
partition_ = 3
|
|
|
|
partition_ = 3
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
! initialize array descriptor and sparse matrix storage. provide an
|
|
|
|
! initialize array descriptor and sparse matrix storage. provide an
|
|
|
|
! estimate of the number of non zeroes
|
|
|
|
! estimate of the number of non zeroes
|
|
|
|
|
|
|
|
|
|
|
|
m = (1_psb_lpk_*idim)*idim*idim
|
|
|
|
m = (1_psb_lpk_*idim)*idim*idim
|
|
|
|
n = m
|
|
|
|
n = m
|
|
|
|
nnz = ((n*7)/(np))
|
|
|
|
nnz = ((n*7)/(np))
|
|
|
|
@ -268,8 +268,8 @@ contains
|
|
|
|
t0 = psb_wtime()
|
|
|
|
t0 = psb_wtime()
|
|
|
|
select case(partition_)
|
|
|
|
select case(partition_)
|
|
|
|
case(1)
|
|
|
|
case(1)
|
|
|
|
! A BLOCK partition
|
|
|
|
! A BLOCK partition
|
|
|
|
if (present(nrl)) then
|
|
|
|
if (present(nrl)) then
|
|
|
|
nr = nrl
|
|
|
|
nr = nrl
|
|
|
|
else
|
|
|
|
else
|
|
|
|
!
|
|
|
|
!
|
|
|
|
@ -280,46 +280,46 @@ contains
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
nt = nr
|
|
|
|
nt = nr
|
|
|
|
call psb_sum(ictxt,nt)
|
|
|
|
call psb_sum(ictxt,nt)
|
|
|
|
if (nt /= m) then
|
|
|
|
if (nt /= m) then
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error ',nr,nt,m
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error ',nr,nt,m
|
|
|
|
info = -1
|
|
|
|
info = -1
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! First example of use of CDALL: specify for each process a number of
|
|
|
|
! First example of use of CDALL: specify for each process a number of
|
|
|
|
! contiguous rows
|
|
|
|
! contiguous rows
|
|
|
|
!
|
|
|
|
!
|
|
|
|
call psb_cdall(ictxt,desc_a,info,nl=nr)
|
|
|
|
call psb_cdall(ictxt,desc_a,info,nl=nr)
|
|
|
|
myidx = desc_a%get_global_indices()
|
|
|
|
myidx = desc_a%get_global_indices()
|
|
|
|
nlr = size(myidx)
|
|
|
|
nlr = size(myidx)
|
|
|
|
|
|
|
|
|
|
|
|
case(2)
|
|
|
|
case(2)
|
|
|
|
! A partition defined by the user through IV
|
|
|
|
! A partition defined by the user through IV
|
|
|
|
|
|
|
|
|
|
|
|
if (present(iv)) then
|
|
|
|
if (present(iv)) then
|
|
|
|
if (size(iv) /= m) then
|
|
|
|
if (size(iv) /= m) then
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error: wrong IV size',size(iv),m
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error: wrong IV size',size(iv),m
|
|
|
|
info = -1
|
|
|
|
info = -1
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
else
|
|
|
|
else
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error: IV not present'
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error: IV not present'
|
|
|
|
info = -1
|
|
|
|
info = -1
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Second example of use of CDALL: specify for each row the
|
|
|
|
! Second example of use of CDALL: specify for each row the
|
|
|
|
! process that owns it
|
|
|
|
! process that owns it
|
|
|
|
!
|
|
|
|
!
|
|
|
|
call psb_cdall(ictxt,desc_a,info,vg=iv)
|
|
|
|
call psb_cdall(ictxt,desc_a,info,vg=iv)
|
|
|
|
myidx = desc_a%get_global_indices()
|
|
|
|
myidx = desc_a%get_global_indices()
|
|
|
|
nlr = size(myidx)
|
|
|
|
nlr = size(myidx)
|
|
|
|
@ -335,7 +335,7 @@ contains
|
|
|
|
npz = npdims(3)
|
|
|
|
npz = npdims(3)
|
|
|
|
|
|
|
|
|
|
|
|
allocate(bndx(0:npx),bndy(0:npy),bndz(0:npz))
|
|
|
|
allocate(bndx(0:npx),bndy(0:npy),bndz(0:npz))
|
|
|
|
! We can reuse idx2ijk for process indices as well.
|
|
|
|
! We can reuse idx2ijk for process indices as well.
|
|
|
|
call idx2ijk(iamx,iamy,iamz,iam,npx,npy,npz,base=0)
|
|
|
|
call idx2ijk(iamx,iamy,iamz,iam,npx,npy,npz,base=0)
|
|
|
|
! Now let's split the 3D cube in hexahedra
|
|
|
|
! Now let's split the 3D cube in hexahedra
|
|
|
|
call dist1Didx(bndx,idim,npx)
|
|
|
|
call dist1Didx(bndx,idim,npx)
|
|
|
|
@ -345,7 +345,7 @@ contains
|
|
|
|
call dist1Didx(bndz,idim,npz)
|
|
|
|
call dist1Didx(bndz,idim,npz)
|
|
|
|
mynz = bndz(iamz+1)-bndz(iamz)
|
|
|
|
mynz = bndz(iamz+1)-bndz(iamz)
|
|
|
|
|
|
|
|
|
|
|
|
! How many indices do I own?
|
|
|
|
! How many indices do I own?
|
|
|
|
nlr = mynx*myny*mynz
|
|
|
|
nlr = mynx*myny*mynz
|
|
|
|
allocate(myidx(nlr))
|
|
|
|
allocate(myidx(nlr))
|
|
|
|
! Now, let's generate the list of indices I own
|
|
|
|
! Now, let's generate the list of indices I own
|
|
|
|
@ -369,9 +369,9 @@ contains
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Third example of use of CDALL: specify for each process
|
|
|
|
! Third example of use of CDALL: specify for each process
|
|
|
|
! the set of global indices it owns.
|
|
|
|
! the set of global indices it owns.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
call psb_cdall(ictxt,desc_a,info,vl=myidx)
|
|
|
|
call psb_cdall(ictxt,desc_a,info,vl=myidx)
|
|
|
|
|
|
|
|
|
|
|
|
case default
|
|
|
|
case default
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error: should not get here'
|
|
|
|
write(psb_err_unit,*) iam, 'Initialization error: should not get here'
|
|
|
|
info = -1
|
|
|
|
info = -1
|
|
|
|
@ -380,9 +380,9 @@ contains
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end select
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (info == psb_success_) call psb_spall(a,desc_a,info,nnz=nnz)
|
|
|
|
if (info == psb_success_) call psb_spall(a,desc_a,info,nnz=nnz)
|
|
|
|
! define rhs from boundary conditions; also build initial guess
|
|
|
|
! define rhs from boundary conditions; also build initial guess
|
|
|
|
if (info == psb_success_) call psb_geall(xv,desc_a,info)
|
|
|
|
if (info == psb_success_) call psb_geall(xv,desc_a,info)
|
|
|
|
if (info == psb_success_) call psb_geall(bv,desc_a,info)
|
|
|
|
if (info == psb_success_) call psb_geall(bv,desc_a,info)
|
|
|
|
|
|
|
|
|
|
|
|
@ -397,12 +397,12 @@ contains
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
! we build an auxiliary matrix consisting of one row at a
|
|
|
|
! we build an auxiliary matrix consisting of one row at a
|
|
|
|
! time; just a small matrix. might be extended to generate
|
|
|
|
! time; just a small matrix. might be extended to generate
|
|
|
|
! a bunch of rows per call.
|
|
|
|
! a bunch of rows per call.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
allocate(val(20*nb),irow(20*nb),&
|
|
|
|
allocate(val(20*nb),irow(20*nb),&
|
|
|
|
&icol(20*nb),stat=info)
|
|
|
|
&icol(20*nb),stat=info)
|
|
|
|
if (info /= psb_success_ ) then
|
|
|
|
if (info /= psb_success_ ) then
|
|
|
|
info=psb_err_alloc_dealloc_
|
|
|
|
info=psb_err_alloc_dealloc_
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
call psb_errpush(info,name)
|
|
|
|
goto 9999
|
|
|
|
goto 9999
|
|
|
|
@ -415,11 +415,11 @@ contains
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
t1 = psb_wtime()
|
|
|
|
t1 = psb_wtime()
|
|
|
|
do ii=1, nlr,nb
|
|
|
|
do ii=1, nlr,nb
|
|
|
|
ib = min(nb,nlr-ii+1)
|
|
|
|
ib = min(nb,nlr-ii+1)
|
|
|
|
icoeff = 1
|
|
|
|
icoeff = 1
|
|
|
|
do k=1,ib
|
|
|
|
do k=1,ib
|
|
|
|
i=ii+k-1
|
|
|
|
i=ii+k-1
|
|
|
|
! local matrix pointer
|
|
|
|
! local matrix pointer
|
|
|
|
glob_row=myidx(i)
|
|
|
|
glob_row=myidx(i)
|
|
|
|
! compute gridpoint coordinates
|
|
|
|
! compute gridpoint coordinates
|
|
|
|
call idx2ijk(ix,iy,iz,glob_row,idim,idim,idim)
|
|
|
|
call idx2ijk(ix,iy,iz,glob_row,idim,idim,idim)
|
|
|
|
@ -429,11 +429,11 @@ contains
|
|
|
|
z = (iz-1)*deltah
|
|
|
|
z = (iz-1)*deltah
|
|
|
|
zt(k) = f_(x,y,z)
|
|
|
|
zt(k) = f_(x,y,z)
|
|
|
|
! internal point: build discretization
|
|
|
|
! internal point: build discretization
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! term depending on (x-1,y,z)
|
|
|
|
! term depending on (x-1,y,z)
|
|
|
|
!
|
|
|
|
!
|
|
|
|
val(icoeff) = -a1(x,y,z)/sqdeltah-b1(x,y,z)/deltah2
|
|
|
|
val(icoeff) = -a1(x,y,z)/sqdeltah-b1(x,y,z)/deltah2
|
|
|
|
if (ix == 1) then
|
|
|
|
if (ix == 1) then
|
|
|
|
zt(k) = g(dzero,y,z)*(-val(icoeff)) + zt(k)
|
|
|
|
zt(k) = g(dzero,y,z)*(-val(icoeff)) + zt(k)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call ijk2idx(icol(icoeff),ix-1,iy,iz,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix-1,iy,iz,idim,idim,idim)
|
|
|
|
@ -442,19 +442,19 @@ contains
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
! term depending on (x,y-1,z)
|
|
|
|
! term depending on (x,y-1,z)
|
|
|
|
val(icoeff) = -a2(x,y,z)/sqdeltah-b2(x,y,z)/deltah2
|
|
|
|
val(icoeff) = -a2(x,y,z)/sqdeltah-b2(x,y,z)/deltah2
|
|
|
|
if (iy == 1) then
|
|
|
|
if (iy == 1) then
|
|
|
|
zt(k) = g(x,dzero,z)*(-val(icoeff)) + zt(k)
|
|
|
|
zt(k) = g(x,dzero,z)*(-val(icoeff)) + zt(k)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy-1,iz,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy-1,iz,idim,idim,idim)
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
icoeff = icoeff+1
|
|
|
|
icoeff = icoeff+1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
! term depending on (x,y,z-1)
|
|
|
|
! term depending on (x,y,z-1)
|
|
|
|
val(icoeff)=-a3(x,y,z)/sqdeltah-b3(x,y,z)/deltah2
|
|
|
|
val(icoeff)=-a3(x,y,z)/sqdeltah-b3(x,y,z)/deltah2
|
|
|
|
if (iz == 1) then
|
|
|
|
if (iz == 1) then
|
|
|
|
zt(k) = g(x,y,dzero)*(-val(icoeff)) + zt(k)
|
|
|
|
zt(k) = g(x,y,dzero)*(-val(icoeff)) + zt(k)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy,iz-1,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy,iz-1,idim,idim,idim)
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
icoeff = icoeff+1
|
|
|
|
icoeff = icoeff+1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
@ -462,33 +462,33 @@ contains
|
|
|
|
! term depending on (x,y,z)
|
|
|
|
! term depending on (x,y,z)
|
|
|
|
val(icoeff)=(2*done)*(a1(x,y,z)+a2(x,y,z)+a3(x,y,z))/sqdeltah &
|
|
|
|
val(icoeff)=(2*done)*(a1(x,y,z)+a2(x,y,z)+a3(x,y,z))/sqdeltah &
|
|
|
|
& + c(x,y,z)
|
|
|
|
& + c(x,y,z)
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy,iz,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy,iz,idim,idim,idim)
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
icoeff = icoeff+1
|
|
|
|
icoeff = icoeff+1
|
|
|
|
! term depending on (x,y,z+1)
|
|
|
|
! term depending on (x,y,z+1)
|
|
|
|
val(icoeff)=-a3(x,y,z)/sqdeltah+b3(x,y,z)/deltah2
|
|
|
|
val(icoeff)=-a3(x,y,z)/sqdeltah+b3(x,y,z)/deltah2
|
|
|
|
if (iz == idim) then
|
|
|
|
if (iz == idim) then
|
|
|
|
zt(k) = g(x,y,done)*(-val(icoeff)) + zt(k)
|
|
|
|
zt(k) = g(x,y,done)*(-val(icoeff)) + zt(k)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy,iz+1,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy,iz+1,idim,idim,idim)
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
icoeff = icoeff+1
|
|
|
|
icoeff = icoeff+1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
! term depending on (x,y+1,z)
|
|
|
|
! term depending on (x,y+1,z)
|
|
|
|
val(icoeff)=-a2(x,y,z)/sqdeltah+b2(x,y,z)/deltah2
|
|
|
|
val(icoeff)=-a2(x,y,z)/sqdeltah+b2(x,y,z)/deltah2
|
|
|
|
if (iy == idim) then
|
|
|
|
if (iy == idim) then
|
|
|
|
zt(k) = g(x,done,z)*(-val(icoeff)) + zt(k)
|
|
|
|
zt(k) = g(x,done,z)*(-val(icoeff)) + zt(k)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy+1,iz,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix,iy+1,iz,idim,idim,idim)
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
icoeff = icoeff+1
|
|
|
|
icoeff = icoeff+1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
! term depending on (x+1,y,z)
|
|
|
|
! term depending on (x+1,y,z)
|
|
|
|
val(icoeff)=-a1(x,y,z)/sqdeltah+b1(x,y,z)/deltah2
|
|
|
|
val(icoeff)=-a1(x,y,z)/sqdeltah+b1(x,y,z)/deltah2
|
|
|
|
if (ix==idim) then
|
|
|
|
if (ix==idim) then
|
|
|
|
zt(k) = g(done,y,z)*(-val(icoeff)) + zt(k)
|
|
|
|
zt(k) = g(done,y,z)*(-val(icoeff)) + zt(k)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call ijk2idx(icol(icoeff),ix+1,iy,iz,idim,idim,idim)
|
|
|
|
call ijk2idx(icol(icoeff),ix+1,iy,iz,idim,idim,idim)
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
irow(icoeff) = glob_row
|
|
|
|
icoeff = icoeff+1
|
|
|
|
icoeff = icoeff+1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
@ -519,8 +519,8 @@ contains
|
|
|
|
tcdasb = psb_wtime()-t1
|
|
|
|
tcdasb = psb_wtime()-t1
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
t1 = psb_wtime()
|
|
|
|
t1 = psb_wtime()
|
|
|
|
if (info == psb_success_) then
|
|
|
|
if (info == psb_success_) then
|
|
|
|
if (present(amold)) then
|
|
|
|
if (present(amold)) then
|
|
|
|
call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,mold=amold)
|
|
|
|
call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,mold=amold)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
|
|
|
|
call psb_spasb(a,desc_a,info,dupl=psb_dupl_err_,afmt=afmt)
|
|
|
|
@ -543,7 +543,7 @@ contains
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
tasb = psb_wtime()-t1
|
|
|
|
tasb = psb_wtime()-t1
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
ttot = psb_wtime() - t0
|
|
|
|
ttot = psb_wtime() - t0
|
|
|
|
|
|
|
|
|
|
|
|
call psb_amx(ictxt,talc)
|
|
|
|
call psb_amx(ictxt,talc)
|
|
|
|
call psb_amx(ictxt,tgen)
|
|
|
|
call psb_amx(ictxt,tgen)
|
|
|
|
@ -585,9 +585,9 @@ program psb_d_pde3d
|
|
|
|
integer(psb_ipk_) :: idim
|
|
|
|
integer(psb_ipk_) :: idim
|
|
|
|
integer(psb_epk_) :: system_size
|
|
|
|
integer(psb_epk_) :: system_size
|
|
|
|
|
|
|
|
|
|
|
|
! miscellaneous
|
|
|
|
! miscellaneous
|
|
|
|
real(psb_dpk_), parameter :: one = done
|
|
|
|
real(psb_dpk_), parameter :: one = done
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec
|
|
|
|
real(psb_dpk_) :: t1, t2, tprec
|
|
|
|
|
|
|
|
|
|
|
|
! sparse matrix and preconditioner
|
|
|
|
! sparse matrix and preconditioner
|
|
|
|
type(psb_dspmat_type) :: a
|
|
|
|
type(psb_dspmat_type) :: a
|
|
|
|
@ -604,6 +604,14 @@ program psb_d_pde3d
|
|
|
|
integer(psb_epk_) :: amatsize, precsize, descsize, d2size
|
|
|
|
integer(psb_epk_) :: amatsize, precsize, descsize, d2size
|
|
|
|
real(psb_dpk_) :: err, eps
|
|
|
|
real(psb_dpk_) :: err, eps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
! Parameters for solvers in Block-Jacobi preconditioner
|
|
|
|
|
|
|
|
type ainvparms
|
|
|
|
|
|
|
|
character(len=12) :: alg, orth_alg
|
|
|
|
|
|
|
|
integer(psb_ipk_) :: fill, inv_fill
|
|
|
|
|
|
|
|
real(psb_dpk_) :: thresh, inv_thresh
|
|
|
|
|
|
|
|
end type ainvparms
|
|
|
|
|
|
|
|
type(ainvparms) :: parms
|
|
|
|
|
|
|
|
|
|
|
|
! other variables
|
|
|
|
! other variables
|
|
|
|
integer(psb_ipk_) :: info, i
|
|
|
|
integer(psb_ipk_) :: info, i
|
|
|
|
character(len=20) :: name,ch_err
|
|
|
|
character(len=20) :: name,ch_err
|
|
|
|
@ -615,7 +623,7 @@ program psb_d_pde3d
|
|
|
|
call psb_init(ictxt)
|
|
|
|
call psb_init(ictxt)
|
|
|
|
call psb_info(ictxt,iam,np)
|
|
|
|
call psb_info(ictxt,iam,np)
|
|
|
|
|
|
|
|
|
|
|
|
if (iam < 0) then
|
|
|
|
if (iam < 0) then
|
|
|
|
! This should not happen, but just in case
|
|
|
|
! This should not happen, but just in case
|
|
|
|
call psb_exit(ictxt)
|
|
|
|
call psb_exit(ictxt)
|
|
|
|
stop
|
|
|
|
stop
|
|
|
|
@ -626,21 +634,21 @@ program psb_d_pde3d
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! Hello world
|
|
|
|
! Hello world
|
|
|
|
!
|
|
|
|
!
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
if (iam == psb_root_) then
|
|
|
|
write(*,*) 'Welcome to PSBLAS version: ',psb_version_string_
|
|
|
|
write(*,*) 'Welcome to PSBLAS version: ',psb_version_string_
|
|
|
|
write(*,*) 'This is the ',trim(name),' sample program'
|
|
|
|
write(*,*) 'This is the ',trim(name),' sample program'
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! get parameters
|
|
|
|
! get parameters
|
|
|
|
!
|
|
|
|
!
|
|
|
|
call get_parms(ictxt,kmethd,ptype,afmt,idim,istopc,itmax,itrace,irst,ipart)
|
|
|
|
call get_parms(ictxt,kmethd,ptype,afmt,idim,istopc,itmax,itrace,irst,ipart,parms)
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! allocate and fill in the coefficient matrix, rhs and initial guess
|
|
|
|
! allocate and fill in the coefficient matrix, rhs and initial guess
|
|
|
|
!
|
|
|
|
!
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
t1 = psb_wtime()
|
|
|
|
t1 = psb_wtime()
|
|
|
|
call psb_gen_pde3d(ictxt,idim,a,bv,xxv,desc_a,afmt,info,partition=ipart)
|
|
|
|
call psb_gen_pde3d(ictxt,idim,a,bv,xxv,desc_a,afmt,info,partition=ipart)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
t2 = psb_wtime() - t1
|
|
|
|
t2 = psb_wtime() - t1
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
@ -653,7 +661,7 @@ program psb_d_pde3d
|
|
|
|
if (iam == psb_root_) write(psb_out_unit,'(" ")')
|
|
|
|
if (iam == psb_root_) write(psb_out_unit,'(" ")')
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! prepare the preconditioner.
|
|
|
|
! prepare the preconditioner.
|
|
|
|
!
|
|
|
|
!
|
|
|
|
if(iam == psb_root_) write(psb_out_unit,'("Setting preconditioner to : ",a)')ptype
|
|
|
|
if(iam == psb_root_) write(psb_out_unit,'("Setting preconditioner to : ",a)')ptype
|
|
|
|
call prec%init(ictxt,ptype,info)
|
|
|
|
call prec%init(ictxt,ptype,info)
|
|
|
|
|
|
|
|
|
|
|
|
@ -675,14 +683,14 @@ program psb_d_pde3d
|
|
|
|
if (iam == psb_root_) write(psb_out_unit,'(" ")')
|
|
|
|
if (iam == psb_root_) write(psb_out_unit,'(" ")')
|
|
|
|
call prec%descr()
|
|
|
|
call prec%descr()
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! iterative method parameters
|
|
|
|
! iterative method parameters
|
|
|
|
!
|
|
|
|
!
|
|
|
|
if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd
|
|
|
|
if(iam == psb_root_) write(psb_out_unit,'("Calling iterative method ",a)')kmethd
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
call psb_barrier(ictxt)
|
|
|
|
t1 = psb_wtime()
|
|
|
|
t1 = psb_wtime()
|
|
|
|
eps = 1.d-6
|
|
|
|
eps = 1.d-6
|
|
|
|
call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,&
|
|
|
|
call psb_krylov(kmethd,a,prec,bv,xxv,eps,desc_a,info,&
|
|
|
|
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)
|
|
|
|
& itmax=itmax,iter=iter,err=err,itrace=itrace,istop=istopc,irst=irst)
|
|
|
|
|
|
|
|
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
if(info /= psb_success_) then
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
info=psb_err_from_subroutine_
|
|
|
|
@ -712,14 +720,14 @@ program psb_d_pde3d
|
|
|
|
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)')err
|
|
|
|
write(psb_out_unit,'("Convergence indicator on exit : ",es12.5)')err
|
|
|
|
write(psb_out_unit,'("Info on exit : ",i12)')info
|
|
|
|
write(psb_out_unit,'("Info on exit : ",i12)')info
|
|
|
|
write(psb_out_unit,'("Total memory occupation for A: ",i12)')amatsize
|
|
|
|
write(psb_out_unit,'("Total memory occupation for A: ",i12)')amatsize
|
|
|
|
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)')precsize
|
|
|
|
write(psb_out_unit,'("Total memory occupation for PREC: ",i12)')precsize
|
|
|
|
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)')descsize
|
|
|
|
write(psb_out_unit,'("Total memory occupation for DESC_A: ",i12)')descsize
|
|
|
|
write(psb_out_unit,'("Storage format for A: ",a)') a%get_fmt()
|
|
|
|
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()
|
|
|
|
write(psb_out_unit,'("Storage format for DESC_A: ",a)') desc_a%get_fmt()
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! cleanup storage and exit
|
|
|
|
! cleanup storage and exit
|
|
|
|
!
|
|
|
|
!
|
|
|
|
call psb_gefree(bv,desc_a,info)
|
|
|
|
call psb_gefree(bv,desc_a,info)
|
|
|
|
@ -745,13 +753,15 @@ contains
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! get iteration parameters from standard input
|
|
|
|
! get iteration parameters from standard input
|
|
|
|
!
|
|
|
|
!
|
|
|
|
subroutine get_parms(ictxt,kmethd,ptype,afmt,idim,istopc,itmax,itrace,irst,ipart)
|
|
|
|
subroutine get_parms(ictxt,kmethd,ptype,afmt,idim,istopc,&
|
|
|
|
|
|
|
|
itmax,itrace,irst,ipart,parms)
|
|
|
|
integer(psb_ipk_) :: ictxt
|
|
|
|
integer(psb_ipk_) :: ictxt
|
|
|
|
character(len=*) :: kmethd, ptype, afmt
|
|
|
|
character(len=*) :: kmethd, ptype, afmt
|
|
|
|
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst,ipart
|
|
|
|
integer(psb_ipk_) :: idim, istopc,itmax,itrace,irst,ipart
|
|
|
|
integer(psb_ipk_) :: np, iam
|
|
|
|
integer(psb_ipk_) :: np, iam
|
|
|
|
integer(psb_ipk_) :: ip, inp_unit
|
|
|
|
integer(psb_ipk_) :: ip, inp_unit
|
|
|
|
character(len=1024) :: filename
|
|
|
|
character(len=1024) :: filename
|
|
|
|
|
|
|
|
type(ainvparms) :: parms
|
|
|
|
|
|
|
|
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
call psb_info(ictxt, iam, np)
|
|
|
|
|
|
|
|
|
|
|
|
@ -780,12 +790,12 @@ contains
|
|
|
|
if (ip >= 4) then
|
|
|
|
if (ip >= 4) then
|
|
|
|
read(inp_unit,*) ipart
|
|
|
|
read(inp_unit,*) ipart
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ipart = 3
|
|
|
|
ipart = 3
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if (ip >= 5) then
|
|
|
|
if (ip >= 5) then
|
|
|
|
read(inp_unit,*) istopc
|
|
|
|
read(inp_unit,*) istopc
|
|
|
|
else
|
|
|
|
else
|
|
|
|
istopc=1
|
|
|
|
istopc=1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if (ip >= 6) then
|
|
|
|
if (ip >= 6) then
|
|
|
|
read(inp_unit,*) itmax
|
|
|
|
read(inp_unit,*) itmax
|
|
|
|
@ -802,8 +812,23 @@ contains
|
|
|
|
else
|
|
|
|
else
|
|
|
|
irst=1
|
|
|
|
irst=1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if (ip >= 9) then
|
|
|
|
|
|
|
|
read(psb_inp_unit,*) parms%alg
|
|
|
|
|
|
|
|
read(psb_inp_unit,*) parms%fill
|
|
|
|
|
|
|
|
read(psb_inp_unit,*) parms%inv_fill
|
|
|
|
|
|
|
|
read(psb_inp_unit,*) parms%thresh
|
|
|
|
|
|
|
|
read(psb_inp_unit,*) parms%inv_thresh
|
|
|
|
|
|
|
|
read(psb_inp_unit,*) parms%orth_alg
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
parms%alg = 'ILU' ! AINV variant: ILU,ILUT,MILU,INVK,AINVT,AORTH
|
|
|
|
|
|
|
|
parms%fill = 0 ! Fill in for forward factorization
|
|
|
|
|
|
|
|
parms%inv_fill = 1 ! Fill in for inverse factorization
|
|
|
|
|
|
|
|
parms%thresh = 1E-1_psb_dpk_ ! Threshold for forward factorization
|
|
|
|
|
|
|
|
parms%inv_thresh = 1E-1_psb_dpk_ ! Threshold for inverse factorization
|
|
|
|
|
|
|
|
parms%orth_alg = 'LLK' ! What orthogonalization algorithm?
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Solving matrix : ell1")')
|
|
|
|
write(psb_out_unit,'("Solving matrix : ell1")')
|
|
|
|
write(psb_out_unit,&
|
|
|
|
write(psb_out_unit,&
|
|
|
|
& '("Grid dimensions : ",i4," x ",i4," x ",i4)') &
|
|
|
|
& '("Grid dimensions : ",i4," x ",i4," x ",i4)') &
|
|
|
|
& idim,idim,idim
|
|
|
|
& idim,idim,idim
|
|
|
|
@ -818,11 +843,28 @@ contains
|
|
|
|
write(psb_out_unit,'("Unknown data distrbution, defaulting to 3D")')
|
|
|
|
write(psb_out_unit,'("Unknown data distrbution, defaulting to 3D")')
|
|
|
|
end select
|
|
|
|
end select
|
|
|
|
write(psb_out_unit,'("Preconditioner : ",a)') ptype
|
|
|
|
write(psb_out_unit,'("Preconditioner : ",a)') ptype
|
|
|
|
|
|
|
|
if( psb_toupper(ptype) == "BJAC" ) then
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Block subsolver : ",a)') parms%alg
|
|
|
|
|
|
|
|
select case (psb_toupper(parms%alg))
|
|
|
|
|
|
|
|
case ('ILU','ILUT','MILU')
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Fill in : ",i0)') parms%fill
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Threshold : ",e2.2)') parms%thresh
|
|
|
|
|
|
|
|
case ('INVK')
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Fill : ",i0)') parms%fill
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Threshold : ",e2.2)') parms%thresh
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Invese Fill : ",i0)') parms%inv_fill
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Inverse Threshold : ",e2.2)') parms%inv_thresh
|
|
|
|
|
|
|
|
case ('AINVT','AORTH')
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Inverse Threshold : ",e2.2)') parms%inv_thresh
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
write(psb_out_unit,'("Unknown diagonal solver")')
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
end if
|
|
|
|
write(psb_out_unit,'("Iterative method : ",a)') kmethd
|
|
|
|
write(psb_out_unit,'("Iterative method : ",a)') kmethd
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
write(psb_out_unit,'(" ")')
|
|
|
|
else
|
|
|
|
else
|
|
|
|
! wrong number of parameter, print an error message and exit
|
|
|
|
! wrong number of parameter, print an error message and exit
|
|
|
|
call pr_usage(izero)
|
|
|
|
call pr_usage(izero)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
call psb_abort(ictxt)
|
|
|
|
stop 1
|
|
|
|
stop 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
@ -841,20 +883,26 @@ contains
|
|
|
|
call psb_bcast(ictxt,itmax)
|
|
|
|
call psb_bcast(ictxt,itmax)
|
|
|
|
call psb_bcast(ictxt,itrace)
|
|
|
|
call psb_bcast(ictxt,itrace)
|
|
|
|
call psb_bcast(ictxt,irst)
|
|
|
|
call psb_bcast(ictxt,irst)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,parms%alg)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,parms%fill)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,parms%inv_fill)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,parms%thresh)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,parms%inv_thresh)
|
|
|
|
|
|
|
|
call psb_bcast(ictxt,parms%orth_alg)
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
end subroutine get_parms
|
|
|
|
end subroutine get_parms
|
|
|
|
!
|
|
|
|
!
|
|
|
|
! print an error message
|
|
|
|
! print an error message
|
|
|
|
!
|
|
|
|
!
|
|
|
|
subroutine pr_usage(iout)
|
|
|
|
subroutine pr_usage(iout)
|
|
|
|
integer(psb_ipk_) :: iout
|
|
|
|
integer(psb_ipk_) :: iout
|
|
|
|
write(iout,*)'incorrect parameter(s) found'
|
|
|
|
write(iout,*)'incorrect parameter(s) found'
|
|
|
|
write(iout,*)' usage: pde3d90 methd prec dim &
|
|
|
|
write(iout,*)' usage: pde3d90 methd prec dim &
|
|
|
|
&[istop itmax itrace]'
|
|
|
|
&[istop itmax itrace]'
|
|
|
|
write(iout,*)' where:'
|
|
|
|
write(iout,*)' where:'
|
|
|
|
write(iout,*)' methd: cgstab cgs rgmres bicgstabl'
|
|
|
|
write(iout,*)' methd: cgstab cgs rgmres bicgstabl'
|
|
|
|
write(iout,*)' prec : bjac diag none'
|
|
|
|
write(iout,*)' prec : bjac diag none'
|
|
|
|
write(iout,*)' dim number of points along each axis'
|
|
|
|
write(iout,*)' dim number of points along each axis'
|
|
|
|
write(iout,*)' the size of the resulting linear '
|
|
|
|
write(iout,*)' the size of the resulting linear '
|
|
|
|
@ -862,11 +910,9 @@ contains
|
|
|
|
write(iout,*)' ipart data partition 1 3 '
|
|
|
|
write(iout,*)' ipart data partition 1 3 '
|
|
|
|
write(iout,*)' istop stopping criterion 1, 2 '
|
|
|
|
write(iout,*)' istop stopping criterion 1, 2 '
|
|
|
|
write(iout,*)' itmax maximum number of iterations [500] '
|
|
|
|
write(iout,*)' itmax maximum number of iterations [500] '
|
|
|
|
write(iout,*)' itrace <=0 (no tracing, default) or '
|
|
|
|
write(iout,*)' itrace <=0 (no tracing, default) or '
|
|
|
|
write(iout,*)' >= 1 do tracing every itrace'
|
|
|
|
write(iout,*)' >= 1 do tracing every itrace'
|
|
|
|
write(iout,*)' iterations '
|
|
|
|
write(iout,*)' iterations '
|
|
|
|
end subroutine pr_usage
|
|
|
|
end subroutine pr_usage
|
|
|
|
|
|
|
|
|
|
|
|
end program psb_d_pde3d
|
|
|
|
end program psb_d_pde3d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|