00001 subroutine IO_input_initial_3D_qeos
00002   use phys_constant, only : long, nnrg, nntg, nnpg
00003   use grid_parameter, only : nrg, ntg, npg, nrf, ntf, npf
00004   use def_metric, only : alph, psi, bvxd, bvyd, bvzd
00005   use def_matter, only : rhof, rs, omef
00006   use def_matter_parameter, only : ome, ber, radi
00007   use coordinate_grav_r, only : rg
00008   use coordinate_grav_theta, only : thg
00009   use coordinate_grav_phi, only : phig 
00010   use grid_temporary
00011   use interface_interpo_3D_initial_4th
00012   use interface_interpo_3D_initial_4th_surface
00013   use make_array_2d
00014   use make_array_3d
00015   implicit none
00016   real(long), pointer :: rho_tmp(:,:,:),  omef_tmp(:,:,:), rs_tmp(:,:)
00017   real(long), pointer :: psi_tmp(:,:,:),  alph_tmp(:,:,:), 
00018                         bvxd_tmp(:,:,:), bvyd_tmp(:,:,:), bvzd_tmp(:,:,:)
00019   integer :: ir, it, ip, nrgmax, ntgmax, npgmax, nrfmax, ntfmax, npfmax
00020 
00021 
00022   open(14,file='rnsgrids_3D.ini',status='old')
00023   read(14,'(5i5)') nrgtmp, ntgtmp, npgtmp
00024   do ir = 0, nrgtmp
00025     read(14,'(1p,6e20.12)') rgtmp(ir)
00026   end do
00027   do it = 0, ntgtmp
00028     read(14,'(1p,6e20.12)') thgtmp(it)
00029   end do
00030   do ip = 0, npgtmp
00031     read(14,'(1p,6e20.12)') phigtmp(ip)
00032   end do
00033   close(14)
00034 
00035   nrgmax = max0(nrg,nrgtmp)
00036   ntgmax = max0(ntg,ntgtmp)
00037   npgmax = max0(npg,npgtmp)
00038   call alloc_array3d( psi_tmp,0,nrgmax,0,ntgmax,0,npgmax)
00039   call alloc_array3d(alph_tmp,0,nrgmax,0,ntgmax,0,npgmax)
00040   call alloc_array3d(bvxd_tmp,0,nrgmax,0,ntgmax,0,npgmax)
00041   call alloc_array3d(bvyd_tmp,0,nrgmax,0,ntgmax,0,npgmax)
00042   call alloc_array3d(bvzd_tmp,0,nrgmax,0,ntgmax,0,npgmax)
00043 
00044 
00045   open(12,file='rnsflu_3D.ini',status='old')
00046   read(12,'(5i5)') nrftmp, ntftmp, npftmp
00047 
00048   nrfmax = max0(nrf,nrftmp)
00049   ntfmax = max0(ntf,ntftmp)
00050   npfmax = max0(npf,npftmp)
00051   call alloc_array3d( rho_tmp,0,nrfmax,0,ntfmax,0,npfmax)
00052   call alloc_array2d(  rs_tmp,         0,ntfmax,0,npfmax)
00053   call alloc_array3d(omef_tmp,0,nrfmax,0,ntfmax,0,npfmax)
00054 
00055   do ip = 0, npftmp
00056     do it = 0, ntftmp
00057       do ir = 0, nrftmp
00058         read(12,'(1p,6e20.12)') rho_tmp(ir,it,ip), rs_tmp(it,ip), &
00059         &                      omef_tmp(ir,it,ip)
00060       end do
00061     end do
00062   end do
00063   read(12,'(1p,6e20.12)') ome, ber, radi
00064   close(12)
00065 
00066 
00067   open(13,file='rnsgra_3D.ini',status='old')
00068   read(13,'(5i5)') nrgtmp, ntgtmp, npgtmp
00069   do ip = 0, npgtmp
00070     do it = 0, ntgtmp
00071       do ir = 0, nrgtmp
00072         read(13,'(1p,6e20.12)')  psi_tmp(ir,it,ip), &
00073         &                       alph_tmp(ir,it,ip), &
00074         &                       bvxd_tmp(ir,it,ip), &
00075         &                       bvyd_tmp(ir,it,ip), &
00076         &                       bvzd_tmp(ir,it,ip)
00077       end do
00078     end do
00079   end do
00080   read(13,'(1p,6e20.12)') ome, ber, radi
00081   close(13)
00082 
00083 
00084 
00085   if (nrf.ne.nrftmp.or.ntf.ne.ntftmp.or.npf.ne.npftmp) then
00086     call interpo_3D_initial_4th( rho_tmp,'sfco')
00087     call interpo_3D_initial_4th(omef_tmp,'sfco')
00088   end if
00089   if (ntf.ne.ntftmp.or.npf.ne.npftmp) then
00090     call interpo_3D_initial_4th_surface(rs_tmp)
00091   end if
00092   if (nrg.ne.nrgtmp.or.ntg.ne.ntgtmp.or.npg.ne.npgtmp) then
00093     call interpo_3D_initial_4th( psi_tmp,'grco')
00094     call interpo_3D_initial_4th(alph_tmp,'grco')
00095     call interpo_3D_initial_4th(bvxd_tmp,'grco')
00096     call interpo_3D_initial_4th(bvyd_tmp,'grco')
00097     call interpo_3D_initial_4th(bvzd_tmp,'grco')
00098   end if
00099 
00100   rhof(0:nrf,0:ntf,0:npf) =  rho_tmp(0:nrf,0:ntf,0:npf)
00101     rs(0:ntf,0:npf)       =   rs_tmp(0:ntf,0:npf)
00102   omef(0:nrf,0:ntf,0:npf) = omef_tmp(0:nrf,0:ntf,0:npf)
00103    psi(0:nrg,0:ntg,0:npg) =  psi_tmp(0:nrg,0:ntg,0:npg)
00104   alph(0:nrg,0:ntg,0:npg) = alph_tmp(0:nrg,0:ntg,0:npg)
00105   bvxd(0:nrg,0:ntg,0:npg) = bvxd_tmp(0:nrg,0:ntg,0:npg)
00106   bvyd(0:nrg,0:ntg,0:npg) = bvyd_tmp(0:nrg,0:ntg,0:npg)
00107   bvzd(0:nrg,0:ntg,0:npg) = bvzd_tmp(0:nrg,0:ntg,0:npg)
00108 
00109   deallocate( rho_tmp)
00110   deallocate(  rs_tmp)
00111   deallocate(omef_tmp)
00112   deallocate( psi_tmp)
00113   deallocate(alph_tmp)
00114   deallocate(bvxd_tmp)
00115   deallocate(bvyd_tmp)
00116   deallocate(bvzd_tmp)
00117 
00118 end subroutine IO_input_initial_3D_qeos