Combined magnetic field evolution in neutron star cores and crusts: Ambipolar diffusion, Hall effect and Ohmic dissipation

Neutron star magnetic field evolution is mediated through the Hall effect and Ohmic dissipation in the crust while ambipolar diffusion is taking place in the core. These effects have been studied in detail in either part of the star, however, their combined, simultaneous evolution and interplay has not been explored in detail yet. Here, we present simulation results of the simultaneous evolution of the magnetic field in the core due to ambipolar diffusion and the crust due to Hall effect and Ohmic decay, under the assumption of axial symmetry. We find that a purely poloidal field generates a toroidal field in the crust, due to the Hall effect, that sinks into the core. A purely toroidal field remains toroidal and spreads into the core and the crust. Finally, for a mixed poloidal-toroidal field, the north-south symmetry is broken due to the Hall effect in the crust, however, ambipolar diffusion, tends to restore it. We examine the role of ambipolar diffusion to the magnetic field decay and we compare the rate of the conversion of magnetic field energy into heat, finding that it enhances the magnetic field decay in neutron stars.


INTRODUCTION
Neutron stars manifest a wide variety of observable behaviours that leads to categorisation in different classes.This observed diversity poses the question of the main cause of these differences.The progress towards their Grand Unification (Kaspi 2010) shows that the main reason behind this diversity is their magnetic field (Harding 2013).The most extreme incarnation of neutron stars, magnetars, are highly magnetized ones with a large reservoir of energy that is released in the form of burst and flares.The rapid onset of these events and the long term persistent thermal emission, deem necessary that their magnetic field evolves, magnetic energy is converted into heat triggering these explosive events.High magnetic field pulsars, occasionally exhibit magnetar-like behaviour, and transition between magnetar and pulsar states (Gavriil et al. 2008;Rea et al. 2010;Archibald et al. 2016).Even in the weak-end dipole magnetic field, central compact objects are bright in X-rays, yet their timing properties hint towards relatively slow rotational velocities and mild spin-down rate (Tuohy & Garmire 1980;De Luca et al. 2006;Popov et al. 2015;Esposito et al. 2019).In this context, a global and unified picture of the main mechanisms behind magnetic field evolution of neutron stars is essential.Goldreich & Reisenegger (1992) set the main framework for studies related to neutron stars magnetic field evolution.The Hall effect and subdominant Ohmic dissipation are responsible for the evolution in the crust while ambipolar diffusion is the dominant mechanism in the core of highly magnetized ones, i.e. magnetars with field strengths ★ E-mail: d.skiathas@ac.upatras.gr,dimitrios.skiathas@nasa.gov† E-mail: kngourg@upatras.gr of 10 14 − 10 15 G.In cases with appropriate conditions in the core, effects due to superconductivity and superfluidity also contribute to the evolution of the magnetic field (Glampedakis et al. 2011a;Lander 2013Lander , 2014;;Graber et al. 2015;Passamonti et al. 2017b;Dommes & Gusakov 2017).
The evolution in the crust under the Hall effect and Ohmic dissipation has been studied in detail both analytically and numerically (Hollerbach & Rüdiger 2002, 2004;Cumming et al. 2004;Reisenegger et al. 2007;Pons et al. 2009;Viganò et al. 2013).In axial symmetry the field is found to evolve toward the Hall attractor state (Gourgouliatos & Cumming 2014a,b).In three dimensions Gourgouliatos et al. (2016) found that non-axisymmetric features can developed even from an initially axisymmetric configuration.Moreover, more complex states involving spots, zones of magnetic field and turbulent fields have been studied in this context (Geppert & Viganò 2014;Wood & Hollerbach 2015;Geppert 2017;Gourgouliatos & Hollerbach 2018;Pons & Viganò 2019;Gourgouliatos & Pons 2019;Igoshev et al. 2021b;Dehman et al. 2023) and more recently the case of off-centered dipolar and multipolar magnetic fields and their implications on neutron star evolution has been explored (Igoshev et al. 2023;Agalianou & Gourgouliatos 2023).
The mechanism of ambipolar diffusion in the core of a neutron star has also be studied, yet, its non-linear dependence on the magnetic field through the cubic power, and the complication of microphysics of the inner crust and the core, have made this task rather challenging.There are studies that have examined the impact of ambipolar diffusion in a core of a neutron star consisting of normal matter, in one dimension (Hoyos et al. 2008), in axial symmetry (Castillo et al. 2017;Castillo et al. 2020;Passamonti et al. 2017a) and more recently in three dimensions (Igoshev & Hollerbach 2023).The effect of superfluidity and superconductivity has also been examined both in some of the works already referred but also in the works of Elfritz et al. (2016); Glampedakis et al. (2011b); Bransgrove et al. (2018).However the relevance and the impact these effects have, in magnetic field evolution, is still not completely resolved.
The prevailing approach of these studies is that the evolution is simulated in detail in the region under consideration, i.e. the crust or the core.However, the state of the magnetic field in the rest of the star, is approximated through either a stationary magnetic field, or, in some cases is devoid of magnetic field, using an appropriate assumption, i.e. the Meissner effect has pushed the field out of the core.There are few studies considering the coupled evolution of the crust under Hall effect and Ohmic dissipation and the core magnetic field (Bransgrove et al. 2018;Elfritz et al. 2016;Viganò et al. 2021).In the first two the core magnetic field evolution is mainly driven by the interaction of the flux tubes with the core matter or the neutron vortices; in the third one the primary focus is on the magnetothermal evolution with the inclusion of the mechanism of ambipolar diffusion, for relatively short timescales.
As the region of the crust-core interface containts a highly resistive layer (Pons et al. 2013), the formation of strong currents there leads to efficient dissipation or the generation of instabilities (Rheinhardt & Geppert 2002;Rheinhardt et al. 2004;Pons & Geppert 2010;Wood et al. 2014;Gourgouliatos & Hollerbach 2016), which however require fully three-dimensional calculations for their study (Gourgouliatos & Pons 2019).Simulations that focus exclusively either in the crust or the core cannot demonstrate the full range of these phenomena, nevertheless, such effects are, in some occasions introduced, in the context of bursts and glitches (Bransgrove et al. 2020;Yuan et al. 2021).
In this work we present the results of a novel code that simulates the evolution of the magnetic field in a highly magnetized neutron star.We take into account both the crust, where the magnetic field evolves due to the Hall effect and Ohmic dissipation, and the core where ambipolar diffusion dominates.These effects are simulated simultaneously.We do not account for the effects of superconductivity and superfluidity.The physical parameters determining the pace of the evolution (Hall and ambipolar diffusion parameter) are piecewise constant in the crust and the core and invariable with respect to time.
The structure of this paper is as follows.In section 2 we describe the physical model, extracting the evolution equation and the relevant conditions that need to be satisfied.The cases studied and the corresponding results of the simulations are presented in section 3.In section 4 we discuss the results comparing them with previous studies.In section 5 we summarise our conclusions.

