A classical benchmark for viscous and viscoelastic fluid codes is the lid-driven cavity, a model problem which highlights effects arising from a recirculating, geometrically confined flow. Here we simulate a square 2-D cavity for nematic liquid crystalline polymers (LCPs), which adds the physics of ordered phases and distortional elasticity to earlier cavity simulations. The range of local flow types within the cavity create ideal conditions for strong orientational conflicts: nematic polymers are prone to steady alignment in extension-dominated flow, yet sustained dynamic responses (tumbling, wagging, kayaking) in shear-dominated flow. Orientational conflicts are mediated by defects, or disordered phases, whose genesis and evolution in fully confined 2-D flows are explored here for the first time. Our algorithm extends previous LCP-flow solvers by implementation of physical boundary conditions on velocity and the orientational distribution at all four walls. We impose uniform orientational anchoring at the cavity walls (parallel on top and bottom, normal on sides) to suppress corner defect anomalies, and apply the method of Shen (J. Shen, J. Comp. Phys., 1991, 95, 228–245) for smoothing of the corner flow singularities due to the standard no-slip flow condition on solid walls. The same code simulates a viscous fluid by decoupling the orientational stress from the Navier–Stokes equations. We choose a Reynolds number for which the viscous simulation develops a stationary flow structure with a central rotating eddy and three corner eddies. We then simulate the Doi–Hess–Marrucci–Greco orientation tensor model for nematic polymers coupled to the flow equations, and apply level-set detection, tracking and graphics of defect domains (X. Yang, M. G. Forest, W. Mullins and Q. Wang, J. Rheology, 2009, 53 (3), 589–615). The viscous flow structure is qualitatively preserved, albeit with weaker corner vortices; the orientation field, however, consists of a highly transient, defect-laden texture. Our diagnostics continuously detect and track defect domains through strong fluctuations in topology as defects spawn, propagate, merge, collide and annihilate ad infinitum.