The software package GUN-MIG has been developed for computer simulation of
beam formation in magnetron injection guns (MIG). It is based on a fully re
lativistic self-consistent physical model which takes into account the spec
ific problems and requirements that are being encountered in the analysis a
nd design of MIG for gyrotrons. Besides providing a general outline of the
physical models and the program implementation of the code, several illustr
ative examples of the numerical experiments with real MIG for submillimeter
wave gyrotrons are presented and discussed.