Compaction and elastic unloading of nanopowders in terms of granular dynamics