DART icon indicating copy to clipboard operation
DART copied to clipboard

bug: passing in 0 for maxdist to get_close_init() results in unintelligible error

Open nancycollins opened this issue 1 year ago • 2 comments

:bug: passing in a maxdist of 0 to get_close_init() should be caught right away

Describe the bug

  1. check out the zero_dist branch
  2. cd into developer_tests/location/threed_sphere and quickbuild
  3. run the code. if compiled without debug flags, it prints the cryptic msg below. compiled with debug flags, it crashes in an acos() call in find_del_lon.
  4. go into assimilation_code/location/threed_sphere and copy location_mod_fix.f90 to location_mod.f90
  5. recompile and run the test again. it errors out with a clear error message

this case showed up in user code that was passing in 0 by mistake instead of the intended value for maxdist.

Error Message

  get_close_init  Contact Dart Developers: this error should not happen
 ERROR FROM:
  source : threed_sphere/location_mod.f90
  routine: get_close_init
  message:  location outside grid boxes, index value: -2147483647

Which model(s) are you working with?

anything using threed_sphere

Version of DART

main branch version 11.0.1 fix and developer_test code is on zero_dist branch

Have you modified the DART code?

Yes assimilation_code/location/threed_sphere/location_mod_fix.f90 on this branch has an added test for an invalid maxdist and a clear error message developer_tests/location/threed_sphere has a quickbuild test to verify the fix.

Build information

tested on derecho, intel compiler

nancycollins avatar Jan 24 '24 18:01 nancycollins

i've moved the dist_zero branch to my fork of the DART repo.

nancycollins avatar Jan 26 '24 18:01 nancycollins

if (maxdist <= 0.0_r8) then
   write(msgstring, *) 'bad maxdist value ', maxdist, ' , must be > 0'
   call error_handler(E_ERR, 'get_close_init', msgstring, source)
endif

hkershaw-brown avatar Aug 07 '24 21:08 hkershaw-brown