begin code that is specific to the 2d hp model