test_compact for native value inspection

This commit is contained in:
ignis 2019-08-06 06:34:41 +09:00
parent 1674323816
commit b6920583e8
3 changed files with 101 additions and 2 deletions

View file

@ -130,7 +130,7 @@
nyc=ny
nzc=nz
CALL ludcmp_testalloc
! CALL ludcmp_testalloc
! IF(nyc /= nzc) PRINT*,'ny should be equal nz'

View file

@ -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

94
code/test_compact.f90 Normal file
View file

@ -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