Allow DIMENS to be used as well as SPECGRID when no sections are found.

Also refactor DIMENS/SPECGRID to dimension code as a function.