Equations of motion
We are considering a neutrally charged non-rotating neutron star consisting of normal matter.The interior of the neutron star is modeled as a mix of protons, neutrons and electrons, labeled by the indices n, p, e.For example the number density of the involved particles would be  n ,  p and  e respectively.The local charge neutrality of the neutron star implies that  e =  p .Hereafter  c would be the number density of charged particles.The total number of baryons is  b and the fraction of neutrons to baryons is  n .In our calculations and simulations the neutron number density is considered to be uniform in the entire star.
Charged particles interact through electromagnetic forces.Between electrons and neutrons there are weak interactions, while protons and neutrons are subject to nuclear forces.All particles are under the influence of a gravitational potential.
Based on the model described by Goldreich & Reisenegger (1992) the equation of motion for the electrons, protons and neutrons are: (1) where  is the electric field,  is the magnetic field, Φ is the gravitational potential,   is the relaxation time for collision between  and  particles (by  and  we denote any species of particles involved in some interaction),  is the speed of light,  the electron charge,   is the velocity of  particles and  *  is the effective mass of −particles.
The electron effective mass is defined as  * e =  e (1 +  2  ) 1/2 , where  e is the ratio of the Fermi momentum to electron rest mass.On the other hand because protons are not degenerate relativistic particles in the core of neutron stars like electrons, their effective mass is smaller than their rest mass.We take protons effective mass to be constant and equal to 0.6 p where  p is the proton rest mass.In a similar way the neutron effective mass is defined.In the calculation we perform here, the conservation of momentum is used where    *  /  =    *  /   and eventually only the proton effective mass will be used in the final expressions.
The acceleration terms in the left side of equations (1-3) can be neglected in the framework of quasi-stationary evolution driven by slow motions.Under the hypothesis of stationary neutrons their friction with the charged particles provide the necessary mechanism for the charged particles to evolve through successive quasi-equilibrium states without the need to introduce artificial frictional forces to restore the hydro-magnetic quasi-equilibrium as used in Hoyos et al. (2008) and Castillo et al. (2020), where moving neutrons are considered.

Induction Equation
Using the method described in Goldreich & Reisenegger (1992) and Passamonti et al. (2017a) we can combine equations (1),( 2) and (3) to obtain Ohm's law for the electric field.Then using Faraday's law  / = −∇ ×  we take the evolution equation for magnetic field The above equation is the induction equation where the first two terms describe the evolution of magnetic field due to Hall effect and Ohmic dissipation respectively.

