actually has an impact on the enclosing cells is the photons dumped in the 2nd
step, which will arrive in these cells in the next step.

The 4th step ($t=3\Delta t\rightarrow 4\Delta t$): The photons dumped in the
2nd step now propagate into the cells enclosing the $N_{\rm nb}$ nearest
neighbouring cells. These photons are dumped in the linear increasing stage so
they suffer no reaction and keep the number of $Q\Delta t$ before they begin
to ionize these cells. Once the ionization is conducted, the missing photons
issue will happen in a similar manner as in the 1st step, but now $Q\Delta t$
photons are propagating into $N_{\rm shell}>N_{\rm nb}$ cells. We can simply
estimate $N_{\rm shell}$ as

$N_{\rm shell}=\frac{\left[V(2c\Delta t)-V(c\Delta t)\right]}{V(c\Delta
t)}=7{N_{\rm nb}}\,.$ (57)

Thus, the number of photons consumed by a cell in this step is

$\Delta N_{\gamma,4}=\frac{Q}{7N_{\rm nb}}\Delta t(1-e^{-\Delta t/t_{\rm
ion}})\approx\frac{Q}{7N_{\rm nb}}\Delta t\,.$ (58)

The total number of neutral hydrogen atoms in a cell is the same as Eq. (55)
and the missing photons issue is alleviated when it happens again

$\delta N_{\gamma,4}=\frac{Q}{7N_{\rm nb}}\Delta
t-(1+f_{\text{rec}})\frac{Q}{\alpha_{\rm B}n_{\rm H}{\cal R}_{i}}\,.$ (59)

In general, after the occurrence of the second missing photons issue, the
photon density begins to increase linearly again before the $(2M+2)$th step.
In the $(2M+2)$th step the third photon-missing event will happen and in the
$K(M+1)$th step the missing photons issue will happen $K$ times. The number of
cells involved in the $K$th missing photons issue is

$N_{\rm shell}=\frac{4\pi(K\tilde{c}\Delta
t)^{3}/3-4\pi\left[(K-1)\tilde{c}\Delta t\right]^{3}/3}{4\pi(\tilde{c}\Delta
t)^{3}/3}{N_{\rm nb}}\approx 3K^{2}{N_{\rm nb}}\,.$ (60)

The missing photons issue will keep happening until $\delta
N^{K(M+1)}_{\gamma}\leq 0$, i.e.

$K\approx\sqrt{\frac{{\cal R}_{i}}{3N_{\rm nb}(1+\Delta
t/t_{\text{rec}})}\left(\frac{\Delta t}{t_{\rm rec}}\right)}\,.$ (61)

To strictly avoid the occurrence of missing photons issue, $K$ should be $\leq
1$ and we have equation (34) (drop the factor 3).

##  Appendix C Validation of time-step criterion

In Section 5.1.2, we proposed a time-stepping criterion, $\Delta
t_{\star}\lesssim 0.1t_{\text{rec}}N_{\text{sub}}/(N_{\text{sub}}-1)$, which
avoids oscillations in the H ii fraction and repeated missing photons when
photon injection and thermochemistry are conducted with different cadences.
The strict derivation of this criterion needs solving equation (5.1.2) to find
out when $\delta N_{\gamma,2}<0$. This is extremely complicated and
unnecessary. Alternatively, here we validate this time-stepping criterion by
discussing the solution of this equation with several sets of parameters.

To avoid the oscillation of H ii fraction, we do not need strict $\delta
N_{\gamma,2}<0$ but only a significant fraction of photons survived when the
missing photons issue happens again because of recombination (equation 5.1.2)
to suppress the recombination in the next substep.

