Dissolving, trapping and detrapping mechanisms of hydrogen in bcc and fcc transition metals