Ambipolar diffusion velocity
In the last term of equation ( 4),  p is not the ambipolar diffusion velocity but the velocity of protons.As explained in Passamonti et al. (2017a) and Igoshev & Hollerbach (2023) we have to expand   as   =   +  (  −  ) where   is the baryon velocity defined as   = (    +     )/  .Although recent studies found baryon velocity to be large (Castillo et al. 2020;Ofengeim & Gusakov 2018), we assume here that this velocity is negligible similar to (Castillo et al. 2017;Passamonti et al. 2017a;Igoshev & Hollerbach 2023), thus   =   where we have defined ambipolar diffusion velocity to be   =   (  −   ).This assumption although it is not changing qualitatively the evolution, it makes it slower, resulting in longer timescales.
Combining equations ( 1), ( 2) and (3) as shown in Passamonti et al. (2017a) and analytically explained by Igoshev & Hollerbach (2023) in their Appendix A, the ambipolar diffusion velocity can be calculated by the following equation The first term in the right-hand side is the magnetic force   =  × / where  = ∇ × /4 is the electric current.The second term is the deviation from chemical equilibrium Δ =   +   −   .
In the core of the neutron star, weak interactions act to restore the chemical equilibrium.However, weak interactions will be fast enough only in the early life of a neutron star.In this case the departures from chemical equilibrium do not last long and the gradient in ( 5) is sufficiently small to be ignored.As a result ambipolar diffusion will be proportional to the magnetic force.
Later as the neutron star cools down, weak interactions will not be sufficiently fast to restore the chemical equilibrium in short timescales and thus the magnetic force, see equation ( 5), will be balanced by the gradient of the departures from chemical equilibrium.These departures from chemical equilibrium can be calculated by solving the equation where  is the change of reaction rate depending on deviation from chemical equilibrium  = (Γ/Δ)|  .The derivation of equation ( 6) can be found in the Appendixes of Passamonti et al. (2017a) or Igoshev & Hollerbach (2023).The only difference here is that   and the other physical parameters are considered uniform, thus the terms involving their spatial derivatives are zero.
Considering equation ( 5) we have to note that only the irrotational part of the magnetic force can be balanced, as the gradient of a scalar function is involved.Thus, departures from chemical equilibrium that may develop during the evolution of the system, will suppress the irrotational part of   , thus, the velocity will be predominantly solenoidal (Castillo et al. 2017;Passamonti et al. 2017a).
In our simulations we choose the rate of weak interactions  to correspond to the one of the modified Urca reactions which given by Sawyer (1989) as where  0 is the nuclear saturation density,  neutron star density and  8 the temperature in units of 10 8 K.

Dimensionless Equations
Using equation ( 5) for ambipolar velocity and substituting the magnetic force and the electric current, the evolution equation ( 4) for the magnetic field takes the form where and In a similar way, an equation for  can be deduced starting from the equation of the deviations from chemical equilibrium (6).Using the dimensionless variables  and  and substituting the magnetic force we arrive at the following equation for where

Magnetic Field Configuration
We restrict ourselves to axial symmetry, thus we can decompose the magnetic field in a poloidal and a toroidal component The scalar functions (, , ) and  (, , ) are associated to the poloidal and toroidal magnetic field respectively,  denotes time,  is the radial coordinate,  the polar angle and  the azimuthial angle.

Final equations
To derive the equations of evolution of the magnetic scalar functions we notice that the right-hand side of equation ( 9) is the curl of a vector quantity , with where is a vector quantity, whose curl describes the evolution of the magnetic field under Ohmic dissipation is a vector quantity, whose curl describes the evolution of the magnetic field under Hall effect and is a vector quantity, whose curl describes the evolution of the magnetic field under ambipolar diffusion.Equation ( 9) takes the simple form Using the field decomposition in a poloidal and a toroidal part, equation ( 14), we can easily find that and In our simulations we solve equation ( 12) for the current values of potential  and , then we integrating equations ( 20) and ( 21) to calculate the evolution of  and  using relations (15-18).

External field
Outside the star we assume a vacuum, thus there are no currents and as a result the external magnetic field is the gradient of a scalar field Ψ such that Ψ is the solution of equation We decompose the external field in a sum of multipolar expansion (Marchant et al. 2011): where the coefficients   can be calculated as follows where   is the neutron star radius,   () is the Legendre polynomial of degree  and  1  () is the associated Legendre polynomial of degree  and order 1.

