Potential vorticity diagnostics based on balances between volume integral and boundary conditions