I'm currently writing a lid drive cavity CFD code on python. Currently, my code has some issues (values jumping bear b.c). I was wondering what are some good habits in debugging numerical codes. Hopefully, I would be able to learn some which I may apply to my future projects.
Asked
Active
Viewed 156 times
8
assert. Compile with-Wall -Wextra -Werror -Wpedantic. Test with-fallocate=sanitize. Test on cases with known analytical solutions. – Richard Jul 29 '19 at 15:49-fallocate=sanitizeflag? Do you mean to suggest he can use e.g.-fsanitize=address? – Bjoern Dahlgren Aug 01 '19 at 11:04-faddress=sanitize. That flag tracks memory allocations and usage. It identifies buffer overflows, bad writes, and unfreed memory at a cost of slowing a program by half. It's therefore a great tool to use for testing, especially in pointer-heavy code. – Richard Aug 01 '19 at 16:40CFLAGS="-fsanitize=address" python3 setup.py build_ext -i), I need to add the asan so (given by ~ldd mypyext/_mypyext.so) to LD_PRELOAD, not terribly hard but definitely also not very user friendly either ¯_(ツ)_/¯. – Bjoern Dahlgren Aug 03 '19 at 11:37