In Figure 16, we present the fraction of survived photons (normalized to
$Q\Delta t_{\star}/N_{\text{nb}}$) as a function of $\Delta t_{\text{sub}}$
under different spatial resolutions and speeds of light assuming
$N_{\text{sub}}=2$. With $\Delta t_{\text{RT}}<0.1$ ($\Delta t_{\star}<0.2$)
most runs can leave $>10$ per cent photons after the missing photons issue,
except the ${\cal R}_{i}=10^{4}$ runs with faster speeds of light. The low
spatial resolution cases show weak dependence on the speed of light because
there are always enough H atoms compared with the photon injection rate. In
galaxy formation and multiphase ISM simulations, single H ii regions can
hardly reach such a high spatial resolution as ${\cal R}_{i}=10^{4}$, we thus
argue that our $\Delta t_{\star}\lesssim
0.1t_{\text{rec}}N_{\text{sub}}/(N_{\text{sub}}-1)$ criterion is reasonable
and robust for most cases.

Figure 16: Fraction of survived photons (normalized to $Q\Delta
t_{\star}/N_{\text{nb}}$) as a function of $\Delta t_{\text{RT}}$ assuming
$N_{\text{sub}}=2$. Curves with different colours are obtained with different
spatial resolutions ${\cal R}_{i}={10^{2},10^{3},10^{4}}$. Curves marked
solid, dash, and dot lines are obtained with different speeds of light
${\tilde{c}}_{i}=\\{0.1,0.01,0.001\\}c$.

##  Appendix D Including H2 and He chemistry

To implement our spatial resolution correction scheme including H2 and He
chemistry, we need to modify the parameters in the correction factor (equation
40) for different species. Following Section 3.1.1, the mass resolution
${\cal{R}}_{i}$ refers to how many Lagrangian resolution elements there are to
resolve the initial Strömgren mass, we can modify equation (7) to

$\mathcal{R}^{\text{\text{H\,{ii}}}}_{i,k}=\frac{M_{\text{S,\text{H\,{ii}}}}}{XM_{\text{cell,k}}}\,,$
(62)

where $M_{\text{S,\text{H\,{ii}}}}$ is the theoretical mass of hydrogen
Strömgren sphere, $X$ is the hydrogen mass fraction.

For an H ii Strömgren sphere, we still assume
$x_{\text{\text{H\,{ii}}}}=x_{e}={\cal R}^{\text{\text{H\,{ii}}}}_{i,k}$ and
we have

$f^{\text{\text{H\,{i}}}}_{\text{cor}}=\frac{\alpha_{\text{\text{H\,{ii}}}}n_{\text{H}}}{\tilde{c}\sum_{\text{\text{H\,{i}}}}\sigma_{i\text{\text{H\,{i}}}}n^{i}_{\gamma}}\left({\cal
R}^{\text{\text{H\,{ii}}}}_{i,k}\right)^{2}\,.$ (63)

For He ii Strömgren sphere, we temporarily ignore the conversion between He ii
and He iii, $x_{\text{\text{He\,{ii}}}+\text{\text{He\,{iii}}}}=y{\cal
R}^{\text{\text{He\,{ii}}}}_{i,k}$, $x_{e}={\cal
R}^{\text{\text{H\,{ii}}}}_{i,k}+y{\cal R}^{\text{\text{He\,{ii}}}}_{i,k}$,
where ${\cal
R}^{\text{\text{H\,{ii}}}}_{i,k}=M_{\text{S,\text{He\,{ii}}}}/(1-X)M_{\text{cell},k}$,
$y=(1-X)/4X$

$M_{\text{S,\text{He\,{ii}}}}+M_{\text{S,\text{He\,{iii}}}}\approx\frac{m_{\text{He}}Q_{\text{\text{He\,{ii}}}}}{(n_{\text{H}}+n_{\text{He}})\alpha_{\text{\text{He\,{ii}}}}}\,.$
(64)

The correction factor for He ii is thus,

$f^{\text{\text{He\,{ii}}}}_{\text{cor}}=\frac{\alpha_{\text{\text{He\,{ii}}}}n_{\text{H}}}{y\tilde{c}\sum_{\text{\text{He\,{i}}}}\sigma_{i\text{\text{He\,{i}}}}n^{i}_{\gamma}}\left({{\cal
R}^{\text{\text{H\,{ii}}}}_{i,k}}+{\cal
R}^{\text{\text{He\,{ii}}}}_{i,k}\right){\cal
R}^{\text{\text{He\,{ii}}}}_{i,k}\,.$ (65)

