Hi Buji
nan usually means that simulation diverged. To get an idea of why the simulation is broken it is helpful to write simulation right before the crash and have a look.
For implementation details, see doxygen
http://optilb.com/DoxyGen/html/index.html
Cheers
Albert