1. Introduction

The solar corona is one of the most magnetically structured regions of the solar atmosphere. Although it is extremely tenuous compared with the photosphere, it reaches temperatures of order millions of kelvin and contains large-scale structures such as coronal loops, streamers, prominences, flares, and coronal mass ejections. These phenomena are not distributed randomly. They are organised by the coronal magnetic field. Understanding the magnetic field is therefore central to understanding how energy is stored, transported, and released in the solar atmosphere.

A major difficulty is that the coronal magnetic field is hard to measure directly. Most routine magnetic observations are made at the photosphere, where the magnetic field can be inferred from spectropolarimetric measurements. These observations provide the lower-boundary information for coronal magnetic-field modelling, but they do not directly give the three-dimensional magnetic structure above the solar surface. As a result, the coronal field usually has to be reconstructed indirectly through magnetic-field extrapolation.

The simplest extrapolation model is the potential field. In this model, the electric current density is assumed to vanish, so

∇ × B = 0.

This makes the mathematics much easier and gives a useful reference configuration. Potential fields are often treated as the lowest-energy state compatible with the imposed normal magnetic flux at the lower boundary. However, this simplicity is also a limitation. Since potential fields contain no currents, they cannot represent the free magnetic energy associated with twisted, sheared, or stressed magnetic structures. This is a problem for modelling active regions, where non-potential magnetic structure is closely linked to flares and eruptions.

A more physically flexible model is the nonlinear force-free field. In this approximation, the Lorentz force is assumed to vanish,

(∇ × B) × B = 0,

while the magnetic field remains solenoidal,

∇ · B = 0.

The first condition means that the electric current is parallel to the magnetic field. The second expresses the absence of magnetic monopoles. Together, these equations allow the field to contain currents and free magnetic energy while remaining in approximate magnetic equilibrium. This makes NLFFF extrapolation a standard tool for modelling coronal magnetic fields above solar active regions.

However, NLFFF extrapolation is not a solved problem. The equations are nonlinear, the boundary data are noisy and incomplete, and the photosphere is not itself perfectly force-free. This creates a tension between the assumptions of the coronal model and the observations used to constrain it. Classical NLFFF methods therefore have to compromise between matching the measured boundary field, maintaining numerical stability, and satisfying the force-free and divergence-free equations.

Physics-informed neural networks offer a newer route into this problem. Rather than storing the magnetic field only as values on a numerical grid, a PINN represents the field as a continuous function of position,

B(x, y, z; θ) = (Bx(x, y, z; θ), By(x, y, z; θ), Bz(x, y, z; θ)),

where θ denotes the trainable parameters of the neural network. The network is trained not only to match boundary data, but also to reduce residuals of the governing physical equations. For NLFFF extrapolation, this means penalising violations of the force-free and divergence-free conditions during training.

This makes PINNs attractive because the physical assumptions can be built directly into the optimisation problem. The model is not simply asked to fit data; it is asked to find a magnetic field that is consistent with both the observations and the chosen physical model. Automatic differentiation also allows spatial derivatives such as curls and divergences to be computed directly from the neural representation of the field.

The aim of this dissertation is to investigate PINN-based extrapolation of nonlinear force-free magnetic fields in the solar corona. The focus is not only on whether a neural network can produce a plausible-looking three-dimensional magnetic field. The more important question is whether the resulting field is physically credible. This requires assessing convergence behaviour, force-freeness, divergence control, magnetic topology, and comparison with simpler potential-field extrapolations.

The central question is therefore:

under what conditions does a PINN produce a magnetic field that behaves like a useful NLFFF model of the solar corona?

This framing is important. The neural network is not the physical theory. It is a computational representation used to approximate a magnetic field subject to physical constraints. The success of the method should therefore be judged by the quality of the magnetic field it produces, not merely by whether the training loss decreases or whether the final visualisation looks convincing.

2. Physical background: force-free modelling of the solar corona

