Introduction

Spin-tronic devices are versatile candidates for a variety of applications including sensors1,2, storage devices3, and frequency generators4,5. Different quantum mechanical mechanisms contribute to the coupling of the electrical current to the magnetization. Simulations of spintronic systems usually apply the micromagnetic model extended by simplified coupling terms such as the model by Slonczeswki6 and the model by Zhang and Li7. In ref. 8 it was shown that a simplified spin diffusion model incorporates these models. In all these approaches, the effects of the magnetic state of the system on the electronic transport are neglected. Indeed, the electric current density is assumed to be fixed, so that the models can be only used to investigate how the electronic transport affects the magnetization dynamics, but not vice versa. In this work, we present a three-dimensional finite-element method for the solution of the full spin diffusion model from ref. 9 which includes a bidirectional coupling of the magnetization to the electric current. In ref. 10 the model from ref. 9 is applied to a single phase magnetic nanostructure in order to predict domain wall motion. In this work we extend this model to composite structures consisting of magnetic and nonmagnetic materials which enables us to compute the magnetization-dependent resistivity caused by the GMR effect.

The Model

According to the micromagnetic model, the magnetization dynamics in a three-dimensional magnetic domain ω is described by the Landau-Lifshitz-Gilbert equation (LLG)

$$\frac{\partial {\boldsymbol{m}}}{\partial t}=-\gamma {\boldsymbol{m}}\times ({{\boldsymbol{h}}}_{{\rm{eff}}}+\frac{J}{\hslash \gamma {M}_{{\rm{s}}}}{\boldsymbol{s}})+\alpha {\boldsymbol{m}}\times \frac{\partial {\boldsymbol{m}}}{\partial t}\quad {\rm{in}}\quad \omega ,$$
(1)

where m is the normalized magnetization, γ is the gyromagnetic ratio, α is the Gilbert damping, and h eff is the effective field that usually contains the demagnetization field, the exchange field, as well as other contributions depending on the problem setting. The effective field is complemented by a contribution from the spin accumulation s with J being the exchange strength between itinerant and localized spins, ħ being the reduced Planck constant, and M s being the saturation magnetization. The spin accumulation itself is defined in the conducting region Ω and satisfies the equation of motion

$$\frac{\partial {\boldsymbol{s}}}{\partial t}=-{\boldsymbol{\nabla }}\cdot {{\boldsymbol{j}}}_{{\rm{s}}}-\frac{{\boldsymbol{s}}}{{\tau }_{{\rm{sf}}}}-J\frac{{\boldsymbol{s}}\times {\boldsymbol{m}}}{\hslash }\quad {\rm{in}}\quad {\rm{\Omega }},$$
(2)

where τ sf is the spin-flip relaxation time, and j s is the matrix-valued spin current. According to refs 9 and 11, the spin current j s and the electric current j e are defined by

$${{\boldsymbol{j}}}_{{\rm{e}}}=2{C}_{0}{\boldsymbol{E}}-2\beta ^{\prime} {D}_{0}\frac{e}{{\mu }_{{\rm{B}}}}{({\boldsymbol{\nabla }}{\boldsymbol{s}})}^{T}{\boldsymbol{m}},$$
(3)
$${{\boldsymbol{j}}}_{{\rm{s}}}=2\beta {C}_{0}\frac{{\mu }_{{\rm{B}}}}{e}{\boldsymbol{m}}\otimes {\boldsymbol{E}}-2{D}_{0}{\boldsymbol{\nabla }}{s},$$
(4)

where E is the electric field, D 0 is a diffusion constant, C 0 is related to electric resistivity ρ by C 0 = 1/2ρ, and β and β′ are dimensionless polarization parameters. Solving (3) for E and inserting this into (4) yields

$${{\boldsymbol{j}}}_{{\rm{s}}}=\beta \frac{{\mu }_{{\rm{B}}}}{e}{\boldsymbol{m}}\otimes {{\boldsymbol{j}}}_{{\rm{e}}}-2{D}_{0}[{\boldsymbol{\nabla }}{\boldsymbol{s}}-\beta \beta ^{\prime} {\boldsymbol{m}}\otimes ({({\boldsymbol{\nabla }}{\boldsymbol{s}})}^{T}{\boldsymbol{m}})],$$
(5)

