CESR-lab / ucla-roms

GNU General Public License v3.0
5 stars 11 forks source link

Character array mismatch, `extract_data.F` #27

Open dafyddstephenson opened 5 months ago

dafyddstephenson commented 5 months ago

Hi all, Ulla ran into another instance of a character array with different length entries causing an error. The issue is on line 655 (where dname is set):

      do i = 1,nobj
        if (obj(i)%np>0) then
          write(label,'(I0.3)') i
          dname = (/ 'np'//label, 'time_'//trim(obj(i)%set) /)

The problem goes away with a repetition of @nmolem 's previous solution of using fixed-length variables:

      character(len=20) :: np_label
      character(len=20) :: time_label
      do i = 1,nobj
         if (obj(i)%np>0) then
            write(label,'(I0.3)') i
            np_label='np'//label
            time_label='time_'//trim(obj(i)%set)
            dname = (/np_label,time_label/)

Thanks! Dafydd

nmolem commented 4 months ago

Does the error occur here (at line 655)? This hasn't been an issue for us, for which compiler does this come up? Your suggestion is minor, so I'll make the change to main and push it.

dafyddstephenson commented 4 months ago

gfortran again, though this time it only throws the error at runtime when the values are set. We're now using gfortran on NERSC's perlmutter cluster so we may yet catch a couple more of these. Thanks @nmolem !

nmolem commented 4 months ago

I pushed this change and the ones that were needed for #25. Let me know if you see continued problems