From 5e9593fa7a6160662c58d3aa04c94fe181094b19 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Wed, 29 Feb 2012 10:46:30 +0000 Subject: [PATCH] mld2p4-2: examples/pdegen/mld_dexample_1lev.f90 examples/pdegen/mld_dexample_ml.f90 examples/pdegen/mld_sexample_1lev.f90 examples/pdegen/mld_sexample_ml.f90 tests/pdegen/ppde2d.f90 tests/pdegen/ppde3d.f90 tests/pdegen/spde2d.f90 tests/pdegen/spde3d.f90 Cray FTN does not allow a contained procedure as an argument, so put in a separate module. --- examples/pdegen/mld_dexample_1lev.f90 | 118 +++++++++++++------------ examples/pdegen/mld_dexample_ml.f90 | 120 +++++++++++++------------- examples/pdegen/mld_sexample_1lev.f90 | 118 +++++++++++++------------ examples/pdegen/mld_sexample_ml.f90 | 119 ++++++++++++------------- tests/pdegen/ppde2d.f90 | 95 ++++++++++---------- tests/pdegen/ppde3d.f90 | 118 +++++++++++++------------ tests/pdegen/spde2d.f90 | 95 ++++++++++---------- tests/pdegen/spde3d.f90 | 117 +++++++++++++------------ 8 files changed, 467 insertions(+), 433 deletions(-) diff --git a/examples/pdegen/mld_dexample_1lev.f90 b/examples/pdegen/mld_dexample_1lev.f90 index 5c1fb0f1..35adba4d 100644 --- a/examples/pdegen/mld_dexample_1lev.f90 +++ b/examples/pdegen/mld_dexample_1lev.f90 @@ -61,13 +61,73 @@ ! ! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation. ! +module dpde_mod +contains + ! + ! functions parametrizing the differential equation + ! + function b1(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b1 + real(psb_dpk_), intent(in) :: x,y,z + b1=1.d0/sqrt(3.d0) + end function b1 + function b2(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b2 + real(psb_dpk_), intent(in) :: x,y,z + b2=1.d0/sqrt(3.d0) + end function b2 + function b3(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b3 + real(psb_dpk_), intent(in) :: x,y,z + b3=1.d0/sqrt(3.d0) + end function b3 + function c(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: c + real(psb_dpk_), intent(in) :: x,y,z + c=0.d0 + end function c + function a1(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a1 + real(psb_dpk_), intent(in) :: x,y,z + a1=1.d0/80 + end function a1 + function a2(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a2 + real(psb_dpk_), intent(in) :: x,y,z + a2=1.d0/80 + end function a2 + function a3(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a3 + real(psb_dpk_), intent(in) :: x,y,z + a3=1.d0/80 + end function a3 + function g(x,y,z) + use psb_base_mod, only : psb_dpk_, done + real(psb_dpk_) :: g + real(psb_dpk_), intent(in) :: x,y,z + g = dzero + if (x == done) then + g = done + else if (x == dzero) then + g = exp(y**2-z**2) + end if + end function g +end module dpde_mod + program mld_dexample_1lev use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input - + use dpde_mod implicit none @@ -251,60 +311,4 @@ contains call psb_bcast(ictxt,tol) end subroutine get_parms - ! - ! functions parametrizing the differential equation - ! - function b1(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b1 - real(psb_dpk_), intent(in) :: x,y,z - b1=1.d0/sqrt(3.d0) - end function b1 - function b2(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b2 - real(psb_dpk_), intent(in) :: x,y,z - b2=1.d0/sqrt(3.d0) - end function b2 - function b3(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b3 - real(psb_dpk_), intent(in) :: x,y,z - b3=1.d0/sqrt(3.d0) - end function b3 - function c(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: c - real(psb_dpk_), intent(in) :: x,y,z - c=0.d0 - end function c - function a1(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a1 - real(psb_dpk_), intent(in) :: x,y,z - a1=1.d0/80 - end function a1 - function a2(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a2 - real(psb_dpk_), intent(in) :: x,y,z - a2=1.d0/80 - end function a2 - function a3(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a3 - real(psb_dpk_), intent(in) :: x,y,z - a3=1.d0/80 - end function a3 - function g(x,y,z) - use psb_base_mod, only : psb_dpk_, done - real(psb_dpk_) :: g - real(psb_dpk_), intent(in) :: x,y,z - g = dzero - if (x == done) then - g = done - else if (x == dzero) then - g = exp(y**2-z**2) - end if - end function g end program mld_dexample_1lev diff --git a/examples/pdegen/mld_dexample_ml.f90 b/examples/pdegen/mld_dexample_ml.f90 index 38c196ff..bfb7f8f8 100644 --- a/examples/pdegen/mld_dexample_ml.f90 +++ b/examples/pdegen/mld_dexample_ml.f90 @@ -65,13 +65,74 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module dpde_mod +contains + + ! + ! functions parametrizing the differential equation + ! + function b1(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b1 + real(psb_dpk_), intent(in) :: x,y,z + b1=1.d0/sqrt(3.d0) + end function b1 + function b2(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b2 + real(psb_dpk_), intent(in) :: x,y,z + b2=1.d0/sqrt(3.d0) + end function b2 + function b3(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b3 + real(psb_dpk_), intent(in) :: x,y,z + b3=1.d0/sqrt(3.d0) + end function b3 + function c(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: c + real(psb_dpk_), intent(in) :: x,y,z + c=0.d0 + end function c + function a1(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a1 + real(psb_dpk_), intent(in) :: x,y,z + a1=1.d0/80 + end function a1 + function a2(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a2 + real(psb_dpk_), intent(in) :: x,y,z + a2=1.d0/80 + end function a2 + function a3(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a3 + real(psb_dpk_), intent(in) :: x,y,z + a3=1.d0/80 + end function a3 + function g(x,y,z) + use psb_base_mod, only : psb_dpk_, done + real(psb_dpk_) :: g + real(psb_dpk_), intent(in) :: x,y,z + g = dzero + if (x == done) then + g = done + else if (x == dzero) then + g = exp(y**2-z**2) + end if + end function g +end module dpde_mod + program mld_dexample_ml use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input - + use dpde_mod implicit none ! input parameters @@ -294,61 +355,4 @@ contains end subroutine get_parms - - ! - ! functions parametrizing the differential equation - ! - function b1(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b1 - real(psb_dpk_), intent(in) :: x,y,z - b1=1.d0/sqrt(3.d0) - end function b1 - function b2(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b2 - real(psb_dpk_), intent(in) :: x,y,z - b2=1.d0/sqrt(3.d0) - end function b2 - function b3(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b3 - real(psb_dpk_), intent(in) :: x,y,z - b3=1.d0/sqrt(3.d0) - end function b3 - function c(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: c - real(psb_dpk_), intent(in) :: x,y,z - c=0.d0 - end function c - function a1(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a1 - real(psb_dpk_), intent(in) :: x,y,z - a1=1.d0/80 - end function a1 - function a2(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a2 - real(psb_dpk_), intent(in) :: x,y,z - a2=1.d0/80 - end function a2 - function a3(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a3 - real(psb_dpk_), intent(in) :: x,y,z - a3=1.d0/80 - end function a3 - function g(x,y,z) - use psb_base_mod, only : psb_dpk_, done - real(psb_dpk_) :: g - real(psb_dpk_), intent(in) :: x,y,z - g = dzero - if (x == done) then - g = done - else if (x == dzero) then - g = exp(y**2-z**2) - end if - end function g end program mld_dexample_ml diff --git a/examples/pdegen/mld_sexample_1lev.f90 b/examples/pdegen/mld_sexample_1lev.f90 index 725ed4db..8863e29a 100644 --- a/examples/pdegen/mld_sexample_1lev.f90 +++ b/examples/pdegen/mld_sexample_1lev.f90 @@ -65,13 +65,73 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module spde_mod +contains + ! + ! functions parametrizing the differential equation + ! + function b1(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b1 + real(psb_spk_), intent(in) :: x,y,z + b1=1.e0/sqrt(3.e0) + end function b1 + function b2(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b2 + real(psb_spk_), intent(in) :: x,y,z + b2=1.e0/sqrt(3.e0) + end function b2 + function b3(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b3 + real(psb_spk_), intent(in) :: x,y,z + b3=1.e0/sqrt(3.e0) + end function b3 + function c(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: c + real(psb_spk_), intent(in) :: x,y,z + c=0.e0 + end function c + function a1(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a1 + real(psb_spk_), intent(in) :: x,y,z + a1=1.e0/80 + end function a1 + function a2(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a2 + real(psb_spk_), intent(in) :: x,y,z + a2=1.e0/80 + end function a2 + function a3(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a3 + real(psb_spk_), intent(in) :: x,y,z + a3=1.e0/80 + end function a3 + function g(x,y,z) + use psb_base_mod, only : psb_spk_, sone + real(psb_spk_) :: g + real(psb_spk_), intent(in) :: x,y,z + g = szero + if (x == sone) then + g = sone + else if (x == szero) then + g = exp(y**2-z**2) + end if + end function g +end module spde_mod + program mld_sexample_1lev use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input - + use spde_mod implicit none @@ -256,60 +316,4 @@ contains call psb_bcast(ictxt,tol) end subroutine get_parms - ! - ! functions parametrizing the differential equation - ! - function b1(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b1 - real(psb_spk_), intent(in) :: x,y,z - b1=1.e0/sqrt(3.e0) - end function b1 - function b2(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b2 - real(psb_spk_), intent(in) :: x,y,z - b2=1.e0/sqrt(3.e0) - end function b2 - function b3(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b3 - real(psb_spk_), intent(in) :: x,y,z - b3=1.e0/sqrt(3.e0) - end function b3 - function c(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: c - real(psb_spk_), intent(in) :: x,y,z - c=0.e0 - end function c - function a1(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a1 - real(psb_spk_), intent(in) :: x,y,z - a1=1.e0/80 - end function a1 - function a2(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a2 - real(psb_spk_), intent(in) :: x,y,z - a2=1.e0/80 - end function a2 - function a3(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a3 - real(psb_spk_), intent(in) :: x,y,z - a3=1.e0/80 - end function a3 - function g(x,y,z) - use psb_base_mod, only : psb_spk_, sone - real(psb_spk_) :: g - real(psb_spk_), intent(in) :: x,y,z - g = szero - if (x == sone) then - g = sone - else if (x == szero) then - g = exp(y**2-z**2) - end if - end function g end program mld_sexample_1lev diff --git a/examples/pdegen/mld_sexample_ml.f90 b/examples/pdegen/mld_sexample_ml.f90 index 4a2e3d1c..23b1db30 100644 --- a/examples/pdegen/mld_sexample_ml.f90 +++ b/examples/pdegen/mld_sexample_ml.f90 @@ -65,13 +65,73 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module spde_mod +contains + ! + ! functions parametrizing the differential equation + ! + function b1(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b1 + real(psb_spk_), intent(in) :: x,y,z + b1=1.e0/sqrt(3.e0) + end function b1 + function b2(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b2 + real(psb_spk_), intent(in) :: x,y,z + b2=1.e0/sqrt(3.e0) + end function b2 + function b3(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b3 + real(psb_spk_), intent(in) :: x,y,z + b3=1.e0/sqrt(3.e0) + end function b3 + function c(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: c + real(psb_spk_), intent(in) :: x,y,z + c=0.e0 + end function c + function a1(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a1 + real(psb_spk_), intent(in) :: x,y,z + a1=1.e0/80 + end function a1 + function a2(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a2 + real(psb_spk_), intent(in) :: x,y,z + a2=1.e0/80 + end function a2 + function a3(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a3 + real(psb_spk_), intent(in) :: x,y,z + a3=1.e0/80 + end function a3 + function g(x,y,z) + use psb_base_mod, only : psb_spk_, sone + real(psb_spk_) :: g + real(psb_spk_), intent(in) :: x,y,z + g = szero + if (x == sone) then + g = sone + else if (x == szero) then + g = exp(y**2-z**2) + end if + end function g +end module spde_mod + program mld_sexample_ml use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input - + use spde_mod implicit none ! input parameters @@ -294,61 +354,4 @@ contains call psb_bcast(ictxt,tol) end subroutine get_parms - ! - ! functions parametrizing the differential equation - ! - function b1(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b1 - real(psb_spk_), intent(in) :: x,y,z - b1=1.e0/sqrt(3.e0) - end function b1 - function b2(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b2 - real(psb_spk_), intent(in) :: x,y,z - b2=1.e0/sqrt(3.e0) - end function b2 - function b3(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b3 - real(psb_spk_), intent(in) :: x,y,z - b3=1.e0/sqrt(3.e0) - end function b3 - function c(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: c - real(psb_spk_), intent(in) :: x,y,z - c=0.e0 - end function c - function a1(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a1 - real(psb_spk_), intent(in) :: x,y,z - a1=1.e0/80 - end function a1 - function a2(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a2 - real(psb_spk_), intent(in) :: x,y,z - a2=1.e0/80 - end function a2 - function a3(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a3 - real(psb_spk_), intent(in) :: x,y,z - a3=1.e0/80 - end function a3 - function g(x,y,z) - use psb_base_mod, only : psb_spk_, sone - real(psb_spk_) :: g - real(psb_spk_), intent(in) :: x,y,z - g = szero - if (x == sone) then - g = sone - else if (x == szero) then - g = exp(y**2-z**2) - end if - end function g - end program mld_sexample_ml diff --git a/tests/pdegen/ppde2d.f90 b/tests/pdegen/ppde2d.f90 index 69fc77e6..4b94f811 100644 --- a/tests/pdegen/ppde2d.f90 +++ b/tests/pdegen/ppde2d.f90 @@ -62,12 +62,62 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module ppde2d_mod +contains + + ! + ! functions parametrizing the differential equation + ! + function b1(x,y) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b1 + real(psb_dpk_), intent(in) :: x,y + b1=1.d0/sqrt(2.d0) + end function b1 + function b2(x,y) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b2 + real(psb_dpk_), intent(in) :: x,y + b2=1.d0/sqrt(2.d0) + end function b2 + function c(x,y) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: c + real(psb_dpk_), intent(in) :: x,y + c=0.d0 + end function c + function a1(x,y) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a1 + real(psb_dpk_), intent(in) :: x,y + a1=1.d0/80 + end function a1 + function a2(x,y) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a2 + real(psb_dpk_), intent(in) :: x,y + a2=1.d0/80 + end function a2 + function g(x,y) + use psb_base_mod, only : psb_dpk_, done + real(psb_dpk_) :: g + real(psb_dpk_), intent(in) :: x,y + g = dzero + if (x == done) then + g = done + else if (x == dzero) then + g = exp(-y**2) + end if + end function g +end module ppde2d_mod + program ppde2d use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input + use ppde2d_mod implicit none ! input parameters @@ -409,50 +459,5 @@ contains write(iout,*)' iterations ' end subroutine pr_usage - - ! - ! functions parametrizing the differential equation - ! - function b1(x,y) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b1 - real(psb_dpk_), intent(in) :: x,y - b1=1.d0/sqrt(2.d0) - end function b1 - function b2(x,y) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b2 - real(psb_dpk_), intent(in) :: x,y - b2=1.d0/sqrt(2.d0) - end function b2 - function c(x,y) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: c - real(psb_dpk_), intent(in) :: x,y - c=0.d0 - end function c - function a1(x,y) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a1 - real(psb_dpk_), intent(in) :: x,y - a1=1.d0/80 - end function a1 - function a2(x,y) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a2 - real(psb_dpk_), intent(in) :: x,y - a2=1.d0/80 - end function a2 - function g(x,y) - use psb_base_mod, only : psb_dpk_, done - real(psb_dpk_) :: g - real(psb_dpk_), intent(in) :: x,y - g = dzero - if (x == done) then - g = done - else if (x == dzero) then - g = exp(-y**2) - end if - end function g end program ppde2d diff --git a/tests/pdegen/ppde3d.f90 b/tests/pdegen/ppde3d.f90 index db96119c..6c638b2d 100644 --- a/tests/pdegen/ppde3d.f90 +++ b/tests/pdegen/ppde3d.f90 @@ -63,12 +63,73 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module ppde3d_mod +contains + ! + ! functions parametrizing the differential equation + ! + function b1(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b1 + real(psb_dpk_), intent(in) :: x,y,z + b1=1.d0/sqrt(3.d0) + end function b1 + function b2(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b2 + real(psb_dpk_), intent(in) :: x,y,z + b2=1.d0/sqrt(3.d0) + end function b2 + function b3(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: b3 + real(psb_dpk_), intent(in) :: x,y,z + b3=1.d0/sqrt(3.d0) + end function b3 + function c(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: c + real(psb_dpk_), intent(in) :: x,y,z + c=0.d0 + end function c + function a1(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a1 + real(psb_dpk_), intent(in) :: x,y,z + a1=1.d0/80 + end function a1 + function a2(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a2 + real(psb_dpk_), intent(in) :: x,y,z + a2=1.d0/80 + end function a2 + function a3(x,y,z) + use psb_base_mod, only : psb_dpk_ + real(psb_dpk_) :: a3 + real(psb_dpk_), intent(in) :: x,y,z + a3=1.d0/80 + end function a3 + function g(x,y,z) + use psb_base_mod, only : psb_dpk_, done + real(psb_dpk_) :: g + real(psb_dpk_), intent(in) :: x,y,z + g = dzero + if (x == done) then + g = done + else if (x == dzero) then + g = exp(y**2-z**2) + end if + end function g +end module ppde3d_mod + program ppde3d use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input + use ppde3d_mod implicit none ! input parameters @@ -412,62 +473,5 @@ contains write(iout,*)' >= 1 do tracing every itrace' write(iout,*)' iterations ' end subroutine pr_usage - - ! - ! functions parametrizing the differential equation - ! - function b1(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b1 - real(psb_dpk_), intent(in) :: x,y,z - b1=1.d0/sqrt(3.d0) - end function b1 - function b2(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b2 - real(psb_dpk_), intent(in) :: x,y,z - b2=1.d0/sqrt(3.d0) - end function b2 - function b3(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: b3 - real(psb_dpk_), intent(in) :: x,y,z - b3=1.d0/sqrt(3.d0) - end function b3 - function c(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: c - real(psb_dpk_), intent(in) :: x,y,z - c=0.d0 - end function c - function a1(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a1 - real(psb_dpk_), intent(in) :: x,y,z - a1=1.d0/80 - end function a1 - function a2(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a2 - real(psb_dpk_), intent(in) :: x,y,z - a2=1.d0/80 - end function a2 - function a3(x,y,z) - use psb_base_mod, only : psb_dpk_ - real(psb_dpk_) :: a3 - real(psb_dpk_), intent(in) :: x,y,z - a3=1.d0/80 - end function a3 - function g(x,y,z) - use psb_base_mod, only : psb_dpk_, done - real(psb_dpk_) :: g - real(psb_dpk_), intent(in) :: x,y,z - g = dzero - if (x == done) then - g = done - else if (x == dzero) then - g = exp(y**2-z**2) - end if - end function g end program ppde3d diff --git a/tests/pdegen/spde2d.f90 b/tests/pdegen/spde2d.f90 index aca14652..9155978d 100644 --- a/tests/pdegen/spde2d.f90 +++ b/tests/pdegen/spde2d.f90 @@ -62,12 +62,62 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module spde2d_mod +contains + + ! + ! functions parametrizing the differential equation + ! + function b1(x,y) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b1 + real(psb_spk_), intent(in) :: x,y + b1=1.e0/sqrt(2.e0) + end function b1 + function b2(x,y) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b2 + real(psb_spk_), intent(in) :: x,y + b2=1.e0/sqrt(2.e0) + end function b2 + function c(x,y) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: c + real(psb_spk_), intent(in) :: x,y + c=0.e0 + end function c + function a1(x,y) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a1 + real(psb_spk_), intent(in) :: x,y + a1=1.e0/80 + end function a1 + function a2(x,y) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a2 + real(psb_spk_), intent(in) :: x,y + a2=1.e0/80 + end function a2 + function g(x,y) + use psb_base_mod, only : psb_spk_, sone + real(psb_spk_) :: g + real(psb_spk_), intent(in) :: x,y + g = szero + if (x == sone) then + g = sone + else if (x == szero) then + g = exp(-y**2) + end if + end function g +end module spde2d_mod + program spde2d use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input + use spde2d_mod implicit none ! input parameters @@ -409,49 +459,4 @@ contains write(iout,*)' iterations ' end subroutine pr_usage - ! - ! functions parametrizing the differential equation - ! - function b1(x,y) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b1 - real(psb_spk_), intent(in) :: x,y - b1=1.e0/sqrt(2.e0) - end function b1 - function b2(x,y) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b2 - real(psb_spk_), intent(in) :: x,y - b2=1.e0/sqrt(2.e0) - end function b2 - function c(x,y) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: c - real(psb_spk_), intent(in) :: x,y - c=0.e0 - end function c - function a1(x,y) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a1 - real(psb_spk_), intent(in) :: x,y - a1=1.e0/80 - end function a1 - function a2(x,y) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a2 - real(psb_spk_), intent(in) :: x,y - a2=1.e0/80 - end function a2 - function g(x,y) - use psb_base_mod, only : psb_spk_, sone - real(psb_spk_) :: g - real(psb_spk_), intent(in) :: x,y - g = szero - if (x == sone) then - g = sone - else if (x == szero) then - g = exp(-y**2) - end if - end function g - end program spde2d diff --git a/tests/pdegen/spde3d.f90 b/tests/pdegen/spde3d.f90 index 32b12f88..8ca1f0ba 100644 --- a/tests/pdegen/spde3d.f90 +++ b/tests/pdegen/spde3d.f90 @@ -63,12 +63,73 @@ ! then the corresponding vector is distributed according to a BLOCK ! data distribution. ! +module spde3d_mod +contains + ! + ! functions parametrizing the differential equation + ! + function b1(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b1 + real(psb_spk_), intent(in) :: x,y,z + b1=1.e0/sqrt(3.e0) + end function b1 + function b2(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b2 + real(psb_spk_), intent(in) :: x,y,z + b2=1.e0/sqrt(3.e0) + end function b2 + function b3(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: b3 + real(psb_spk_), intent(in) :: x,y,z + b3=1.e0/sqrt(3.e0) + end function b3 + function c(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: c + real(psb_spk_), intent(in) :: x,y,z + c=0.e0 + end function c + function a1(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a1 + real(psb_spk_), intent(in) :: x,y,z + a1=1.e0/80 + end function a1 + function a2(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a2 + real(psb_spk_), intent(in) :: x,y,z + a2=1.e0/80 + end function a2 + function a3(x,y,z) + use psb_base_mod, only : psb_spk_ + real(psb_spk_) :: a3 + real(psb_spk_), intent(in) :: x,y,z + a3=1.e0/80 + end function a3 + function g(x,y,z) + use psb_base_mod, only : psb_spk_, sone + real(psb_spk_) :: g + real(psb_spk_), intent(in) :: x,y,z + g = szero + if (x == sone) then + g = sone + else if (x == szero) then + g = exp(y**2-z**2) + end if + end function g +end module spde3d_mod + program spde3d use psb_base_mod use mld_prec_mod use psb_krylov_mod use psb_util_mod use data_input + use spde3d_mod implicit none ! input parameters @@ -412,61 +473,5 @@ contains write(iout,*)' >= 1 do tracing every itrace' write(iout,*)' iterations ' end subroutine pr_usage - ! - ! functions parametrizing the differential equation - ! - function b1(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b1 - real(psb_spk_), intent(in) :: x,y,z - b1=1.e0/sqrt(3.e0) - end function b1 - function b2(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b2 - real(psb_spk_), intent(in) :: x,y,z - b2=1.e0/sqrt(3.e0) - end function b2 - function b3(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: b3 - real(psb_spk_), intent(in) :: x,y,z - b3=1.e0/sqrt(3.e0) - end function b3 - function c(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: c - real(psb_spk_), intent(in) :: x,y,z - c=0.e0 - end function c - function a1(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a1 - real(psb_spk_), intent(in) :: x,y,z - a1=1.e0/80 - end function a1 - function a2(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a2 - real(psb_spk_), intent(in) :: x,y,z - a2=1.e0/80 - end function a2 - function a3(x,y,z) - use psb_base_mod, only : psb_spk_ - real(psb_spk_) :: a3 - real(psb_spk_), intent(in) :: x,y,z - a3=1.e0/80 - end function a3 - function g(x,y,z) - use psb_base_mod, only : psb_spk_, sone - real(psb_spk_) :: g - real(psb_spk_), intent(in) :: x,y,z - g = szero - if (x == sone) then - g = sone - else if (x == szero) then - g = exp(y**2-z**2) - end if - end function g end program spde3d