The solar corona is governed to a large extent by its magnetic field. Although the corona is extremely tenuous compared with the photosphere, it is highly conducting and magnetically structured. This is why EUV and X-ray images of the Sun often show long, curved coronal loops: the emitting plasma is largely confined to magnetic field lines. These observations make the magnetic structure visually obvious, but they do not directly give the full three-dimensional magnetic field vector in the coronal volume. In practice, the best routine magnetic measurements come from the photosphere, through magnetograms. The modelling problem is therefore slightly awkward from the start: the region of interest is coronal, but the observational boundary is photospheric.

Magnetic-field extrapolation is the standard way of dealing with this mismatch. The idea is to take the observed magnetic field at the lower boundary and infer a plausible three-dimensional field above it. This inference is only possible after choosing a physical model for the corona. At the simplest level, the field may be treated as potential and therefore current-free. More realistic models allow electric currents to be present, provided the resulting magnetic field satisfies the force-free approximation. This dissertation is concerned with the nonlinear force-free field, which is the most flexible of the standard force-free extrapolation models.

The relevant force is the Lorentz force density,

f = j × B,

where j is the electric current density and B is the magnetic field. In much of the corona, the plasma beta,

β = p_gas / p_mag,

is small. This means that magnetic pressure dominates over gas pressure, so the magnetic field controls the plasma more strongly than the plasma controls the field. If pressure gradients, gravity, and flows are neglected to first order, static equilibrium requires the Lorentz force to vanish:

j × B = 0.

This is the force-free condition. It does not mean that the current is zero. Instead, it means that the current density is parallel to the magnetic field, so that no sideways magnetic force is produced. Using Ampère’s law in the magnetohydrodynamic approximation,

μ₀j = ∇ × B,

the same condition can be written as

(∇ × B) × B = 0.

This implies that the curl of the magnetic field is parallel to the field itself,

∇ × B = αB,

where α is called the force-free parameter. The magnetic field must also satisfy

∇ · B = 0,

which expresses the absence of magnetic monopoles. This solenoidal constraint is not just a formal requirement. If it is violated numerically, the resulting field can contain artificial sources or sinks of magnetic flux, which can contaminate both the field topology and the magnetic energy estimate.

The force-free extrapolation problem is therefore to find a magnetic field satisfying

∇ × B = αB,

together with

∇ · B = 0.

The main force-free models differ according to how α is treated.

The simplest case is the potential field. Here,

α = 0,

so

∇ × B = 0.

A curl-free field can be written in terms of a scalar potential,

B = -∇φ.

Substituting this into the solenoidal condition gives

∇ · B = ∇ · (-∇φ) = -∇²φ = 0,

and therefore

∇²φ = 0.

Potential-field extrapolation is therefore reduced to solving Laplace’s equation. This is mathematically clean and computationally useful, which is why potential fields are often used as a baseline. They represent the lowest-energy magnetic configuration compatible with the imposed boundary flux distribution. However, this simplicity is also their main weakness. Since potential fields contain no electric currents, they cannot store free magnetic energy. That makes them inadequate for describing the stressed and sheared fields associated with active regions, flares, and coronal mass ejections.

A linear force-free field is the next step in complexity. In this model, α is non-zero but constant throughout the domain:

∇ × B = αB,     α = constant.

This allows the magnetic field to contain currents and some degree of twist, while keeping the mathematical structure relatively constrained. However, a single global value of α is rarely sufficient for a realistic solar active region. Different parts of an active region may contain different levels of shear, twist, and current concentration. A constant-α model is therefore more flexible than a potential field, but still too restrictive for many practical cases.

The nonlinear force-free field removes this global restriction by allowing α to vary in space:

∇ × B = α(x)B.

This gives the field much more freedom, because neighbouring magnetic flux systems can carry different currents. However, α is still not arbitrary. Taking the divergence of both sides gives

∇ · (∇ × B) = ∇ · (αB).

The left-hand side is zero because the divergence of a curl vanishes. Expanding the right-hand side gives

0 = B · ∇α + α∇ · B.

Using the solenoidal condition,

∇ · B = 0,

leaves

B · ∇α = 0.

This means that α is constant along a given magnetic field line, although it may vary between different field lines. This is a key part of the nonlinearity in NLFFF modelling. The current distribution is tied to the magnetic connectivity, and the magnetic connectivity depends on the field that is being solved for. The geometry and the currents are therefore coupled, which makes the problem much harder than either potential or linear force-free extrapolation.

