From b6920583e8699c4bf4d18a4f05e916dbb3ab9979 Mon Sep 17 00:00:00 2001 From: ignis Date: Tue, 6 Aug 2019 06:34:41 +0900 Subject: [PATCH] test_compact for native value inspection --- code/Compact.f90 | 2 +- code/makefile | 7 +++- code/test_compact.f90 | 94 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 code/test_compact.f90 diff --git a/code/Compact.f90 b/code/Compact.f90 index 9744fcb..d2ee2b7 100644 --- a/code/Compact.f90 +++ b/code/Compact.f90 @@ -130,7 +130,7 @@ nyc=ny nzc=nz - CALL ludcmp_testalloc + ! CALL ludcmp_testalloc ! IF(nyc /= nzc) PRINT*,'ny should be equal nz' diff --git a/code/makefile b/code/makefile index 9b074bc..6271b35 100644 --- a/code/makefile +++ b/code/makefile @@ -53,7 +53,7 @@ cleanAll: clean rm -f m_terms.f90 clean: - rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid test_calculate build_info.txt + rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid test_calculate test_compact build_info.txt test : test_calculate ./test_calculate @@ -63,6 +63,11 @@ test_calculate : m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calcula test_calculate.o : m_openmpi.o m_parameters.o Compact.o m_calculate.o +test_compact : Compact.o test_compact.o + ${compiler} -o test_compact ${flags} Compact.o test_compact.o + +test_compact.o : Compact.o + print_build_info.o : print_build_info.c gcc -c print_build_info.c diff --git a/code/test_compact.f90 b/code/test_compact.f90 new file mode 100644 index 0000000..f16ade2 --- /dev/null +++ b/code/test_compact.f90 @@ -0,0 +1,94 @@ +program test_calculate + +use Compact + +implicit none + +real*8, parameter :: pi=3.14159265358979323846 +real*8, parameter :: me=1.00e-20 + +integer :: nxp,nyp,nzp + +real*8 :: hxp,hyp,hzp + +real*8 :: l_0 + +real*8, allocatable, dimension(:,:,:) :: aaa,bbb,ccc,ddd + +real*8, allocatable, dimension(:,:) :: aa,bb,cc,dd + +integer :: ierr + +real*8 :: xx,yy,zz,fxyz + +integer :: i,j,k + +real*4, dimension(2) :: startt +real*4, dimension(2) :: endt +real*4 :: result + +nxp = 512 +nyp = 256 +nzp = 256 + +l_0 = 2.0 +hyp=l_0*pi/REAL(nyp) +hxp=hyp +hzp=hyp + +allocate(aa(1, nxp), stat=ierr); aa=0.0 +allocate(bb(1, nxp), stat=ierr); bb=0.0 +allocate(cc(1, nxp), stat=ierr); cc=0.0 +allocate(dd(1, nxp), stat=ierr); dd=0.0 + + +allocate(aaa(nxp, nyp, nzp), stat=ierr); aaa=0.0 +allocate(bbb(nxp, nyp, nzp), stat=ierr); bbb=0.0 +allocate(ccc(nxp, nyp, nzp), stat=ierr); ccc=0.0 +allocate(ddd(nxp, nyp, nzp), stat=ierr); ddd=0.0 + + +call ludcmp(nxp, nyp, nzp, 1, 0, 0) + +do i = 1,nxp +xx = i * hxp +aa(1,i) = sin(1.1 * xx) +dd(1,i) = 1.1 * cos(1.1 * xx) +end do + +call rhs1np(nxp, hxp, aa, bb, 1) + +call dfnonp(nxp, hxp, aa, cc, 1, 1) + + +print *, lxf + +print *, lxs + +print *, aa + +print *, bb + +print *, cc + +print *, dd + + +write(*,*) "relerr_min_max", minval((cc - dd)/dd), maxval(((cc - dd)/dd)) + + + + + + +deallocate(aa) +deallocate(bb) +deallocate(cc) +deallocate(dd) + +deallocate(aaa) +deallocate(bbb) +deallocate(ccc) +deallocate(ddd) + +end program