Evaluation of Cavity Modes in Superconducting Intrinsic-Josephson-Junction Oscillators for Terahertz-wave Generation