Investigations and advanced concepts on gyrotron interaction modeling and simulations Physics of Plasmas 22, 123114 (2015) Abstract. A computational code for the electromagnetic field in the cavity of high-power gyrotrons is developed. The gyrotron mechanism is described by a self-consistent set of equations taking into account the dependence of the axial structure of microwave oscillations on the relativistic electron beam in the cavity. The parameters of the electron beam are calculated using the EGUN electron trajectory code, and the effects of the space charge and the velocity spread of the electron beams are considered. The computational code includes a time-dependent description of the electromagnetic field and a self-consistent analysis of the electron beams. The equations are solved using a second-order predictor-corrector scheme. The calculations of the present study are carried out for a 1-MW gyrotron developed for the GAMMA10/PDX tandem mirror (80 kV, operating mode: TE94 mode, 35.45 GHz). The calculations reveal that, using a triode-type electron gun, stable excitation of the desired mode can be realized in standard startup scenarios.