The covariant phase space method gives an elegant way to understand the Hamiltonian dynamics of Lagrangian field theories without breaking covariance. In this work, we give an algorithmic procedure for applying the covariant phase space formalism to field theories with spatial boundaries. From our formalism, we can produce the Hamiltonian, only assuming that the configurations satisfy equations of motion and boundary conditions. The Hamiltonian from our computation has an extra boundary term, which already is nonvanishing even in general relativity with sufficient permission for gauge choice around boundaries, that so far has not appeared in the literature. We show in examples that the Hamiltonian so constructed agrees with previous results.
To have a better understanding of this formalism, we explicitly solve the phase space and symplectic form in a simple model (the Jackiw-Teitelboim gravity), which captures everything in classical mechanics. For example, we can give a simple explain for the traversable wormhole effect.