which, combined with (2), gives the simplified diffusion model with prescribed electric current j e used in refs 8,12 and 13.

However, instead of prescribing the electric current, it is possible to solve the coupled system (3) and (4). For this purpose, we consider the following simplifications: As proposed in ref. 13, we assume the spin accumulation to be in equilibrium at all times, i.e.,

$$\frac{\partial {\boldsymbol{s}}}{\partial t}=0.$$
(6)

This simplification is justified by the fact that the characteristic time scale of the spin accumulation dynamics is two orders of magnitude smaller than that of the magnetization dynamics. This was predicted theoretically in ref. 7 and shown by time resolved solution of (2) for typical material parameters in ref. 8. Since sample sizes are usually very small, eddy currents can be neglected14. Therefore, the electric field is curl free and thus given as the gradient of a scalar potential

$${\boldsymbol{E}}=-{\boldsymbol{\nabla }}u.$$
(7)

Moreover, it is assumed that the conducting region Ω, that is considered for the solution of the system (3) and (4), does not contain any sources of electric currents, i.e.,

$${\boldsymbol{\nabla }}\cdot {{\boldsymbol{j}}}_{{\rm{e}}}=0.$$
(8)

Inserting these assumptions into (2)–(4) yields the overall system

$$-\,2{\boldsymbol{\nabla }}\cdot [{C}_{0}{\boldsymbol{\nabla }}u+\beta ^{\prime} {D}_{0}\frac{e}{{\mu }_{{\rm{B}}}}{({\boldsymbol{\nabla }}{\boldsymbol{s}})}^{T}{\boldsymbol{m}}]=0,$$
(9)
$${\boldsymbol{\nabla }}\cdot [2\beta {C}_{0}\frac{{\mu }_{{\rm{B}}}}{e}{\boldsymbol{m}}\otimes {\boldsymbol{\nabla }}u+2{D}_{0}{\boldsymbol{\nabla }}{\boldsymbol{s}}]-\frac{{\boldsymbol{s}}}{{\tau }_{{\rm{sf}}}}-J\frac{{\boldsymbol{s}}\times {\boldsymbol{m}}}{\hslash }=0,$$
(10)

that determines the electric potential u and the spin accumulation s.

A number of boundary conditions are required in order to close the LLG (1) coupled to the spin-diffusion system for the magnetization m(t). The LLG itself is an initial value problem and requires the initial magnetization

$${\boldsymbol{m}}({t}_{0})={{\boldsymbol{m}}}_{0}.$$
(11)

