Blame view

m_load_ens.F90 876 Bytes
26362238   Dany Dumont   premier depot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module m_load_ens
contains
subroutine load_ens(fname,sol,nrsamp)
   use mod_dimensions
   use mod_states
   implicit none
   integer, intent(in) :: nrsamp
   type(states), intent(out) :: sol(nrsamp)
   character(len=*), intent(in) :: fname
   integer len,k,i,iens
   logical ex

   inquire(iolength=len)kdim,nrsamp,sol(1)
   inquire(file=fname,exist=ex)
   if (.not.ex) then
      print *,'load_ens: The file does not exist',fname
      stop
   endif
   open(10,file=fname,status='old',form='unformatted',access='direct',recl=len)
      read(10,rec=1)k,i
      if ((k==kdim).and.(i==nrsamp)) then
         do iens=1,nrsamp
            read(10,rec=iens)k,i,sol(iens)
         enddo
      else
         print *,'load_ens: dimensions in file are wrong:',fname
         print *,'load_ens:',k,kdim,i,nrsamp
         stop
      endif
   close(10)
end subroutine load_ens
end module