Blame view

fvn_test/test_besrj.f90 1.39 KB
8ba5c9c78   wdaniau   1) Updated docume...
1
  program test_besrj
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
2
  use fvn_fnlib
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
3
4
5
6
7
8
  implicit none
  ! Variables locales -----------------------------
  integer :: i,n,nstep,norder
  real(kind=dp_kind), dimension(:), allocatable :: bessvec0
  real(kind=dp_kind), dimension(:,:), allocatable:: bessvec1,bessvec2
  real(kind=dp_kind) :: x,xstep,xmax
8ba5c9c78   wdaniau   1) Updated docume...
9
10
  open (unit=1, file='besrj.dat')
  write (1,*) '# n, x, bsjn(n,x), b(n) in besrj(x,norder+1,b)'
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
11
12
13
14
15
16
17
18
19
20
21
22
  write (1,*) '# arg x from 0 to 50, 501 points'
  write (1,*) '# order n from 0 to 50'
  
  norder = 50
  nstep = 500
  xmax=50.d0
  xstep=xmax/nstep
  allocate(bessvec1(0:nstep,0:norder),bessvec2(0:nstep,0:norder))
  allocate(bessvec0(0:norder))
  
  do i=0,nstep !loop on x
      x=i*xstep
8ba5c9c78   wdaniau   1) Updated docume...
23
      call besrj(x,norder+1,bessvec0)
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
      bessvec2(i,:)=bessvec0
      do n=0,norder  !loop on rank, for dbesjn only
          bessvec1(i,n)=bsjn(n,x)
      enddo
  enddo
  
  do n=0,norder
      do i=0,nstep
          x=i*xstep
          write (1,*) n,x,bessvec1(i,n), bessvec2(i,n)
      enddo
      write(1,*)
  enddo
  
  close(1)
  deallocate(bessvec0,bessvec1,bessvec2)
8ba5c9c78   wdaniau   1) Updated docume...
40
41
42
43
44
45
46
47
48
49
50
  write(*,*) "Exemple use of generated file besrj.dat with gnuplot :"
  write(*,*) "pl 'besrj.dat' u 2:($1==5 ? $3 : 1/0) w l"
  write(*,*) "      will plot J5 according to bsjn"
  write(*,*) "pl 'besrj.dat' u 2:($1==5 ? $4 : 1/0) w l"
  write(*,*) "      will plot J5 according to besrj"
  write(*,*) "pl 'besrj.dat' u 2:($1==5 ? ($4-$3)/$3 : 1/0) w l"
  write(*,*) "      will plot relative shift between besrj and bsjn"
  
  
  
  end program
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
51