### 4.7 Preprocessing

Wiegelmann et al. (2006b) developed a numerical algorithm in order to use the integral
relations (31) – (35) to derive suitable NLFFF boundary conditions from photospheric measurements. To do
so, we define the functional:
The first and second terms () are quadratic forms of the force and torque balance conditions,
respectively. The term measures the difference between the measured and preprocessed data.
controls the smoothing, which is useful for the application of the data to finite-difference numerical code
and also because the chromospheric low- field is smoother than in the photosphere. The aim is to
minimize so that all terms are made small simultaneously. The optimal parameter sets
have to be specified for each instrument separately. The resulting magnetic field vector is then used to
prescribe the boundary conditions for NLFFF extrapolations. In an alternative approach Fuhrmann et al.
(2007) applied a simulated annealing method to minimize the functional. Furthermore they removed the
term in favor of a different smoothing term , which uses the median value in a small window
around each pixel for smoothing. The preprocessing routine has been extended in Wiegelmann et al. (2008)
by including chromospheric measurements, e.g., by minimizing additionally the angle between the
horizontal magnetic field and chromospheric H fibrils. In principle, one could add additional
terms to include more direct chromospheric observations, e.g., line-of-sight measurements of the
magnetic field in higher regions as provided by SOLIS. In principle, it should be possible to
combine methods for ambiguity removal and preprocessing in one code, in particular for ambiguity
codes which also minimize a functional like the Metcalf (1994) minimum energy method. A
mathematical difficulty for such a combination is, however, that the preprocessing routines use
continuous values, but the ambiguity algorithms use only two discrete states at each pixel.
Preprocessing minimizes the integral relations (31 – 35) and the value of these integrals reduces
usually by orders of magnitudes during the preprocessing procedure. These integral relation
are, however, only necessary and not sufficient conditions for force-free consistent boundary
conditions, and preprocessing does not make use of condition (37). Including this condition is
not straight forward as one needs to know the magnetic field line connectivity, which is only
available after the force-free configuration has been computed in 3D. An alternative approach for
deriving force-free consistent boundary conditions is to allow changes of the boundary values
(in particular the horizontal field) during the force-free reconstruction itself, e.g., as recently
employed by Wheatland and Régnier (2009), Amari and Aly (2010), and Wiegelmann and
Inhester (2010). The numerical implementation of these approaches does necessarily depend
on the corresponding force-free extrapolation codes and we refer to Sections 6.2 and 6.4 for
details.