Design of an efficient terahertz source using triply resonant nonlinear photonic crystal cavities