Boundary conditions
On the surface of the neutron star the radial field must be continuous, thus the  potential, at  =   , have to satisfy the condition In addition   is zero outside of the star, thus we set on the surface of the star   = 0 and consequently  = 0. Inside the neutron star, due to axial symmetry no field line is permitted to cross the symmetry axis.This means that   =   = 0 on the axis, or in terms of the scalar functions  = 0 and / = 0 respectively.For simplicity we choose that the constant value of  to be zero on the symmetry axis.
Lastly at the crust -core interface  =   we impose the condition that the radial component of ambipolar diffusion velocity to be zero.From equation ( 5) this condition means that

Timescales
Combining the relevant parameters we obtain the Ohmic dissipation timescale: with  being the scale of the region the mechanism acts.
In our simulations we will use Ohmic dissipation both in the crust and the core.The timescales in the two regions will not be of the same order because of difference on the electrical conductivity, as it will be explained further in the next section, and different scales with the crust having a width of 0.1  .This leads to a slower magnetic field evolution due to Ohmic dissipation in the core of the neutron star compared to the crust where the conductivity is smaller and thus Ohmic dissipation has a stronger impact on the evolution of the magnetic field in the neutron star evolution.
The Hall effect has a timescale: The timescale of the Hall effect has a dependence on the magnetic field strength making it a faster mechanism than Ohmic dissipation and thus responsible for the evolution in the first kyr of the magnetic field evolution in the crust of the neutron stars, provided that the magnetic field is sufficiently strong.For typical values of crustal microphysics this occurs at approximately 10 13 G.
With respect to ambipolar diffusion, in a similar manner we can derive from the evolution equation ( 8) the timescale The dependence on the magnetic field is more drastic now making the ambipolar diffusion the dominant mechanism in the core of a highly magnetized neutron star.In ambipolar diffusion timescale there is an implicit dependence on the temperature through the relaxation time of proton-neutron interactions (Yakovlev & Shalybkov 1990) 1 The timescale of the ambipolar diffusion can be distinguished into two timescales for the solenoidal and irrotational part of ambipolar diffusion.The gradient of the departures from chemical equilibrium as explained in subsection 2.3 will balance the irrotational part of the magnetic force and thus reducing the component of the velocity.A timescale can be associated with every part of the velocity.In the work of Passamonti et al. (2017a) they examine how the temperature affects the timescales and they find out that at low temperatures  < 10 9 K and mUrca processes the timescale of the irrotational part is some orders of magnitude larger than that of the solenoidal part.On the other hand at higher temperatures the two parts have almost the same timescale.In our simulation below we are interested in these temperatures (∼ 10 9 K) and thus we do not examine further such differences.

SIMULATIONS
We solve equations ( 20) and ( 21) for the poloidal and the toroidal functions numerically on a two dimensional grid using a finite difference method.The grid is constructed so that the neutron star has a crust width of 0.1 of the neutron star radius.It consists of 104 points in radial direction and 102 in the angular direction.The time integration is done using a 3-step Adams-Bashforth method.
In the crust of the neutron star we account for both the Hall and the Ohmic dissipation to take action but not ambipolar diffusion.In the core of the neutron star ambipolar diffusion is the dominant mechanism.
Equation ( 12) is solved at every step for the values of the potentials at the time of the integration while the other variables are fixed during the field evolution.The electric conductivity has different constant values in the core and the crust of the neutron star.
We study the evolution for four different initial magnetic field configurations.Namely, two configurations of either a pure poloidal or a toroidal initial field.A configuration of a mixed poloidal-toroidal field, where the toroidal field is located in an extended part of the star, containing equal amounts of energy.Finally, we study a system where the toroidal field is initially confined in the region of closed poloidal field lines, the so-called "twisted torus" configuration.
In every case the initial conditions for the magnetic filed were constructed using combinations of Ohmic modes, solutions of the field evolution equation where only Ohmic dissipation contribute to the evolution.Thus for the poloidal scalar function we use the functions and for the toroidal scalar function the functions where   is the spherical Bessel function of order ,  1  are the associated Legendre polynomials of degree  and order 1.The values of the coefficients,   and  ′  , and the amplitudes,   and  ′  , are set by the boundary conditions and by requiring that  2 has a volume average equal to 1 over the interior of the star respectively.The values used are the ones presented in Tables 1 and 2 of Castillo et al. (2017).
The neutron star has a radius of 10km and and the strength of the magnetic field is normalised to  0 = 10 15 G.The conductivity and number density of charged particles are chosen to be uniform, in particular   = 10 36 cm −3 ,   = 0.9,    = 8 × 10 24 s −1 and   = 1.14 × 10 24 s −1 , resulting in a Reynolds number,   =  0 /  , of approximately 80 in the crust.We have to note here that the purpose of the values used in this study is not to try to fit our model in specific set of physical observations but to investigate how the the evolution in crust under the Hall effect and in the core under the ambipolar diffusion are coupled to each other, while ensuring numerical convergence.In this context the values used are selected so the interplay beetween the two mechanism are not obscured very fast by the diffusion of the field.The other variables are   = 2.8 × 10 −19 s and  = 8.94 × 10 33 erg −1 cm −3 s −1 corresponding to a temperature of the neutron star of 10 9 K.The resulting evolution time is   ≃ 2.2 , which is used for scaling throughout this work.

