diff --git a/code/makefile b/code/makefile index 392eff4..2d4c554 100644 --- a/code/makefile +++ b/code/makefile @@ -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 diff --git a/code/test_calculate.f90 b/code/test_calculate.f90 new file mode 100644 index 0000000..e774341 --- /dev/null +++ b/code/test_calculate.f90 @@ -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