wrf_hydro_nwm_public
wrf_hydro_nwm_public copied to clipboard
[BUG] infxswgt incorrectly exported to restart file
I found, on our Intel based system (compiler and hardware), that what is written to the restart netcdf file is not always identical with what's in the memory. Thus, values in the surface routing weighting grid infxswgt become orders of magnitude larger than they should be. I attached a netcdf file for illustration. infxswgt.zip It seems that at some point in the computations, the variable changes precision, although everywhere only REAL*4 is defined. When writing the field to the nc file, the values are not correctly converted to float (as required in the netcdf file). Reading the field subsequently imports the wrong values into the simulation, leading to much too high surface head. Adding a cast to real() in module_HYDRO_io.F call w_rst_rt_nc2(ncid,rt_domain(did)%ixrt,rt_domain(did)%jxrt,real(rt_domain(did)%INFXSWGT), "infxswgt" ) solves the problem, at least on our system. If the conversion is done later in the calling sequence, just before the netcdf variable is put into the file, the values are already corrupted. The problem seems to be connected with the MPI collection of the distributed infxswgt field into the global field.
This was addressed (indirectly) in recent versions of netCDF -- should check if this is still an issue