Crust -core interface
The evolution in the crust proceeds under the Hall effect and the Ohmic dissipation.In the core, the evolution is due to ambipolar diffusion and a subdominant Ohmic dissipation.Switching abruptly between the two regimes, leads to discontinuities of the magnetic field evolution which, due the non-linear terms involved, results in computational artifacts.A way to deal with them is to increase the dissipation of the magnetic field by adopting lower values for the electrical conductivity.The physical parameters involved in the magnetic We plot with solid line the coefficient of ambipolar diffusion, with dashed line the   and with dash-dotted line the   field evolution, namely the electrical conductivity and the density of the charged particles is expected to change with radius in a realistic neutron star.This will result to smoother changes.So, we approximate a region close to the crust-core interface where the physical parameters are not homogeneous.This way, the transition between the different mechanisms is smooth.
We have implementing that, by choosing a zone of small width of 0.05 0 around the crust-core interface.In that zone the field evolves under all mechanisms (Hall, Ohmic and ambipolar diffusion) but the coefficients of the terms in equation ( 9) are linearly interpolated between the values they have in the crust and in the core.The coefficient of ambipolar diffusion moving outwards goes from unity to zero, the coefficient of Hall effect starts from zero becoming   in the crust and the coefficient of Ohmic dissipation from the value of   in the core to the value of   in the crust.
The region of the smooth transition between the core and the crust is selected in such a way that the Hall effect is still the dominant mechanism in the crust ( ≥ 0.9 0 ) (see figure 1) while ambipolar diffusion dominates the evolution in the core ( ≤ 0.9 0 ).

Purely poloidal initial field
We start our study from the case where only a poloidal field exists in the star.The initial poloidal potential is (, ) = − 11 (, )/ √ 2 and the toroidal field is set to be zero, i.e.  (, ) = 0.
The evolution is presented in figure 2. At the first few kyrs of evolution the Hall effect generates a toroidal component from the initially purely poloidal field.Ambipolar diffusion pushes the poloidal field lines outwards.As a result the poloidal field lines become straight.Eventually the field dissipates due to the Ohmic dissipation.The toroidal component relaxes to a quadrupole configuration concentrated primarily at the crust-core interface but also extending in both the core and the crust.The evolution of the crustal field here determines the final state of the evolution.
In our simulations the poloidal field lines cross the crust-core interface smoothly, without developing kinks or discontinuities.However, there is a difference in the dissipation at the two regions.This was the case even if we do not consider the crust-core smooth transition as described in the previous subsection.

Purely toroidal initial field
Here, the poloidal field field is set to be zero, (, ) = 0 while the toroidal field is  (, ) = − 11 (, )/ √ 2 The evolution of an initially purely toroidal field is simple.Without poloidal field lines to constrain it, ambipolar diffusion pushes the field at the crust-core interface.Meanwhile the field in the core decays.In the simulation, due to this decay, the toroidal field is seen as expanding.
Due to the coupled evolution as the ambipolar diffusion pushes the field in the core towards the interface, there, due to the Hall effect it starts to move southwards creating the configuration shown in the last panel of figure 3.
Contrary to the case of a purely poloidal field, if we do not consider a smooth transition at the crust-core interface, the toroidal field will develop discontinues because of the different mechanisms operating on either side of the boundary.Thus, to prevent such discontinuities of the toroidal field the inclusion of a transition layer there at the crust-core boundary is necessary.

Mixed initial field
For the mixed initial field case we choose (, ) = − 11 / √ 2 and  (, ) = − 11 / √ 2. In figure 4 we show the evolutionary stages of this system.Initially, the toroidal field is pushed towards the crustcore interface and especially where the region of the poloidal field lines that close inside the star.Simultaneously the Hall effect has moved the field towards the northern hemisphere, while some toroidal field is generated in the crust.As a result a part of the initial toroidal field is trapped inside the core and slowly dissipates due to Ohmic decay.
Furthermore, as shown in figure 4, while the Hall effect breaks the north-south symmetry by pushing the closed poloidal field lines towards the north (south if the initial field has opposite polarity), ambipolar diffusion in the core restores the north-south symmetry at later stages of the evolution.In fact, choosing different values of the physical parameteres changes the relative strength of the mechanisms, thus a different degree of violation of north-south symmetry in the poloidal field lines is observed.
Eventually the field will relax to a state similar to the pure poloidal field case but with a significant portion of the initial toroidal field existing in the core dissipating slowly due to the mild Ohmic dissipation.Moreover similar to case of the purely initial toroidal field the remaining field in the core is slowly moving southward.