The hierarchy can be summarised as follows:

potential field:       α = 0
                       no currents
                       lowest-energy baseline

linear force-free:     α = constant
                       currents allowed
                       globally restricted twist

nonlinear force-free:  α = α(x)
                       currents vary between field lines
                       suitable for more complex active regions

This hierarchy matters for the present project because the potential field gives a natural reference model. If a PINN-based NLFFF extrapolation produces a result that is almost identical to the potential field, then it may not be capturing much non-potential structure. That may be physically reasonable for a quiet region, but it would be less convincing for an active region expected to contain shear or twist. Conversely, if the PINN field differs strongly from the potential field, then that difference has to be justified using physical diagnostics. A complicated-looking field is not automatically a better field.

There is also a deeper issue with the lower boundary. The force-free approximation is most appropriate in the low-beta corona, but the photosphere is not generally force-free. The photosphere is denser, more dynamic, and more strongly affected by gas pressure and other non-magnetic forces. Yet this is exactly where the magnetogram data are measured. As a result, the boundary data supplied to an NLFFF model may not be fully consistent with the assumptions of the model itself. Measurement noise, limited resolution, and ambiguity in the transverse field introduce further uncertainty.

This means that NLFFF extrapolation is not a simple forward calculation from perfect boundary data. It is an inverse modelling problem with imperfect observations and approximate physics. The extrapolated field must balance agreement with the magnetogram against satisfaction of the force-free and divergence-free equations. Classical methods handle this through choices such as preprocessing, relaxation, weighting, and optimisation. A PINN handles the same tension through its loss function.

For example, a PINN-based NLFFF model may represent the magnetic field as

B(x, y, z; θ) = (Bx(x, y, z; θ), By(x, y, z; θ), Bz(x, y, z; θ)),

where θ denotes the trainable parameters of the neural network. The network is trained by minimising a loss function containing both physical and observational terms, such as

L = λ_f L_force + λ_d L_div + λ_b L_boundary.

Here, L_force penalises violations of the force-free equation, L_div penalises violations of ∇ · B = 0, and L_boundary penalises disagreement with the observed magnetic field at the lower boundary. The constants λ_f, λ_d, and λ_b determine the relative weight given to each requirement.

This framing is useful because it makes clear that the PINN is not replacing the physics. The neural network is only the representation of the magnetic field. The physical content still comes from the force-free and solenoidal constraints. The method is therefore best understood as a different numerical route into the same NLFFF problem, rather than as a black-box machine learning shortcut.

The attraction of the PINN approach is that the magnetic field is represented as a continuous function of position, and spatial derivatives can be computed directly through automatic differentiation. This makes it natural to include PDE residuals in the training objective. In principle, the model can combine observational boundary information with physical constraints throughout the volume. This is why PINNs are interesting for coronal magnetic-field extrapolation: they offer a mesh-free way of searching for a field that is both data-constrained and physically admissible.

However, the underlying difficulties do not disappear. A PINN may minimise the chosen loss function without producing a physically reliable coronal field. The result can depend on the network architecture, sampling of collocation points, weighting of the loss terms, optimiser behaviour, and treatment of the boundary. In that sense, the method moves some of the numerical difficulty into the training setup. The output still has to be tested, not trusted by default.

For this dissertation, the important question is therefore not simply whether a PINN can generate a smooth three-dimensional magnetic field. The question is whether the learned field behaves like a credible NLFFF solution. That means checking whether it is approximately force-free, approximately divergence-free, reasonably consistent with the boundary data, and meaningfully different from a potential field where non-potential structure is expected.

In this sense, potential fields provide the baseline, NLFFF models provide the physically richer target, and PINNs provide the numerical machinery being investigated. The success of the method depends on whether the extra freedom of the PINN-based NLFFF model captures physically relevant magnetic structure without introducing artefacts. The aim is therefore not just to implement a modern machine-learning method, but to assess whether it gives a useful and physically interpretable model of the solar corona.

3. Classical NLFFF extrapolation methods

