As the first step in our outermost iteration loop (the ``model iteration'')
we use the current best guess of as function of radius
to solve the hydrostatic or hydrodynamic equations to calculate an
improved run of
with radius. Simultaneously, the population numbers
are updated to account for changes in
. The next major step is
the computation of the radiation field for each wavelength point (the
``wavelength loop''),
which has the prerequisite of a spectral line selection procedure for
LTE background lines. Immediately after the radiation field at any given
wavelength is known, the radiative rates and the rate operators are updated
so that their calculation is finished after the last wavelength point.
In the next steps, the population numbers are updated by solving the
rate equations for each NLTE species and new electron densities
are computed, this gives improved estimates for
. The last part of the
model iteration is the temperature correction scheme outlined above (using
opacity averages etc. that were computed in the wavelength loop) which
delivers an improved temperature structure. If the errors in the constraint
equations are larger than a prescribed accuracy, the improved
are used in another model iteration. Using this scheme,
about 10-20 model iterations are typically required to reach convergence
to better than about 1% relative errors, depending on the quality of
the initial guess of the independent variables and the complexity of
the model.