Toroidal field confined in closed poloidal field lines
In this case the toroidal field is everywhere zero except the region of close poloidal field lines.In order to achieve this the toroidal field potential  (, ) = 0 if (, ) <  0 where  0 is the surface poloidal potential on the equator, and  (, ) =  1 ((, ) −  0 )  2 if (, ) ≥  0 where  1 is a coefficient controlling the relevant strength of toroidal and poloidal field while  2 controls the region where toroidal field is different from zero.In the following we have used  1 = 60 and  2 = 1.05.The poloidal field function is (, ) = − 11 (, )/ √ 2 The evolution in this case follows the behaviour of the mixed field configuration.Here the energy of the toroidal and the poloidal field are not equal, as the poloidal field has significantly more energy.
Thus, the toroidal field in the crust moves north as was the case for the mixed field configuration.However, now the toroidal field that was generated from the Hall effect quickly attains the same strength as the initial toroidal field and eventually overtakes it.Thus, from that point onwards, shown in the third snapshot of figure 5, the evolution is similar to the purely poloidal field.The broken north-south symmetry is restored as the dissipation of the magnetic field proceeds in later times.

Magnetic field Energy
The energy contained in the magnetic field is calculated by the integral: where  is the volume of the neutron star.As presented in figure 6 for all the cases considered, there is a fast energy dissipation in the first few kyr of the magnetic field evolution.In figure 7 the solid line represents the energy loss rate of the initial mixed field configuration.Moreover the energy loss rate in the case of the purely toroidal initial field is also plotted.It is evident that in this case the magnetic field energy dissipates faster.In both cases there is the same initial energy in the toroidal field and the only difference is that in the case of the mixed field a poloidal component with similar energy is also present.The initial poloidal field results in an evolution with initially lower magnetic energy loss.However before the first 100 kyr, in the case of the purely toroidal field the energy loss rate is starting to decrease and becomes slower than that   of an initial mixed field configuration in which the drop is observed at later times.This behaviour becomes more clear if we consider a case of a purely toroidal initial configuration with energy similar to the total energy of the mixed field configuration (dash-dotted line in figure 7).There, the energy loss rate is even higher at the first kyr of the evolution and with an earlier time of drop.
In the same diagram, we plot the X-ray luminosity observed from magnetars of McGill Catalog are plotted (Olausen & Kaspi 2014).The cases where initially there is more energy in the toroidal field seem to fit them better further supporting the hypothesis that strong toroidal fields might present in magnetars Igoshev et al. (2021a).
We have to note here that our result are based on the assumption that the baryon velocity is neglected.This assumption results in slower evolution and thus lower energy loss rate.