The force-free equations define the physical model, but they do not by themselves specify how the magnetic field should be computed. In practice, NLFFF extrapolation requires a numerical method that can take boundary magnetic-field data and reconstruct a three-dimensional field satisfying

(∇ × B) × B = 0,

and

∇ · B = 0.

This is much more difficult than potential-field extrapolation. In the potential case, the problem can be reduced to solving Laplace’s equation for a scalar potential. In the NLFFF case, the current density and magnetic field are coupled through

∇ × B = α(x)B,

where α varies spatially but remains constant along magnetic field lines. The geometry of the field and the distribution of currents must therefore be solved together. This coupling is the source of much of the numerical difficulty.

Several families of classical NLFFF methods have been developed. The main approaches include Grad-Rubin methods, optimisation methods, magnetofrictional or MHD relaxation methods, and boundary-integral or Green’s-function-type methods. These methods differ in how they impose the force-free equations, how they use the boundary data, and how they approach convergence.

Grad-Rubin methods follow the mathematical structure of the force-free equations quite directly. The basic idea is to iterate between determining the force-free parameter α along magnetic field lines and updating the magnetic field from the resulting current distribution. Since

B · ∇α = 0,

α should be constant along each field line. A Grad-Rubin method uses this property to propagate α through the volume, then solves for the magnetic field consistent with the updated current. This process is repeated until the field converges.

The strength of this approach is that it treats α in a physically meaningful way. It respects the fact that α is tied to magnetic connectivity, rather than allowing it to vary independently everywhere. The drawback is that the method is sensitive to the quality and consistency of the boundary data. Real photospheric magnetograms are noisy and not perfectly force-free, so specifying a compatible distribution of α is not straightforward.

Optimisation methods take a different route. Instead of explicitly transporting α along field lines, they define a functional that measures the departure of the field from a force-free and divergence-free state. A typical form is

L = ∫V [ wf |(∇ × B) × B|² / B² + wd |∇ · B|² ] dV,

where wf and wd are weighting functions. The algorithm then evolves the magnetic field so as to reduce this functional. In other words, the method searches for a field that minimises the Lorentz-force residual and the divergence error across the volume.

This is especially relevant to the present dissertation because the optimisation approach is conceptually close to a PINN. Both methods define a global objective which penalises violations of the governing equations. The difference is mainly in the representation of the magnetic field. Classical optimisation methods usually work with field values on a numerical grid, whereas a PINN represents the field through the parameters of a neural network. The mathematical vibe is similar: reduce the physics residuals until the field becomes acceptable. The machinery is different.

Magnetofrictional methods are based on a relaxation idea. The magnetic field is evolved using an artificial velocity chosen so that the Lorentz force is gradually reduced. The method does not attempt to reproduce the real dynamical evolution of the corona. Instead, it provides a numerical pathway toward a force-free equilibrium. The artificial friction removes magnetic stresses until the system settles into a lower-force state.

This approach has a useful physical intuition. The field is allowed to relax from an initial condition, often a potential field, toward a more complex force-free configuration. However, the final result can depend on the initial field, boundary driving, numerical diffusion, and relaxation procedure. MHD relaxation methods use a similar philosophy but retain more of the magnetohydrodynamic equations, which can make them more physically complete but also more computationally expensive.

Boundary-integral and Green’s-function approaches attempt to construct the field in the volume from quantities specified at the boundary. These ideas are natural for potential fields, where the mathematics is comparatively well behaved. For nonlinear force-free fields, however, the spatially varying current distribution makes the problem much less straightforward. As a result, these methods form part of the classical landscape but are less central to the present project than optimisation, Grad-Rubin, and relaxation-based approaches.

A major practical issue shared by all of these methods is the treatment of the lower boundary. NLFFF models are intended to describe the low-beta corona, but the boundary data are usually measured in the photosphere. The photosphere is not perfectly force-free. It contains stronger pressure forces, more complex plasma dynamics, and measurement uncertainties. Therefore, the boundary data may not be directly compatible with the equations being solved.

