  A muonium consists of a positive muon associated with an orbital electron,
and the spontaneous conversion to antimuonium serves as a clear indication of
new physics beyond the Standard Model in particle physics.One of the most
important aspects in muonium-to-antimuonium conversion experiment (MACE) is to
increase the muonium yield in vacuum to challenge the latest limit obtained in
1999. This study focuses on a simulation of the muonium formation and diffusion
in the perforated silica aerogel. The independent simulation results can be
well validated by experimental data. By optimizing the target geometry, we find
a maximum muonium emission efficiency of $7.92(2)\%$ and a maximum vacuum yield
of $1.134(2)\%$ with a typical surface muon beam, indicating a 2.6 times and a
2.1 times enhancement, respectively. Our results will pave the way for muonium
experiments.
