Blame view
fvn_test/test_inter2d.f90
765 Bytes
27d3b84d6 git-svn-id: https... |
1 |
program inter2d |
2919a9e2d git-svn-id: https... |
2 |
use fvn_interpol |
f6bacaf83 ChW 11/09: ANSI c... |
3 |
use Kind_Definition |
27d3b84d6 git-svn-id: https... |
4 |
implicit none |
f6bacaf83 ChW 11/09: ANSI c... |
5 6 7 8 |
integer(kind=ip_kind),parameter :: nx=21,ny=42 integer(kind=ip_kind) :: i,j real(kind=dp_kind) :: f,fdata(nx,ny),dble,pi,q,sin,x,xdata(nx),y,ydata(ny) real(kind=dp_kind) :: tv |
27d3b84d6 git-svn-id: https... |
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
intrinsic dble,sin f(x,y)=sin(x+2.*y) do i=1,nx xdata(i)=dble(i-1)/dble(nx-1) end do do i=1,ny ydata(i)=dble(i-1)/dble(ny-1) end do do i=1,nx do j=1,ny fdata(i,j)=f(xdata(i),ydata(j)) end do end do call init_random_seed() call random_number(x) call random_number(y) q=fvn_quad_2d_interpol(x,y,nx,xdata,ny,ydata,fdata) tv=f(x,y) write(*,'("x y z ",2(f8.5))') x,y write(*,'("Calculated (real) value :",f8.5)') tv write(*,'("fvn interpolation : ",f8.5)') q write(*,'("Relative fvn error :",e12.5)') abs((q-tv)/tv) end program |