This is why preprocessing is often used. The aim of preprocessing is to modify the observed magnetogram so that it is more consistent with the force-free assumption while remaining close to the observations. This typically involves reducing net force and torque on the boundary. However, this introduces its own compromise: the extrapolation is no longer driven by the raw observed field, but by a processed version of it. That may improve physical consistency, but it also changes the observational input.

The overall problem is therefore a balancing act:

match the observed boundary field
satisfy the force-free condition
control ∇ · B errors
preserve meaningful magnetic topology
avoid numerical artefacts

This balance is one reason why classical NLFFF extrapolations are often assessed using multiple diagnostics rather than by assuming that convergence alone implies correctness.

Benchmark studies are important in this context. NLFFF methods are commonly tested against analytical or semi-analytical reference fields where the true solution is known. Examples include Low-Lou fields and Titov-Démoulin-type configurations. These tests allow methods to be compared using vector errors, magnetic energy estimates, force-free metrics, divergence measures, and field-line connectivity.

However, performance on idealised tests does not automatically transfer to real solar data. Real magnetograms contain noise, resolution limits, projection effects, and non-force-free components. Different NLFFF methods can therefore produce different coronal fields from the same boundary data. This does not mean that all methods are useless, but it does mean that no extrapolation should be treated as ground truth without further physical checks.

For this dissertation, classical NLFFF methods provide the necessary background for judging the PINN approach. A PINN is not solving a new physical problem. It is another way of approximating the same nonlinear force-free equations. Many of the old difficulties remain: boundary inconsistency, divergence control, convergence behaviour, and interpretation of the final field. The difference is that these difficulties appear through neural-network choices such as architecture, collocation sampling, loss weighting, optimiser selection, and boundary enforcement.

The comparison should therefore not be framed as classical methods versus machine learning in a simplistic way. The better question is how the PINN changes the numerical route through the NLFFF problem, and whether that route produces fields that are physically trustworthy. The final field still has to be evaluated using the same standards as any other NLFFF extrapolation: force-freeness, solenoidal quality, boundary agreement, magnetic energy, and topology.

4. Evaluation of extrapolated fields

After a magnetic field has been extrapolated, the next task is to decide whether the result is physically useful. This is not guaranteed simply because the numerical method converged or because the visualisation looks plausible. A field can have smooth field lines and still violate the force-free equation, contain artificial divergence, or misrepresent the magnetic connectivity. Evaluation is therefore a central part of NLFFF modelling, not an afterthought.

For the present project, the extrapolated field should be assessed from several angles:

force-freeness
divergence control
boundary agreement
magnetic energy
topology and field-line structure
comparison with a potential-field baseline
convergence behaviour

Each of these diagnostics tests a different part of the model. No single number can establish that an extrapolated field is correct.

The first requirement is force-freeness. A valid NLFFF should approximately satisfy

(∇ × B) × B = 0.

Since

j = (1 / μ₀) ∇ × B,

this is equivalent to requiring the current density to be parallel to the magnetic field. One way to measure this is to examine the angle between j and B. If the field is perfectly force-free, this angle is zero everywhere. In practice, one often works with a quantity proportional to

|j × B| / (|j||B|),

which measures the sine of the angle between the current density and the magnetic field.

A current-weighted version of this metric is useful because it gives more importance to regions where the current is physically significant. Without this weighting, weak-field or weak-current regions can dominate a volume average while contributing little to the active-region physics. For a PINN-based extrapolation, this diagnostic is especially important because the force-free residual appears directly in the training loss. The final field should still be evaluated independently, since a low training loss does not necessarily imply uniform physical accuracy across the domain.

The second requirement is control of the divergence of the magnetic field. The solenoidal condition is

∇ · B = 0.

This expresses the absence of magnetic monopoles and is fundamental to the physical interpretation of the field. Numerical divergence errors can alter field-line connectivity and contaminate estimates of magnetic energy. A field with large divergence error is not merely inaccurate; it can become physically misleading.

A simple diagnostic is the average magnitude of ∇ · B over the volume. However, raw divergence values are dimensional and can be difficult to compare between different simulations or grid resolutions. Normalised divergence measures are therefore often more useful. These compare the local divergence error with a characteristic magnetic-field variation over the grid scale. Another physically meaningful approach is to estimate how much of the magnetic energy is associated with nonsolenoidal components. This helps determine whether divergence errors are small numerical imperfections or a major part of the reconstructed field.

