Simulation of Smith-Purcell radiation in an open resonator with inverse trapezoid grating