A continuously and stably stratified fluid contained in a square cavity subjected to harmonic body forcing is studied numerically by solving the Navier-Stokes equations under the Boussinesq approximation. Complex dynamics are observed near the onset of instability of the basic state, which is a flow configuration that is always an exact analytical solution of the governing equations. The instability of the basic state to perturbations is first studied with linear stability analysis (Floquet analysis), revealing a multitude of intersecting synchronous and subharmonic resonance tongues in parameter space. A modal reduction method for determining the locus of basic state instability is also shown, greatly simplifying the computational overhead normally required by a Floquet study. Then, a study of the nonlinear governing equations determines the criticality of the basic state's instability, and ultimately characterizes the dynamics of the lowest order spatial mode by the three discovered codimension-two bifurcation points within the resonance tongue. The rich dynamics include a homoclinic doubling cascade that resembles the logistic map and a multitude of gluing bifurcations.
The numerical techniques and methodologies are first demonstrated on a homogeneous fluid contained within a three-dimensional lid-driven cavity. The edge state technique and linear stability analysis through Arnoldi iteration are used to resolve the complex dynamics of the canonical shear-driven benchmark problem. The techniques here lead to a dynamical description of an instability mechanism, and the work serves as a basis for the remainder of the dissertation.