Text this: Variational formulation of active nematic fluids: theory and simulation