For He iii, each doubly ionized helium contributes two electrons, similarly,
we have

$M_{\text{S,\text{He\,{iii}}}}=\frac{m_{\text{He}}Q_{\text{\text{He\,{iii}}}}}{(n_{\text{H}}+2n_{\text{He}})\alpha_{\text{\text{He\,{iii}}}}}\,,$
(66)

and the correction factor

$f^{\text{\text{He\,{iii}}}}_{\text{cor}}=\frac{\alpha_{\text{\text{He\,{iii}}}}n_{\text{H}}}{y\tilde{c}\sum_{\text{\text{He\,{ii}}}}\sigma_{i\text{\text{He\,{iii}}}}n^{i}_{\gamma}}\left({\cal
R}^{\text{\text{H\,{ii}}}}_{i,k}+2{\cal
R}^{\text{\text{He\,{iii}}}}_{i,k}\right){\cal
R}^{\text{\text{He\,{iii}}}}_{i,k}\,.$ (67)

Notice that the correction of He iii should be based on resolved He ii content
or the He iii usually suffers an under-ionization. However, our correction can
still ensure the numerical convergence by setting an upper limit of He iii
mass.

Both photoionization and photodissociation can destroy H2 molecules. However,
the $>15.2$ eV H2 ionizing photons can also ionize atomic H so their opacity
in ISM is similar to the atomic Strömgren radius. On the other hand, LW band
photons can propagate far away and dissociate more H2, leading to a “molecular
Stömgren sphere” filled with an H i envelope and an H ii region. Thus, we
treat the molecular Stömgren sphere in a similar we to the He ii Strömgren
sphere, i.e., ignore the conversion between H i and H ii inside
$n_{\text{\text{H\,{i}}}+\text{\text{H\,{ii}}}}={\cal
R}^{\text{\ce{H2}}}_{i,k}$ and

$M_{\text{S,\text{H\,{i}}}}+M_{\text{S,\text{H\,{ii}}}}=\frac{m_{\text{H}}Q_{\text{LW}}}{\alpha_{\text{\ce{H2}}}n_{\text{H}}}+M_{\text{S,\text{H\,{ii}}}}$
(68)

where the formation rate $\alpha_{\text{\ce{H2}}}$ is usually dominated by the
dust-catalyzed formation process $\alpha^{\text{D}}_{\text{\ce{H2}}}$. We have

$f^{\text{\ce{H2}}}_{\text{cor}}=\frac{\alpha^{\text{D}}_{\text{\ce{H2}}}n_{\text{H}}}{\tilde{c}\sigma^{\text{LW}}_{\text{\ce{H2}}}n^{\text{LW}}_{\gamma}}{\cal
R}^{\text{\ce{H2}}}_{i,k}\,.$ (69)

We conducted a suite of runs to test the effectiveness of our corrections for
H2 and helium, which were set up similar to Test 2 (Section 4.2). We simulate
the R-type expansion of the Strömgren spheres for different species to
demonstrate that the $\mathcal{R}_{i}$ fix can correct the species masses to
the theoretical value (Strömgren mass) in the early phase. In Figure 17, we
present the evolution of H i (top), He ii (middle), and He iii (bottom) masses
in a $\mathcal{R}_{i}=0.01$ resolution with (black dash curves) and without
(black solid curves) the $\mathcal{R}_{i}$ fix. We also plot the
$\mathcal{R}_{i}=1000$ (red solid curves) solution as a comparison. Similar to
the hydrogen case (Figure 10), our results show that the masses of all species
can be constrained close to their expected analytic result.

Figure 17: Evolution of H i (top), He ii (middle), and He iii (bottom) masses
in a $\mathcal{R}_{i}=0.01$ resolution with (black dash curves) and without
(black solid curves) the spatial resolution correction, compared to the
$\mathcal{R}_{i}=1000$ (red solid curves) solution. Our correction helps to
correct the masses of all species, as seen by their convergence towards the
expected analytic results and those run with the $\mathcal{R}_{i}=1000$
resolution.