DISCUSSION
Our simulations combine the evolution of the core dominated by ambipolar diffusion and the crust dominated by the Hall effect.While the combined evolution is complex, we can identify some trends known from previous works that have focused on either the Hall effect or ambipolar diffusion.
In the case of the purely toroidal field and constant crust density the magnetic field will be displaced due to the Hall effect in the crust, in z direction.A positive field as the one we simulate here will move in the −z direction, figure 3.In the case of the purely poloidal field the Hall effect will generate toroidal and rearrange the energy of the field components.Furthermore, a crust-confined magnetic field with a mixed field configuration, that evolves due to the Hall effect will be driven towards a pole depending on the polarity of the initial field, breaking the north south symmetry of the configurations.For a positive polarity initial configuration there will be movement towards the north while for a field with negative polarity towards the south (Reisenegger et al. 2007;Pons et al. 2009;Viganò et al. 2013;Gourgouliatos & Cumming 2014b).This is indeed what we see at the first stages of the magnetic field evolution in figures 4 and 5.
Regarding the core evolution, Castillo et al. (2017) have found that due to ambipolar diffusion the toroidal field is driven inside closed poloidal field lines.This behaviour is also observed in simulations where we consider a neutron star without a crust and a core occupying the entire star.In the simulations presented here however, due to the simultaneous evolution in both regions this effect is not completely evident, although a movement of the toroidal field towards the regions of closed poloidal field lines can be seen in the first few kyr of the evolution.However as the evolution in the crust proceeds, the region of closed poloidal field lines is pushed completely to the crust where the mechanism of ambipolar diffusion is not operating.Thus, in the timescales studied here toroidal field is also present outside the region of closed poloidal field lines.
The values of   and  used here, correspond to a temperature of 10 9 .At this temperature the ambipolar velocity has a strong irrotational part as the relevant reactions are fast enough and so the magnetic field is advected to the exterior of the core towards the center of the closed poloidal field lines (Passamonti et al. 2017a).That is the case in our simulations with the outward movement of the magnetic field with a velocity profile like the one shown in figure 8.
The departures from chemical equilibrium in this range of temperatures are small enough because the reactions are sufficiently fast and the equilibrium is restored quickly.Thus, the irrotational part of the magnetic force will not be completely balanced by the gradient of the departures from the chemical equilibrium and the velocity of the ambipolar diffusion will have a large irrotational component.
At lower temperatures the reactions will not be fast and the depar-  tures from chemical equilibrium will be larger developing a gradient that can suppress better the irrotational part of the magnetic force.At such temperatures the values of the physical parameters result to a smaller timescale for ambipolar diffusion making the evolution of the core faster and to the same order with the timescale of the Hall effect.
In simulations with such temperatures the end state configuration is reached faster and the most of the toroidal field, that was initially in the core, is expelled to the crust-core interface.However, special care should be taken with the boundary condi-tion for the departures from chemical equilibrium at the crust-core interface.Enforcing the velocity of ambipolar diffusion to be zero at the crust-core interface can result in large gradients of Δ and the appearance of numerical artifacts on the magnetic field evolution.The Hall effect does not dissipate the energy of the magnetic field of a neutron star, thus the mechanisms that contribute to the energy dissipation are the Ohmic dissipation and ambipolar diffusion.The timescale of Ohmic dissipation (equation 27) is independent of the strength of the magnetic field and scales with electrical conductivity.As a result in a core of a neutron star the timescale of the Ohmic dissipation would be very long to provide alone a path for the magnetic field energy dissipation in a reasonable timescale.Without considering the effects of superfluidity and superconductivity, ambipolar diffusion, through the frictional drag between the charged and neutral particles and neutrino and anti-neutrino emitted from the beta reactions, provides a viable path for the energy losses.
Additionally the behaviour of ambipolar diffusion pushing the magnetic field towards the crust of the neutron star, a region with lower electrical conductivity than the core, can enhance the energy losses from the Ohmic dissipation by transporting the magnetic energy there.In highly energetic neutron star with strong magnetic fields, like magnetars, ambipolar diffusion combined with the presence of strong toroidal fields should be considered as a viable deposit for efficient energy dissipation in the depths of the crust.
Several works have performed studies of the coupled evolution of the crust and the core magnetic field, with a variety different assumptions for the physical mechanisms operating, we will perform below a comparison between these studies and our results.In Bransgrove et al. (2018), the evolution of the magnetic field was studied both in crust and the core of a neutron star provided that the core reaches a hydromagnetic equilibrium in response to the evolution in the crust.The core magnetic field structure is given through the implementation of hydromagnetic equilibrium; we note however that ambipolar diffusion is not accounted for.Under the assumptions employed in that work, the initial poloidal core magnetic field is parallel to the axis of symmetry, forming straight lines, and after sufficiently long evolution it accumulates close to the crust-interface, due to flux tube drift (Jones 2006).In our approach, we find that the poloidal core magnetic field approaches the straight line and parallel to the axis structure due to ambipolar diffusion in a scale of ∼ 500 kyr.Furthermore, in our results the toroidal field tends to be nested within poloidal flux loops, whereas in Bransgrove et al. (2018) the toroidal field is present mainly in the crust, with some toroidal field in the core if relaxation to a hydromagnetic equilibrium is postulated.As our aim is to examine how the interplay between the ambipolar diffusion and the Hall effect will impact the global evolution, we not require the core to reach the hydromagnetic equilibrium.In the work of Elfritz et al. (2016) several effects are accounted for the flux-tubes in the core, including the buoyant force, superconductivity, the drag forces and their self-tension, but not ambipolar diffusion.At the end of their simulation, the changes of the core field were very moderate and no indication of straightening of the poloidal magnetic field lines was noted, as opposed to our work.Viganò et al. (2021) performed magnetothermal simulations for the first 100 kyr of evolution.In their study, they did not observed a significant evolution due to ambipolar diffusion in the core for the case of the toroidal field confined in the close poloidal field lines.There was only a small bending of the poloidal field lines accompanied with a small displacement of the toroidal field outwards.Similar behaviour was observed in our simulation for  < 0.05  and the temperature of 10 9 .As the main aim of their work was on the magnetothermal evolution they did not explore a wide range of initial conditions, other than the twisted torus one, in their runs with ambipolar diffusion.
For lower temperatures the velocity of ambipolar diffusion is higher and the effects of ampipolar diffusion stronger.However as noted in Viganò et al. (2021) and we also encounter in our simulation numerical instabilities developed on those temperatures due to strong gradients around crust -core interface.In order to deal with this issue a more detailed approach is needed for this region and it will be addressed in future research.

