validate m_calculate

This commit is contained in:
ignis 2019-05-03 02:54:13 +09:00
parent 251dbfc010
commit 9a4ebf72e5
2 changed files with 90 additions and 0 deletions

View file

@ -43,3 +43,10 @@ m_terms.f90 : code_gen/code_gen.py code_gen/terms.input code_gen/resources/m_tem
clean:
rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid
testc : test_calculate
test_calculate : m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calculate.o
${compiler} -o test_calculate ${flags} m_openmpi.o m_parameters.o Compact.o m_calculate.o test_calculate.o
test_calculate.o : m_openmpi.o m_parameters.o Compact.o m_calculate.o

83
code/test_calculate.f90 Normal file
View file

@ -0,0 +1,83 @@
program test_calculate
use m_parameters
use m_calculate
implicit none
real*8, allocatable, dimension(:,:,:) :: aaa,bbb,ccc,ddd
integer :: ierr
real*8 :: xx,yy,zz
integer :: i,j,k
nxp = 512
nyp = 256
nzp = 256
l_0 = 2.0
hyp=l_0*pi/REAL(nyp)
hxp=hyp
hzp=hyp
allocate(aaa(nxp, nyp, nzp), stat=ierr)
allocate(bbb(nxp, nyp, nzp), stat=ierr)
allocate(ccc(nxp, nyp, nzp), stat=ierr)
allocate(ddd(nxp, nyp, nzp), stat=ierr)
call m_calculate_init
do k = 1,nzp
do j = 1,nyp
do i = 1,nxp
xx = i * hxp
yy = j * hyp
zz = k * hzp
aaa(i,j,k) = sin(2.0 * xx) * sin(3.0 * yy) * sin(4.0 * zz)
end do
end do
end do
write(*,*) minval(aaa), maxval(aaa)
call ddx(bbb, aaa)
write(*,*) minval(bbb), maxval(bbb)
call ddy(ccc, aaa)
write(*,*) minval(ccc), maxval(ccc)
call ddz(ddd, aaa)
write(*,*) minval(ddd), maxval(ddd)
call d2dx(bbb, aaa)
write(*,*) minval(bbb), maxval(bbb)
call d2dy(ccc, aaa)
write(*,*) minval(ccc), maxval(ccc)
call d2dz(ddd, aaa)
write(*,*) minval(ddd), maxval(ddd)
call m_calculate_finalize
deallocate(aaa)
deallocate(bbb)
deallocate(ccc)
deallocate(ddd)
end program