If the exchange field h exchange = 2A/(μ 0 M sm, with the exchange constant A and the saturation magnetization M s, is included in the list of effective field contributions, an additional boundary condition for the magnetization is required. If the domain ω for the solution of the LLG coincides with the magnetic region, it was shown in ref. 15 that homogeneous Neumann boundary conditions are the right choice in a physical sense

$$\frac{\partial {\boldsymbol{m}}}{\partial {\boldsymbol{n}}}=0\quad {\rm{on}}\quad \partial \omega .$$
(12)

The system (9)–(10) introduces the need for further boundary conditions for the electric potential u and the spin accumulation s. A set of mixed boundary conditions is used to prescribe the electric potential and current inflow at the boundary of the conducting region ∂Ω. The Dirichlet condition is applied directly to the potential u

$$u={u}_{0}\quad {\rm{on}}\quad {{\rm{\Gamma }}}_{D}\subseteq \partial {\rm{\Omega }},$$
(13)

while the Neumann condition is applied to the electric current

$${{\boldsymbol{j}}}_{{\rm{e}}}\cdot {\boldsymbol{n}}=-2[{C}_{0}{\boldsymbol{\nabla }}u+\beta ^{\prime} {D}_{0}\frac{e}{{\mu }_{{\rm{B}}}}[{({\boldsymbol{\nabla }}{\boldsymbol{s}})}^{T}{\boldsymbol{m}}]]\cdot {\boldsymbol{n}}=g\quad {\rm{on}}\quad {{\rm{\Gamma }}}_{{\rm{N}}}=\partial {\rm{\Omega }}\backslash {{\rm{\Gamma }}}_{{\rm{D}}}.$$
(14)

A typical choice of these boundary conditions is depicted in Fig. 1(b). In an MRAM like structure, the top and bottom surfaces Γ1 and Γ2 are electric contacts. In order to prescribe the current flow through the sample, like it is usually done in experiments, one might set the potential to zero at one contact u = 0 on Γ1. On the other contact Γ2 a finite current inflow is prescribed j e · n = g. The rest of the sample boundary ∂Ω\(Γ1Γ2) is treated with homogeneous Neumann conditions j e · n = 0.

Figure 1
figure 1

Typical magnetic/nonmagnetic material stack as used for MRAM devices. (a) The region ω = ω 1ω 2 denotes the magnetic material, while Ω denotes the complete sample. (b) Electrical contacts \({{\rm{\Gamma }}}_{1}\) and \({{\rm{\Gamma }}}_{2}\).

The boundary conditions are completed with homogeneous Neumann conditions for the spin accumulation

$${\boldsymbol{\nabla }}{\boldsymbol{s}}\cdot {\boldsymbol{n}}=0\quad {\rm{on}}\quad \partial {\rm{\Omega }}.$$
(15)

This choice can be justified by considering the boundary flux of the spin current. Multiplying (5) with the boundary normal n and inserting the Neumann condition yields

$${{\boldsymbol{j}}}_{{\rm{s}}}\cdot {\boldsymbol{n}}=\beta \frac{{\mu }_{{\rm{B}}}}{e}{\boldsymbol{m}}(\,{{\boldsymbol{j}}}_{{\rm{e}}}\cdot {\boldsymbol{n}})-2{D}_{0}[{\boldsymbol{\nabla }}{\boldsymbol{s}}\cdot {\boldsymbol{n}}-\beta \beta ^{\prime} {\boldsymbol{m}}(({\boldsymbol{\nabla }}{\boldsymbol{s}}\cdot {\boldsymbol{n}})\cdot {\boldsymbol{m}})]$$
(16)
$$=\,\beta \frac{{\mu }_{{\rm{B}}}}{e}{\boldsymbol{m}}({{\boldsymbol{j}}}_{{\rm{e}}}\cdot {\boldsymbol{n}})$$
(17)

This expression is nonzero only at boundaries with both nonvanishing current in-/outflow and nonvanishing magnetization. Hence the homogeneous Neumann condition (15) is equivalent to the noflux condition j s · n = 0 for systems as depicted in Fig. 1, where the electric contacts are part of the nonmagnetic region. The noflux condition itself is a reasonable choice if the thickness of the electrodes is large against the diffusion length. In this case the spin accumulation and hence also the spin current is expected to be approximately zero at the contacts.

For systems where the magnetic region is contacted directly, the homogeneous Neumann condition leads to unphysical behaviour since the spin accumulation that is generated at the contact interface is neglected. This accumulation strongly depends on the material of the leads that is not known when directly contacting the magnet. However, the choice of homogeneous Neumann conditions leads to a good agreement with the predictions of the model by Zhang and Li7 that also neglects surface effects at the contacts.

Validation

The presented model is implemented within the finite-element code magnum.fe16. The discretization is explained in detail in Appendix A. For validation purposes, the standard problem #5 proposed by the μMAG group17 is computed with the self-consistent model and compared to results obtained with the model of Zhang and Li7 and the simplified diffusion model used in ref. 8. While this problem does not require particular features of the proposed self-consistent model, it serves as an excellent experiment for the validation of the proposed algorithm. The standard problem #5 describes the motion of a magnetic vortex in a thin square of size 100 nm × 100 nm × 10 nm under the influence of a DC current defined by β j e = (1012, 0, 0)A/m2. For our simulations we choose β = 1 and thus j e = (1012, 0, 0) A/m2. The material parameters are chosen similar to those of permalloy, namely M s  = 8 × 105 A/m, A = 1.3 × 10−11 J/m, and α = 0.1. In the original problem definition, it is proposed to apply the model of Zhang and Li that extends the LLG (1) by current dependent terms

$$\frac{\partial {\boldsymbol{m}}}{\partial t}=-\gamma {\boldsymbol{m}}\times {{\boldsymbol{h}}}_{{\rm{eff}}}+\alpha {\boldsymbol{m}}\times \frac{\partial {\boldsymbol{m}}}{\partial t}-b{\boldsymbol{m}}\times [{\boldsymbol{m}}\times ({{\boldsymbol{j}}}_{{\rm{e}}}\cdot {\boldsymbol{\nabla }}){\boldsymbol{m}}]-\xi b{\boldsymbol{m}}\times ({{\boldsymbol{j}}}_{{\rm{e}}}\cdot {\boldsymbol{\nabla }}){\boldsymbol{m}},$$
(18)

where b = 72.17 × 10−12 m3/(As) is a coupling constant and ξ = 0.05 the degree of nonadiabacity. As shown in ref. 8 an equivalent set of material parameters for the diffusion model can be obtained by perceiving the Zhang and Li model as diffusion model in the limit of vanishing diffusion. For the diffusion model we choose D 0 = 10−3 m2/s, β′ = 0.8, and τ sf = 5 × 10−14 s. The remaining constant J = 0.263 eV is then uniquely defined by the relations given in ref. 8. In order to solve this problem with the self-consistent model the additional conductivity constant C 0 = 1.2 × 106 A/(Vm) is introduced. Furthermore, instead of prescribing a constant current within the magnetic material, the current is applied in terms of boundary conditions. On the left side of the sample ΓN = {r|r x  = −50 nm} current inflow is set to j e · n=1012 A/m2 and on the right side of the sample ΓD = {r|r x  = 50 nm} the potential is set to 0. The remaining boundary is treated with homogeneous Neumann conditions in order to simulate current in- and outflow only through the contacts.

The results for the computation of standard problem #5 with the different methods are shown in Fig. 2. While the results for the averaged x-component of the magnetization are in very good agreement, the results for the y-component show a notable offset. The offset of the results of the Zhang and Li model to the remaining models is caused by the neglected diffusion. The offset of the self-consistent model to the simple diffusion model is caused by the inhomogeneous current distribution resulting from the self-consistent treatment.

Figure 2
figure 2

Results for the standard problem #5 for different micromagnetic models. Time evolution of the averaged magnetization components. (a) x-component (b) y-component.

Resistance of multilayer stack with perpendicular current

The key advantage of the presented method over the simplified diffusion model introduced in ref. 8 is the self-consistent treatment of the electric potential u. The potential is computed considering not only Ohm’s law j e = 2C 0 E but also magnetization dependent contributions. This dependence is exploited for instance in sensor applications1. Consider a magnetic multilayer stack as shown in Fig. 1 with two homogeneously magnetized layers ω 1 and ω 2 separated by a conducting layer. The resistivity of this structure heavily depends on the tilting angle θ of the magnetization in ω 1 and ω 2. Namely an antiparallel configuration is known to result in a high resistivity while a parallel configuration leads to a low resistivity. This effect is referred to as giant magnetoresistance (GMR). The anisotropic magnetoresistance (AMR), which describes the change of electrical resistance as a function of the angle between electric current and the magnetization, is not considered in the presented model. In order to calculate the electric resistivity with the diffusion model, the potential difference between the contacts Γ1 and Γ2 is computed for a given current inflow. Note, that due to the homogeneous magnetization configuration within the magnetic layers, the simulation is quasi one-dimensional and the results do not depend on the lateral dimension of the stack.

For numerical experiments two magnetic layers with 5 nm thickness separated by a conducting layer with 1.5 nm thickness are considered. The system is contacted with 100 nm thick leads in order to justify the homogeneous boundary conditions on the spin accumulation as described in the model section. The potential is set to u = 0 at the bottom contact Γ1 and the current inflow is set to j e · n = 1012 A/m2 on the top contact Γ2. Note that the cross section of the system does not have any influence on the potential computation as long as it is constant throughout the stack.

Figure 3 shows the computed potential difference for different tilting angles of the magnetization in the two layers ω 1 and ω 2. The material parameters in the magnetic regions are chosen similiar to those in the preceding section. In the conducting region Ω\ω, a different diffusion constant of D 0 = 5 × 10−3 m2/s and a conductivity of C 0 = 6.0−106 A/(Vm) is applied. Moreover, in Fig. 3(a), exchange strength J is varied in the whole stack Ω. In Fig. 3(b), the polarization parameter β′ is varied. The resulting potential is compared to a sine parameterization a + b sin2 (θ/2) that is often used to describe the GMR effect in such a stack18 in the presence of some in-plane current. The presented simulations, however, suggest that the potential and thus the resistivity of the stack in the presence of out-of-plane currents is not well described by a sine, but has a much narrower peak for certain choices of material parameters. Specifically the sine approximation is accurate only in the case of small β′ and J as shown in Fig. 4(a), where the parameters are chosen as β′ = 0.1 and J = 0.013 eV.

Figure 3
figure 3

Potential difference Δu between top and bottom contact required to generate an average current density of j e = 1012 A/m2 depending on the tilting angle of the magnetization in the free and fixed layer of a magnetic multilayer structure. (a) Variation of J for β′ = 0.8 (b) variation of β′ for J = 0.263 eV. The results are renormalized in order to facilitate the comparison to the sine parameterization.

Figure 4
figure 4

Potential difference Δu between top and bottom contact required to generate an average current density of j e = 1012 A/m2 depending on the tilting angle of the magnetization in the free and fixed layer of a magnetic multilayer structure along with fits to different models for (a) J = 0.013 eV and β′ = 0.1 (b) J = 0.082 eV and β′ = 0.8.

The deviation of the angular dependence of the resistivity from the sine approximation for some out-of-plane current was already observed in experiment19. The authors of this work suggest to include a higher order sine term in order to fit the resistivity curve. Figure 4(b) shows the result of the fit with a + b sin2 (θ/2) + c sin4 (θ/2) for J = 0.082 eV and β′ = 0.8 which shows a good agreement with the simulated curve. A similar effect is also predicted in ref. 6, where the authors suggest the following expression for the angular dependence of the resistivity

$$R=\frac{1-{\cos }^{2}(\theta \mathrm{/2)}}{1+\chi {\cos }^{2}(\theta \mathrm{/2)}}\mathrm{.}$$
(19)

The parameter χ depends on geometry and material of the involved layers and leads to a steeper peek if positive, which, according to the reference, is the case for all investigated systems up to then. Using χ as a fitting parameter, the results for J = 0.082 eV and β′ = 0.8 can be described with very high precision, see Fig. 4(b).

The same effect was also predicted theoretically in ref. 20 with a model of Valet and Fert21 and in ref. 22 with a two-dimensional diffusion model. However, these papers do not discuss the influence of material parameters onto the narrowing of the sine response in detail.

In the context of the diffusion model, the deviation from the simple sine approximation sin2(θ/2) has its origin in two different effects. First, the cross product term Js × m/ħ in (10) describes the torque that is exerted from the magnetization on the spin polarization of the itinerant electrons. This torque is zero for parallel and antiparallel alignment of the magnetic layers and reduces the angle of the polarization of the itinerant electrons to the magnetization for any other alignment. Hence, for large J this contribution leads to a lowered resistance for all alignments other than parallel and antiparallel, which results in the narrow peak observed in the simulation.

The second effect is a bit more subtle. For vanishing β′ the potential u from (9) varies linearly. Small values of β′ lead to small perturbations of this linear solution. While these perturbations have a clear effect on the overall potential difference, their effect on the spin accumulation s due to (10) is negligible, leading to a clean sinusoidal response of the system as shown in Fig. 4(a). With increasing β′ the perturbations of u gain influence on the solution of s which results in a distorsion of the sinusoidal response as seen in Figs 3 and 4.

Conclusion

We propose a three-dimensional spin-diffusion model that simultaneously solves for the spin accumulation s and the electric potential u. By coupling this model to the Landau-Lifshitz-Gilbert equation, we are able to self-consistently solve the magnetization dynamics for a given current inflow. In order to validate the model and its implementation, we simulate the standard problem #5 proposed by the μMAG group and compare the outcome to results obtained with simplified models.

In a second numerical experiment, we compute the resistivity of a magnetic multilayer structure in dependence on the tilting angle of the magnetization in the two magnetic layers. In the limit of small polarization parameter β′ and a small exchange strength J, we show that the resistivity is well approximated by a sine. For realistic choices of β′ and J the angular dependence shows a significantly narrower peak than the simple sine approximation. While existing models already predict the observed behaviour in a macro spin approach, the presented model is able to accurately describe GMR effects for both dynamically and spatially varying magnetization configurations.

While the examples in this work consider either spin-torque effects or magnetoresistance, we want to stress that the presented model is also capable of simulating the interplay of the two effects. This interplay is for instance crucial for the description of spin-torque induced noise in GMR sensors that was found to be a significant contribution to the overall noise23.

A Discretization

We solve the coupled equations (1) and (9)–(10) numerically by employing the finite-element method for spatial discretization and a preconditioned BDF scheme as described in ref. 24 for the time integration that is applied nodewise. The BDF scheme is an implicit method and hence well suited for the solution of stiff problems. This stiffness of micromagnetic problems usually originates from the exchange interaction and the additional solution of the diffusion equation does not influence the stiffness noticeably. Typical time steps for this method are 10−13 s to 10−12 s. The demagnetization field is solved by a hybrid FEM–BEM method as introduced in ref. 25.

For the discretization of (9) and (10) special care has to be taken in the treatment of the discontinuities, e.g., in the magnetization m introduced by magnetic–nonmagnetic interfaces. As usual the original problem is multiplied with test functions and integration by parts is applied to avoid second derivatives. Furthermore, first derivatives of the magnetization m are eliminated in the same way and the integration domain for terms including the magnetization is restricted to the magnetized region ω. This way, the proposed algorithm naturally accounts for the magnetization jumps at the magnetic–nonmagnetic interfaces without the need of discontinuous function spaces for the discretization of m.

The solution variables m, u and s as well as the test functions v and ζ are discretized by (componentwise) piecewise affine, globally continuous functions constructed on a tetrahedral mesh. The material parameters β, β′, C 0, D 0, τ sf, and J are discretized with piecewise constant functions. For a given magnetization m, the weak version of (9) reads

$${\int }_{{\rm{\Omega }}}2{C}_{0}{\boldsymbol{\nabla }}u\cdot {\boldsymbol{\nabla }}v\,{\rm{d}}{\boldsymbol{x}}+{\int }_{\omega }2\beta ^{\prime} {D}_{0}\frac{e}{{\mu }_{{\rm{B}}}}{({\boldsymbol{\nabla }}{\boldsymbol{s}})}^{T}{\boldsymbol{m}}\cdot {\boldsymbol{\nabla }}v\,{\rm{d}}{\boldsymbol{x}}=-{\int }_{{{\rm{\Gamma }}}_{{\rm{N}}}}gv\,{\rm{d}}{\boldsymbol{s}},$$
(20)

where the current in-/outflow is given by g as Neumann condition. The additional Dirichlet boundary conditions on ΓD are embedded in the function space of the solution u as usual when employing the finite-element method. The weak version of (10) reads

$$-{\int }_{\omega }2\beta {C}_{0}\frac{{\mu }_{{\rm{B}}}}{e}{\boldsymbol{m}}\otimes {\boldsymbol{\nabla }}u\,:\,{\boldsymbol{\nabla }}{\boldsymbol{\zeta }}\,{\rm{d}}{\boldsymbol{x}}+{\int }_{\partial \omega \cap {{\rm{\Gamma }}}_{{\rm{D}}}}2\beta {C}_{0}\frac{{\mu }_{{\rm{B}}}}{e}({\boldsymbol{\nabla }}u\cdot {\boldsymbol{n}})({\boldsymbol{m}}\cdot {\boldsymbol{\zeta }})\,{\rm{d}}{\boldsymbol{s}}\\ \quad -{\int }_{{\rm{\Omega }}}2{D}_{0}{\boldsymbol{\nabla }}{\boldsymbol{s}}\,:\,{\boldsymbol{\nabla }}{\boldsymbol{\zeta }}\,{\rm{d}}{\boldsymbol{x}}-{\int }_{{\rm{\Omega }}}\frac{{\boldsymbol{s}}\cdot {\boldsymbol{\zeta }}}{{\tau }_{{\rm{sf}}}}\,{\rm{d}}{\boldsymbol{x}}-{\int }_{\omega }J\frac{({\boldsymbol{s}}\times {\boldsymbol{m}})\cdot {\boldsymbol{\zeta }}}{\hslash }\,{\rm{d}}{\boldsymbol{x}}\\ \quad \quad ={\int }_{\partial \omega \cap {{\rm{\Gamma }}}_{{\rm{N}}}}\beta \frac{{\mu }_{{\rm{B}}}}{e}g({\boldsymbol{m}}\cdot {\boldsymbol{\zeta }})\,{\rm{d}}{\boldsymbol{s}}\mathrm{.}$$
(21)