An Energy Consistent Discretization of the Nonhydrostatic Equations in Primitive Variables September 10, 2021