Boundary agreement is also essential. An extrapolation should remain connected to the observations that motivated it. In the solar case, this usually means matching the photospheric magnetogram at the lower boundary, especially the normal component of the magnetic field. A typical boundary error can be written schematically as

E_boundary = Σ |B_model - B_obs|² / Σ |B_obs|².

This measures the relative mismatch between the extrapolated field and the observed boundary field.

However, boundary agreement must be interpreted carefully. The photospheric boundary is not perfectly force-free, while the model assumes that the coronal field is. Matching the observed boundary too aggressively can force non-coronal physics into the model. Matching it too weakly can produce a smooth field that satisfies the equations but no longer represents the observed active region. In a PINN, this trade-off appears directly in the relative weighting of the boundary loss and the physics losses.

Magnetic energy is another key diagnostic. The total magnetic energy in a volume is

E_mag = (1 / 2μ₀) ∫V B² dV.

For a fixed normal magnetic flux distribution at the lower boundary, the potential field is usually treated as the minimum-energy reference state. The excess energy in an NLFFF relative to the potential field is then interpreted as free magnetic energy:

E_free = E_NLFFF - E_pot.

This quantity matters because free magnetic energy is the energy available, in principle, to power flares and coronal mass ejections. If a PINN-based NLFFF produces almost no excess energy relative to the potential field, then it may not be capturing much non-potential structure. If it produces a large amount of free energy, that energy needs to be checked against the quality of the boundary agreement, force-freeness, divergence control, and field topology.

Topology provides information that scalar diagnostics cannot. Field lines are obtained by integrating

dr / ds = B(r) / |B(r)|,

where s is distance along the field line. These field lines show how different parts of the photosphere are magnetically connected. In active regions, topology can reveal sheared arcades, twisted structures, flux ropes, null points, or other features associated with magnetic complexity.

However, visualisation has to be treated with caution. Field-line plots can look convincing even when the underlying field has problems. They are also sensitive to seed-point choice and local errors in the magnetic field. A good-looking three-dimensional plot is therefore not proof of a good extrapolation. It should be used as an interpretive tool alongside quantitative diagnostics, not as a replacement for them.

Comparison with a potential-field model is particularly useful because it gives the analysis an anchor. The potential field is simpler, current-free, and usually easier to compute. It provides a baseline for field-line structure, magnetic energy, and connectivity. If the NLFFF and potential field are very similar, then the nonlinear model may not be adding much physical information. If they differ significantly, the differences should be physically interpretable rather than just visually complex.

For this project, the potential-field comparison is important because it helps prevent the PINN from being judged only on its own terms. Neural networks are flexible function approximators, so they can produce complicated outputs. The relevant question is whether that complexity corresponds to physically meaningful non-potential structure. A potential-field baseline makes this question much easier to ask.

Convergence behaviour must also be evaluated. In a classical solver, convergence usually refers to the stabilisation of iterations and residuals. In a PINN, convergence is more subtle because the total loss is made from several competing terms. A typical loss might be

L = λ_f L_force + λ_d L_div + λ_b L_boundary.

The total loss can decrease while one component remains poor. For example, the network may improve boundary agreement while failing to reduce divergence, or it may reduce physics residuals while drifting away from the observed boundary. Therefore, the individual loss terms should be monitored separately, not only the total loss.

It is also useful to assess whether the final field is stable under changes in training setup. Different random initialisations, collocation-point sampling strategies, or loss weights may lead to different solutions. If the extrapolated field changes substantially under small changes in training configuration, then its physical interpretation should be treated carefully.

Overall, evaluation is the part of the project that decides whether the extrapolated field is credible. The field should be approximately force-free, approximately divergence-free, consistent with the boundary data, energetically plausible, and topologically interpretable. It should also be meaningfully compared with a potential-field baseline. For a PINN-based method, these checks are especially important because a successful optimisation run is not the same thing as a physically valid coronal magnetic-field model.