In this paper we solve two initial value problems for two-dimensional internal gravity waves. The waves are contained in a uniformly stratified, square-shaped domain whose sidewalls are tilted with respect to the direction of gravity. We consider several disturbances of the initial stream function field and solve both for its free evolution and for its evolution under parametric excitation. We do this by developing a structure-preserving numerical method for internal gravity waves in a two-dimensional stratified fluid domain. We recall the linearized, inviscid Euler–Boussinesq model, identify its Hamiltonian structure, and derive a staggered finite difference scheme that preserves this structure. For the discretized model, the initial condition can be projected onto normal modes whose dynamics is described by independent harmonic oscillators. This fact is used to explain the persistence of various classes of wave attractors in a freely evolving (i.e. unforced) flow. Under parametric forcing, the discrete dynamics can likewise be decoupled into Mathieu equations. The most unstable resonant modes dominate the solution, forming wave attractors.