Fundamentals of hydrogen storage in nanoporous materials