netcdf error with write_eigenfunc

Issue #25 resolved
Ryusuke Numata created an issue

I get NetCDF errors with write_eigenfunc = T.

ERROR: NetCDF: Not a valid ID ERROR in netcdf_error: NetCDF: Not a valid ID in varid: 0, ncid: 0

I compiled with a default setting, so maybe new diagnostics is used.

In do_write_eigenfunc in diagnostics/diagnostics_final_routine.f90, nc_eigenfunc of gs2_io is called, but gs2_io seems not initialized.

Comments (15)

  1. Joseph Parker

    Hi Ryusuke, could you upload your input file, so I can try to replicate this? What branch are you using? Could you try using next?

  2. Ryusuke Numata reporter

    I used master.

    And, I've tested next if I do correctly and get the same error. I did the following and compiled.

    # git pull origin next
    
  3. Joseph Parker

    Thanks. I can't replicate this. Could you tell me which commits of gs2, Makefiles and utils you are using when you see the error? That is, can you run git rev-parse HEAD in the main directory, and in the Makefiles and utils subdirectories, and report the three hashes here?

  4. Joseph Parker

    Thanks. I still don't see it. Could you tell me what compiler and GK_SYSTEM you are using?

    Also, it seems gs2_io.fpp has lots of #ifdef NETCDF directives. Have you used NETCDF=on in the Makefile so that these sections are also in gs2_io.f90?

  5. Ryusuke Numata reporter

    I uploaded make_test.txt.

    I use GK_SYSTEM=rokko, and COMPILER=intel. It seems NETCDF configuration is ok.

    BTW, I also some error in Makefile. SEDSYSTEMCONFIG line gives me "-i: command not found" I'll open another issue.

  6. Ryusuke Numata reporter

    Has anybody reproduced the problem? I see this problem on my mac with gfortran as well as my local linux cluster as reported above. I compiled the next branch version with USE_PARALLEL_NETCDF=on, USE_NETCDF=on.

    This problem seems because some new diagnostics routines in diagnostics/ still call routines in gs2_io, which is old. I searched "use gs2_io" statement in diagnostics/, and found the followings still have this statement: fields, _final_routines, _fluxes, _moments, _turbulence. Most of them do not actually call nc routines, but only final_routines does. So, I get the netcdf error when I turn the following switches on: write_eigenfunc, write_final_epar, write_final_moments, write_final_antot. Probably, we can just remove nc routine since _final_routines write data to ascii files.

  7. Joseph Parker

    Thanks Ryusuke. I understand what is happening now. This isn't an error that crashes the code, but the unexpected behaviour causes a line to be written to the .error file.

    As you say, the problem is that parts of the new diagnostics - like write_eigenfunc - are just copies from the old diagnostics, and these fail because they depend on gs2_io, which is part of old diagnostics. The patch you shared removes the bad function calls from new diagnostics, which is a necessary step. But if we only do that, a user who sets write_eigenfunc = .true. while using new diagnostics would get no eigenfunction output and no error message. So new diagnostics needs to have these functions added into it properly. Since I now get what's going on, I'll assign this to myself.

  8. Ryusuke Numata reporter

    I'm sorry that I wasn't clear enough. I don't mind if the diagnostics write out either ascii or NetCDF output.

  9. Log in to comment