Changeset 789 for trunk/LMDZ.GENERIC


Ignore:
Timestamp:
Sep 20, 2012, 3:34:10 PM (12 years ago)
Author:
aslmd
Message:

LMDZ.GENERIC
A more robust way to count lines in setspi and setspv.
bandlen.txt file is no longer used. This was causing problems with MPI computations.

Location:
trunk/LMDZ.GENERIC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/README

    r787 r789  
    830830  ... to be conservative I kept this behaviour and highlighted it with an array nueffrad_dummy
    831831  ... I added a comment because someone might want to change this
     832
     833== 20/09/2012 == AS
     834A more robust way to count lines in setspi and setspv.
     835bandlen.txt file is no longer used. This was causing problems with MPI computations.
  • trunk/LMDZ.GENERIC/libf/phystd/setspi.F90

    r716 r789  
    4646     
    4747      real*8 :: lastband(2), plancksum
     48
     49      !! used to count lines
     50      integer :: nb=-1  !because first line is not an actual value
     51      integer :: ierr=0
    4852
    4953      logical forceEC, planckcheck
     
    8791         call abort
    8892      endif
    89      
    90       ! check that the file contains the right number of bands
    91       call system('wc -l '//file_path//' > bandlen.txt')
    92       open(131,file='bandlen.txt', form='formatted')
    93       read(131,*) file_entries
     93   
     94      ! check that the file contains the right number of bands
     95      open(131,file=file_path,form='formatted')
     96      do while (ierr==0)
     97        read(131,*,iostat=ierr) file_entries
     98        if (ierr==0) nb=nb+1
     99      enddo
    94100      close(131)
    95       call system('rm -f bandlen.txt')
    96 
    97       if(file_entries-1.ne.L_NSPECTI) then
    98          write(*,*) 'setspi: L_NSPECTI = ',L_NSPECTI, 'in the model, but there are '
    99          write(*,*) file_entries-1,'entries in ', &
    100               TRIM(file_path),', exiting.'
     101      write(*,*) 'setspi: L_NSPECTI = ',L_NSPECTI, 'in the model '
     102      write(*,*) '        there are   ',nb, 'entries in ',TRIM(file_path)
     103      if(nb.ne.L_NSPECTI) then
     104         write(*,*) 'MISMATCH !! I stop here'
    101105         call abort
    102106      endif
  • trunk/LMDZ.GENERIC/libf/phystd/setspv.F90

    r716 r789  
    4646      real*8 sum
    4747
     48      !! used to count lines
     49      integer :: nb=-1  !because first line is not an actual value
     50      integer :: ierr=0
     51
    4852!=======================================================================
    4953!     Set up spectral bands - wavenumber [cm^(-1)]. Go from smaller to
     
    6569         call abort
    6670      endif
    67      
    68       ! check that the file contains the right number of bands
    69       call system('wc -l '//file_path//' > bandlen.txt')
    70       open(131,file='bandlen.txt', form='formatted')
    71       read(131,*) file_entries
     71   
     72      ! check that the file contains the right number of bands
     73      open(131,file=file_path,form='formatted')
     74      do while (ierr==0)
     75        read(131,*,iostat=ierr) file_entries
     76        if (ierr==0) nb=nb+1
     77      enddo
    7278      close(131)
    73       call system('rm -f bandlen.txt')
    74 
    75       if(file_entries-1.ne.L_NSPECTV) then
    76          write(*,*) 'setspv: L_NSPECTV = ',L_NSPECTV, 'in the model, but there are '
    77          write(*,*) file_entries-1,'entries in ', &
    78               TRIM(file_path),', exiting.'
     79      write(*,*) 'setspv: L_NSPECTV = ',L_NSPECTV, 'in the model '
     80      write(*,*) '        there are   ',nb, 'entries in ',TRIM(file_path)
     81      if(nb.ne.L_NSPECTV) then
     82         write(*,*) 'MISMATCH !! I stop here'
    7983         call abort
    8084      endif
Note: See TracChangeset for help on using the changeset viewer.