00001 subroutine sourceterm_outsurf_eqm_binary(fnc,sou_out,dsou_out)
00002   use phys_constant, only : long
00003   use grid_parameter, only : nrg, ntg, npg, npgxzm
00004   use make_array_2d
00005   use interface_interpo_linear_type0_2Dsurf
00006   use interface_grdr_gridpoint_type0
00007 
00008   implicit none
00009   real(long), pointer :: fnc(:,:,:), sou_out(:,:), dsou_out(:,:)
00010   real(long), pointer :: fnc_outsurf(:,:), dfnc_outsurf(:,:)
00011   real(long) :: deriv, val
00012   integer :: itg, ipg, itgout, ipgout
00013 
00014   call alloc_array2d(fnc_outsurf, 0, ntg, 0, npg)
00015   call alloc_array2d(dfnc_outsurf, 0, ntg, 0, npg)
00016 
00017   do ipg = 0, npg
00018     do itg = 0, ntg
00019       fnc_outsurf(itg,ipg) = fnc(nrg,itg,ipg)
00020       call grdr_gridpoint_type0(fnc,deriv,nrg,itg,ipg)
00021       dfnc_outsurf(itg,ipg) = deriv
00022     end do
00023   end do
00024 
00025   do ipg = 1, npg
00026     do itg = 1, ntg
00027 
00028       itgout = itg
00029       ipgout = ipg + npgxzm  - ((ipg+npgxzm)/(npg+1))*npg
00030       call interpo_linear_type0_2Dsurf(val,fnc_outsurf,itg,ipg)
00031       sou_out(itgout,ipgout) = val
00032       call interpo_linear_type0_2Dsurf(val,dfnc_outsurf,itg,ipg)
00033       dsou_out(itgout,ipgout) = val
00034     end do
00035   end do
00036   deallocate(fnc_outsurf)
00037   deallocate(dfnc_outsurf)
00038 
00039 end subroutine sourceterm_outsurf_eqm_binary