! ! splits map file in two, eg water and bottom ! ! ! name kind length funct. description ! ---- ----- ------ ------- ----------- ! notot integer 1 input total number of substances ! noseg integer 1 input nr. of computational elements ! moname char*40 4 input model and run names ! syname char*20 notot input names of systems ! conc real notot,noseg input model concentrations ! itime integer 1 input time in system clock units ! parameter ( iimap = 10, imap1 = 20, imap2 = 30) character*255 fimapi, fimap1, fimap2 character*40 moname(4) character*20, allocatable :: syname(:) real , allocatable :: conc(:,:) character*20 cnoseg1, cnoseg2 ! get arguments call getarg (1, fimapi) call getarg (2, cnoseg1) call getarg (3, cnoseg2) call getarg (4, fimap1) call getarg (5, fimap2) write(*,*) ' input map file:',trim(fimapi) write(*,*) ' segments in water:',trim(cnoseg1) write(*,*) ' segments in bottom:',trim(cnoseg2) write(*,*) ' output map file water:',trim(fimap1) write(*,*) ' output map file bottom:',trim(fimap2) read(cnoseg1,'(i20)') noseg1 read(cnoseg2,'(i20)') noseg2 ! read map file open (iimap,file=fimapi,form='binary',action='read') read (iimap) (moname(i),i=1,4) read (iimap) notot,noseg allocate (syname(notot),conc(notot,noseg)) read (iimap) (syname(i),i=1,notot) if ( noseg1 + noseg2 .ne. noseg ) then write(*,*) ' warning : number of segments in water and bottom do not add up to total:',noseg noseg1 = min(noseg1,noseg) noseg2 = min(noseg-noseg1,noseg2) endif open(imap1,file=fimap1,form='binary') write(imap1) (moname(i),i=1,4) write(imap1) notot,noseg1 write(imap1) syname open(imap2,file=fimap2,form='binary') write(imap2) (moname(i),i=1,4) write(imap2) notot,noseg2 write(imap2) syname ! loop over the file do ! lees tijdstap read (iimap,iostat=io_err) itime,conc if ( io_err .ne. 0 ) exit ! schrijf write (imap1,iostat=io_err) itime,conc(:,1:noseg1) write (imap2,iostat=io_err) itime,conc(:,noseg1+1:noseg1+noseg2) enddo end