Computer simulation of the electric field structure and optical emission from cloud-top to the ionosphere