CONCLUSIONS
The combined evolution of the magnetic field of neutron stars with Hall effect and Ohmic dissipation in the crust and ambipolar diffusion in the core has been examined in this work.
Ambipolar diffusion in the core of the neutron stars pushes the magnetic field toward crust -core interface.Meanwhile, in the crust toroidal field is generated due to the Hall effect.Moreover, the presence of an internal toroidal field in the form of a twisted torus breaks the north-south symmetry.Ambipolar diffusion makes the poloidal field lines parallel to the star's axis and traps the toroidal field into closed loops in the core.As the field dissipates the poloidal field lines move outwards while the toroidal field south or north depending on the initial polarity.
In all the cases studied here the evolution relaxes to a configuration strongly influenced by the evolution of the crust.In the cases where poloidal field exists the field relax to a state similar to the Hall attractor in the crust.A purely toroidal field relaxes to a state with the remaining field moving towards the north or south depending on the polarity of the initial field as determined by evolution due to the Hall effect.
For the general case a larger variety of physical parameters can be examined to derive general conclusions.Furthermore, a significant role in the outcome has the modeling of the crust -core interface and the condition for the matter that will be applied there.A simplistic assumption for the transition of the evolution from core to crust could constraint the parameter space as well as the numerical capabilities and the accuracy of the code by developing strong gradients.
Regarding energy dissipation, configurations with enough energy in their toroidal fields result in faster magnetic energy dissipation.This kind of magnetic field configurations might exist in magnetars where large energy releases required for their activities.
Although the results outlined here are constrained by the assumptions of constant temperature, piece-wise homogeneous physical parameters, immovable neutrons and axial symmetry, they reveal the basic characteristics of the evolution in each region have in the global magnetic field evolution.Furthermore, the choice of a constant temperature impacts the ambipolar velocity profile.Selecting a lower temperature results to a stronger irrotational component of the ambipolar velocity profile and thus an impact on the combined evolution.We note however that the impact of the temperature on the evolution is left for future investigation.At lower temperatures however and below a critical temperature the effects of superfluidity and superconductivity should also be considered.
Overall, the combined evolution of ambipolar diffusion with the Hall effect leads to efficient decay and conversion into thermal energy.The core field evolves towards a uniform field with straight field lines in the core which is then linked to the crust field.The crustal field generates a toroidal component.As the toroidal field moves towards the crust-core boundary, on either side of the interface, fields of opposite polarity create sites of strong dissipation due to the large currents that may trigger current-driven instabilities in this region.

Figure 1 .
Figure 1.The values of the coefficients of evolution equation at crust -core interface.We plot with solid line the coefficient of ambipolar diffusion, with dashed line the   and with dash-dotted line the

Figure 2 .
Figure 2. The magnetic field in four different times, starting from a initially purely poloidal magnetic field.The black lines are the magnetic lines of the poloidal field and color represents the toroidal field function .

Figure 3 .
Figure 3. Snapshots of the evolution of a purely toroidal magnetic field at four different times.The black lines are the magnetic lines of the poloidal field and color represents the toroidal field.

Figure 4 .
Figure 4. Instances of the evolution of the magnetic field of the mix initial configuration.The black lines are the magnetic lines of the poloidal field and color represents the toroidal field function .

Figure 5 .
Figure 5. Snapshots of the evolution of the magnetic field starting form a "twisted torus" configuration.The black lines are the magnetic lines of the poloidal field and color represents the toroidal field function .

Figure 6 .
Figure6.The energy evolution of the cases studied.On the upper row, the energy evolution of the purely poloidal initial field, left and for the purely toroidal initial field configuration right.At the bottom row the energy of the mixed field with similar energies in toroidal and poloidal component, left and the for the configuration where the low energy toroidal field is initially confined in the region of closed poloidal field lines, right.We plot with solid line the total energy in the magnetic field, with dashed line the energy in the poloidal field and with dash-dotted line the energy in the toroidal field.

Figure 7 .
Figure7.The energy loss rate of the magnetic field for the case of the initially mixed field configuration (solid) and the cases of a purely toroidal field (dashed lines).We have plotted the energy loss rate of an initial purely toroidal field with initial total energy equal only to the energy of the toroidal component of the mixed field case (dashed line) and with dash-dotted line the energy loss rate of an initial purely toroidal field with initial energy equal to the total energy of the mixed field case.The black points are the X-ray luminosities observed from Magnetars of the McGill Catalog.

Figure 8 .
Figure 8.The velocity of ambipolar diffusion in the case of the purely poloidal initial magnetic field at the  = 0.2  .The arrows indicate the direction of the velocity on a meridional plane while the color is the log |  |.