       program rfromage 
c
c Fortran file for reading the file FROMAGE_Nom_jjmmaa_keyword_B3D.dat
c which is a result from ``FRench Online MAGnetic Extrapolations'' 
c on http://www.dasop.obspm.fr/fromage
c
c User needs to make modifications at the 2 indicated places before 
c compliling and running the program
c
c
c
       implicit none
       integer           nxm,nym,nzm
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Here modify the values of nxm,nym,nzm to the values of nx,ny,nz
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
       parameter         (nxm=250,nym=95,nzm=95)
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
       integer           nx,ny,nz,i,j,k
       real*8            x(nxm),y(nym),z(nzm)
       real*4            B(nxm,nym,nzm,3)
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Here modify the name of the file accordingly to yours
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
       open(unit=11,status='old',form='formatted',
     *      file='FROMAGE_Nom_jjmmaa_keyword_B3D.dat')
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
        print*,' '
        print*,'            ---------------------------------------'
        print*,'                     Reading file B3D from'
        print*,'             FRench Online MAGnetic Extrapolations'
        print*,'            ---------------------------------------'
c
        read (11,*) nx,ny,nz
        read (11,*) (x(i),i=1,nx)
        read (11,*) (y(j),j=1,ny)
        read (11,*) (z(k),k=1,nz)
c
        print*,' '
        print*,' Mesh of B3D :'
        print*,' '
        print*,'        nx =',nx
        print*,'        ny =',ny
        print*,'        nz =',nz
        print*,' '
        print*,' Dimensions of B3D :'
        print*,' '
        print*,'       x range',
     *         '                 y range',
     *         '                 z range'
        print*,x(1),y(1),z(1)
        print*,x(nx),y(ny),z(nz)
        print*,' '
c
        do k=1,nz
        do j=1,ny
        do i=1,nx
c
          read (11,*) B(i,j,k,1),B(i,j,k,2),B(i,j,k,3)
c
        enddo
        enddo
        enddo
c
        print*,'                  Reading of B3D complete'
        print*,' '
c
        close(unit=11)
c
        end
