TVE-F 17 005 maj Examensarbete 15 hp Juni 2017 A Comparison of Three Time-stepping Methods for the LLG Equation in Dynamic Micromagnetics Anton Kroner Tomas Berg Simon Wredh Abstract A Comparison of Three Time-stepping Methods for the LLG Equation in Dynamic Micromagnetics Anton Kroner & Tomas Berg & Simon Wredh Teknisk- naturvetenskaplig fakultet UTH-enheten Besöksadress: Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0 Postadress: Box 536 751 21 Uppsala Telefon: 018 – 471 30 03 Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student Micromagnetism is the study of magnetic materials on the microscopic length scale (of nano to micrometers), this scale does not take quantum mechanical effects into account, but is small enough to neglect certain macroscopic effects of magnetism in a material. The Landau-Lifshitz-Gilbert (LLG) equation is used within micromagnetism to determine the time evolution of the magnetisation vector field in a ferromagnetic solid. It is a partial differential equation with high non linearity, which makes it very difficult to solve analytically. Thus numerical methods have been developed for approximating the solution using computers. In this report we compare the performance of three different numerical methods for the LLG equation, the implicit midpoint method (IMP), the midpoint with extrapolation method (MPE), and the Gauss-Seidel Projection method (GSPM). It was found that all methods have convergence rates as expected; second order for IMP and MPE, and first order for GSPM. Energy conserving properties of the schemes were analysed and neither MPE or GSPM conserve energy. The computational time required for each method was determined to be very large for the IMP method in comparison to the other two. Suggestions for different areas of use for each method are provided. Handledare: Doghonay Arjmand & Gunilla Kreiss Ämnesgranskare: Christian Strietzel Examinator: Martin Sjödin ISSN: 1401-5757, TVE-F 17 005 maj Populärvetenskaplig sammanfattning Mikromagnetism är ett område som studerar magnetism på mikroskopiska (dock ej kvantmekaniska) längdskalor. Området är av intresse bland annat inom hårddiskindustrin, där magnetiska material används för att lagra information. Inom mikromagnetism finns Landau-Lifshitz-Gilberts (LLG) ekvation. Lösningar till denna beskriver hur magnetiseringen förändras inom ett material över tid. LLGekvationen är en partiell differentialekvation med variabler i rum och tid, vilket innebär att lösningen är en funktion som beror på position och tidpunkt. Ekvationen har en komplicerad struktur och att hitta exakta lösningar är inte lätt. Följdaktligen använder man numeriska metoder och datorer för att beräkna ett närmevärde till lösningen. Det finns ett antal olika metoder som är anpassade för LLG-ekvationen och syftet med det här projektet är att jämföra egenskaper för tre av dessa: implicita mittpunktsmetoden (IMP), den extrapolerade mittpunktsmetoden (MPE), samt GaussSiedel projektionsmetoden (GSPM). Det upptäcktes att alla metoder uppfyllde sina förväntade noggranhetsordningar, andra ordningen för IMP och MPE, samt första ordningen för GSPM. Energibevaringsförmågan undersöktes och varken GSPM eller MPE klarade av att beräkna energin korrekt. Beräkningstiden som krävdes för IMP bestämmdes till att vara mycket högre än för de andra två metoderna. GSPM är lämpig för snabba och onoggranna simuleringar. MPE bör användas för beräkningar som inte kräver exakt energibevaring och som uppfyller dess stabilitetsvillkor. IMP ger mest korrekta lösningar oavsett diskretisering men är relativt långsam. Contents 1 Introduction 1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Simplifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 2 Theory 2.1 The LLG equation . . . . . . . . . . . . . . 2.2 Energy . . . . . . . . . . . . . . . . . . . . . 2.3 Numerical properties . . . . . . . . . . . . . 2.4 Numerical methods . . . . . . . . . . . . . . 2.4.1 Implicit midpoint method . . . . . . 2.4.2 Midpoint with explicit extrapolation 2.4.3 Gauss-Seidel projection . . . . . . . . . . . . . . . 2 2 3 4 4 4 8 9 3 Method of comparison 3.1 Physical requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Numerical viability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 11 11 4 Results 4.1 Magnitude conservation 4.2 Energy conservation . . 4.3 Stability analysis . . . . 4.4 Convergence studies . . 4.5 Computation time . . . . . . . . 12 13 13 15 17 18 5 Discussion 5.1 Conservative properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Numerical performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 18 18 6 Conclusion 19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Introduction Background Magnetism in a material arises from the electron spin and orbital angular momentum in the atoms of which the material consists of. However, on larger scales, it is possible to analyse magnetism without taking these quantum mechanical effects into account. The field of micromagnetics studies magnetism at the microscopic size scale of nano to micrometers, and has been of interest since the advent of modern computers. In the year 1960, the field had developed enough to be useful in the development of the magnetic hard drive [1]. A commonly used mathematical model in micromagnetics is the LLG equation. It was introduced by Landau and Lifshitz in 1935 and later modified by Thomas Gilbert. The equation is a vectorial partial differential equation (PDE) and is used to describe the precessional motion of magnetisation in solids, as seen in figure 1. Analytical solutions can only be found in special cases and consequently numerical schemes have been developed to reliably solve the equation using computers. [1] 1.2 Purpose The purpose of this project it to implement three different time stepping methods for the LLG equation and numerically compare their properties. A classical implicit midpoint method, known to be a good performer albeit slow is to be put up against two presumably faster methods: A mid point method with explicit extrapolation and a projection based scheme implemented with a Gauss-Seidel correction. Most importantly the magnitude of the solution vector has to be conserved for every time step. Furthermore energy conservation is to be studied together with numerical stability, convergence rates and computation time. These properties are to be weighed against each other to draw conclusions about efficiency. The methods are to be implemented and tested with Matlab. 1.3 Simplifications Due to the complexity of the equation we have limited ourself to a 1-dimensional setting, whereas in general the problem is formulated over bounded domains in R3 . The LL equation, see equation (2.2), includes parameters, which are assumed equal to 1 in all the simulations here. Moreover, due to the nature of the LL equation, the length of the magnetisation m remains constant for all the time. Without loss of generality, the magnitude is also assumed to be 1. As the interest of this project is the time stepping, we have as much as possible kept to a constant space discretisation of 100 grid points on the interval [0,100]. 1 2 2.1 Theory The LLG equation The Landau-Lifshitz-Gilbert-equation is used to determine the time-evolution of the magnetisation field in a ferromagnetic material (for a derivation see: [2]). To simplify equations this paper will only consider its normalised form which can be written as ∂m ∂m = − m × hef f − am × , (2.1) ∂t ∂t where m(x, t) is the normalised magnetisation vector field of the ferromagnetic material, hef f is an effective magnetisation field and a is a damping constant. The equation can also be written on the equivalent [3] Landau-Lifshitz (LL) form ∂m = −βm × hef f − αm × (m × hef f ), ∂t (2.2) which is explicit with respect to the time derivative of the magnetisation field. In this formulation β is a gyromagnetic constant and α is a damping constant. The LL version is suitable for explicit numerical schemes whereas the LLG variant can be beneficial for implicit schemes [4]. The effective magnetisation field is given by hef f = 2A ∇2 m + hani + hext + hd , 2 µ0 Ms (2.3) where A is an exchange constant, µ0 is the permeability and Ms is the magnitude of the unnormalised magnetisation field. hani is the anisotropic magnetisation field, hext is the external magnetisation field and hd is the demagnetisation field. To calculate hd we would need to couple the LLG equation with one of Maxwell’s equations, however in this study we only want to study methods for the LLG equation so the demagnetisation field has been set to zero. This study is limited to one space dimension which reduces the laplacian to a single second order derivative. If we have uniaxial anisotropy, along a unit vector, p, we can write the anisotropy field as [5] hani = hm, pip (2.4) and as the external field is any known applied field, we can write the effective field as hef f = B ∂ 2m + hm, pip + hext . ∂x2 (2.5) By taking the inner-product of equation (1.2) with m it is easy to see that |m(t, x)| = |m(0, x)| for all x. Moreover, it is assumed that |m(0, x)| = 1. This is because the magnitude of the magnetisation must be equal to the magnetisation saturation of the material [6]. Figure 1 shows the precessional motion of a single magnetisation vector under the effect of an effective h-field. 2 z b a Heff y m x Figure 1: The path of the magnetisation vector, m, as it precesses around the effective H field, where a and b are the first and second terms in the LLG equation, respectively [4]. 2.2 Energy Magnetic materials exhibit very complex behaviour due to the competition between different energy terms. There are several contributions describing different phenomena that add up to a total free energy [4]. In this report we are considering three of these contributions. The exchange energy is given by Z 1 Jexc |∇m|2 , (2.6) Eexc = 2 where Jexc is a material constant. The anisotropy energy is given by Eani 1 =− 2 Z Kani hm, pi2 , (2.7) where Kani is a material constant and p is the direction of an easy axis in a uniaxial material. The applied field energy is given by Z Eext = − µ0 hhext , mi, (2.8) where hext is an externally applied field. Important to note is that when the damping term vanishes the LL equation (2.2) conserves energy [4]. This conservative property is typically sought after when designing a numerical method for approximating the solution. With N space steps the total continuous energy can be discretised as follows: [7] N N N X 1X 1X E=− Jexc (mk · mk−1 + mk · mk+1 ) − Kani (mk · p)2 − µ0 hext · mk (2.9) 2 k 2 k k 3 2.3 Numerical properties In numerical analysis there are certain core properties that play vital roles for the viability of a method. First of all, an explicit method calculates the solution using only current and previous time states. Comparatively a method of implicit nature expresses the solution at the upcoming time state in terms of the solution itself. Consequently an equation needs to be solved for every time step when using an implicit scheme. The notion of stability, in general, is used to describe the sensitivity of the solution when the data in a given model problem are perturbed slightly. A necessary condition for the convergence of a numerical solution towards the exact solution is the stability of the numerical method, which may be fulfilled under some constraints on the discretisation parameters, as is the case for most explicit methods. Nevertheless, there are methods (implicit methods) which are unconditionally stable. Naturally, for a conditionally stable scheme to be usable at all the discretisation constraint has to be fulfilled. To determine how accurate the solution of a method is one can analyse the order of convergence/accuracy. This is a number p that gives information about how the error relates to a discretisation ∆t as shown in equation (2.10). ∝ ∆tp (2.10) Different methods use different algorithms that require certain amount of computing power. For large problems or small discretisation parameters the computational time can increase to unfeasible scales. Although dependent on hardware and code optimisations, a comparison can be achieved by simply timing the execution time. 2.4 Numerical methods The nonlinearity of the LL and the LLG equations makes it very difficult to determine a solution analytically, this results in the use of numerical methods to reliably solve the equations. The part that gives rise to interesting problems is the time discretisation and there are different numerical methods that can be used to solve the equations, with their own strengths and weaknesses. This report will focus on analysing the properties of three specific methods. 2.4.1 Implicit midpoint method Finite difference methods work by replacing the derivatives with finite differences that approximate the derivative at a discrete point, y n+1 − y n dy(tn+1 ) ≈ dt ∆t (2.11) where n denotes the time step and y n is an approximation to the solution at y(tn ). The differential equation then reduces to a series of simple algebraic equations that can be solved by ”stepping” as long as y 0 is known. The popular Crank-Nicolson method uses an average of the Euler forward and Euler backward methods to achieve second order accuracy. It may also be referred to as the 4 implicit midpoint (IMP) scheme and can be written on the form 1 y n+1 − y n = f (tn+ 1 , y n+ 2 ), 2 ∆t (2.12) where 1 1 (2.13) y n+ 2 = (y n+1 + y n ). 2 Implicit means that unlike equation (2.11), it can not be directly solved because y n+1 depends on itself. However, methods for solving non linear algebraic equations have been known for a long time, and the Newton-Rhapson method is commonly applied for solving problems of this type. Say we have some function g(x), the Newton-Rhapson method can is used to approximate a root, x ,that solves this equation by iteration given a starting ”guess” x0 g(xi ) xi+1 = xi − 0 (2.14) g (xi ) where g 0 (x) is the derivative of g(x). The stopping criterion for the algorithm is kxi+1 − xi k < tol for a given value of tol. We can apply equation (2.14) to solve (2.12) by rearranging it and giving it a new name, G(y n+1 ), we would then iterate the solution y n+1 in each time step, and use y0n+1 = y n , the solution in the previous time step, as a starting guess. Even though the LL equation is a vector PDE, the method works exactly the same. We discretise in time by replacing the time derivative in equation (2.2) with a finite difference mn+1 − mn ∂m(tn ) ≈ (2.15) ∂t ∆t and using the midpoint average, equation (2.13), on the right hand side we get 1 1 1 mn+1 − mn = −βmn+ 2 × hef f − γmn+ 2 × (mn+ 2 × hef f ). ∆t (2.16) Now define G(mn+1 ) by rearranging equation (2.16) into G(mn+1 ) = 1 1 1 mn+1 − mn + βmn+ 2 × hef f + γmn+ 2 × (mn+ 2 × hef f ). ∆t (2.17) Now we want to use Newton-Rhapsons method to solve for mn+1 , however, both G and mn+1 are vectors. Equation (2.14) can be expanded into solving systems of equations by replacing the scalar quantities by their respective vector equivalents. The derivative in equation (2.14) is replaced by the Jacobian matrix of G, J, which gives us n+1 mn+1 − J−1 G(mn+1 ) i+1 = mi i (2.18) where as before we use mn+1 = mn . Notice that at this point, it is important to not 0 confuse the Newton-Rhapson iteration index, i, with the time stepping index, n. The n+1 time stepping index increases only when the kmn+1 k < tol condition is met, and i+1 − mi n+1 mi ”becomes” the solution for that time step after a series of iterations of over i. That value is then used as an initial guess for calculating the solution at the next time step. 5 To calculate hef f we must now choose a discretisation in space. Even a one-dimensional domain has three components of the vector m at each point in space, so it is useful to represent the magnetization field by a N × 3 matrix, where N is the number of discrete space points, and the columns contain the components of the vector at each point in space. mx0 my0 m z0 mx my1 m z1 1 mx m m y2 z2 2 m = .. .. .. . . . mxN −1 myN −1 mzN −1 mxN myN mzN Figure 2: Space discretisation matrix, where mx,y,z denotes a component of m We replace the derivative in equation (2.5) by a finite difference approximation mk−1 − 2mk + mk+1 ∂ 2 m(xk ) ≈ 2 ∂x ∆x2 (2.19) where k ∈ {0, 1, 2, . . . , N } denotes a point in space. By expanding equation (2.19) into the component form 2 ∂ mx (xk ) 2 ∂x mxk−1 − 2mxk + mxk+1 1 ∂ 2 my (xk ) myk−1 − 2myk + myk+1 (2.20) ∂x2 ≈ ∆x2 m − 2m + m zk−1 zk zk+1 ∂ 2 mz (xk ) ∂x2 we can see that this discrete derivative can be represented by a multiplication of each column of the space discretisation matrix, m, by a matrix −2 1 1 −2 1 1 .. . 1 −2 A= (2.21) 2 ∆x . . .. .. 1 1 −2 N ×N containing the coefficients of the finite difference approximation. This leads to ∂ 2m ≈ Am ∂x2 (2.22) which is the second order space derivative. However, equation (2.22) is not complete without providing boundary conditions. One type of boundary conditions are the periodic 6 boundary conditions, which means that we imagine the domain as a circle. To implement this, we modify A to contain two additional non zero elements in the corners −2 1 1 1 −2 1 1 .. . 1 −2 A= (2.23) 2 ∆x .. .. . . 1 1 1 −2 N ×N which will make it so that mx,y,zN +1 = mx,y,z0 and mx,y,z−1 = mx,y,zN , completing equation (2.22). We can now define a discrete version of the effective field, hef f , from equation (2.5). In place of the derivative we use equation (2.22) and the other terms follow from their discrete counterparts and we can write hef f = BAm + hm, pip + hext (2.24) where p, hext and hef f have been extended to be matrices that contain their respective vector components at a point n at each row, analogous to m (see: figure 2.4.1). The inner product is taken at each individual row of m and p to return a scalar that scales each row of p. Finally, we can combine both the time and space discretisations. We extend equation (2.17) by replacing each m with m and hef f by hef f 1 1 1 mn+1 − mn + βmn+ 2 × hef f + γmn+ 2 × (mn+ 2 × hef f ) ∆t where G has been extended to a matrix, as before. And G(mn+1 ) = 1 1 hef f = BAmn+ 2 + hmn+ 2 , pip + hext (2.25) (2.26) uses the midpoint average 1 1 mn+ 2 = (mn+1 + mn ) (2.27) 2 from equation (2.13) just like previously. G is now three systems of N equations, but equation (2.18) still applies, except that for each iteration we have to compute a Jacobian for each column of G, multiply them together separately, and finally put them back into a matrix together. We write this as n+1 n+1 n+1 n+1 ) J−1 ) J−1 ) (2.28) mn+1 − J−1 y Gy (mi z Gz (mi x Gx (mi i+1 = mi where, just as before, we use mn+1 = mn as an initial value, Jx,y,z are the Jacobians 0 of Gx,y,z , which are the columns of G, and i is the iteration index that runs until the n+1 tolerance kmn+1 k < tol is fulfilled. i+1 − mi The Jacobians in each iteration are calculated by a central finite difference Gkx (mkx + d2 , mky , mkz ) − Gkx (mkx − d2 , mky , mkz ) = d k d k k k Gy (mx , my + 2 , mz ) − Gky (mkx , mky − d2 , mkz ) k Jy = d k d k k k Gz (mx , my , mz + 2 ) − Gkz (mkx , mky , mkz − d2 ) k Jz = d Jkx 7 (2.29) where k runs over every row of the spatial discretisation matrix, and d is a small number (≈ 10−6 ) used to compute the finite difference. 2.4.2 Midpoint with explicit extrapolation The midpoint with explicit extrapolation (MPE) uses, just like Runge-Kutta methods for ordinary differential equations, a weighted average of several different time-steps when calculating the next time-step [4]. If one considers the LL equation (2.2), we see that it can be written on the following form ∂m = −γm × H, (2.30) ∂t where H = hef f + αm × hef f , (2.31) where α is a damping constant. We can see in equation 2.30 that m · ∂m = 0 and as a ∂t consequence that kmk = const [8]. To create a numerical method we introduce the following midpoint approximation dm dt n+ 21 = mn+1 − mn + O(∆t2 ), ∆t (2.32) mn+1 + mn + O(∆t2 ), (2.33) 2 where the subscript n indicates the time-step. The O(∆t2 ) is used to denote the order of accuracy in the time region, this being a order of accuracy of 2. To derive a numerical method we also need to express H in the midpoint, we can do this by extrapolating H as follows 1 mn+ 2 = 1 1 Hn+ 2 = hn+ 2 + O(∆t2 ), (2.34) where 1 1 3 (2.35) hn+ 2 = Hn + Hn−1 . 2 2 We can now substitute equations 2.32, 2.33 and 2.34 into the LL equation 2.30. This gives us the following expression mn+1 − mn = 1 γ∆t n+1 (m + mn ) × hn+ 2 , 2 (2.36) which can be expressed as mn+1 + 1 1 γ∆t n+1 γ∆t n m × hn+ 2 = mn − m × hn+ 2 . 2 2 8 (2.37) This gives rise to a system of equations that can be expressed as a product of matrices 1 1 γ∆t n+ 2 γ∆t n+ 2 n+1 h h 1 − z y mx 2 2 1 γ∆t n+ 2 mn+1 − γ∆t hn+ 21 1 hx y 2 z1 2 1 mn+1 γ∆t n+ 2 γ∆t n+ 2 z hy − 2 hx 1 2 1 1 γ∆t n n+ 2 n n+ 2 n m − 2 (my hz − mz hy ) x 1 1 2 , = mny − γ∆t (mnz hxn+ 2 − mnx hn+ ) z mnz − 2 1 γ∆t n n+ 2 (m h y x 2 n+ 12 − mny hx ) where the subscripts x,y and z represents the components of the corresponding vectors. Now that we have a numerical method for temporal discretisation we can take a look at the spatial discretisation. The spatial discretisation lies in the effective field hef f or ∇2 m. To descretizise this we use a second order more precisely the exchange field µ02A Ms2 finite difference scheme with an order of accuracy of 2: ∇2 m = ∂ 2m mk+1 − 2mk + mk−1 = + O(∆x2 ). 2 2 ∂x ∆x (2.38) This is then simply substituted into the effective field and solved for every k 2.4.3 Gauss-Seidel projection The Gauss-Seidel projection method (GSPM) applies a Gauss-Seidel correction to a fractional step scheme for symplectic flow of harmonic maps and couples the solution with a projection method for heat flow of harmonic maps [9]. Considering the undamped LL equation with only the gyromagnetic term present ∂m = −m × ∆m, ∂t (2.39) it can be linearised using a fractional step scheme [9] m∗ − mn = ∆h m∗ , ∆t mn+1 = mn − mn × m∗ , (2.40) where ∆t is the time step size and ∆h is the discrete laplacian. Combining the two equations one gets mn+1 = mn − mn × (I − ∆t∆h )−1 mn . (2.41) This scheme can be shown to be unstable when applied to a PDE such as the LLG equation [10]. Due to its vectorial product structure the stability of the scheme can be significantly improved by implementing an implicit Gauss-Seidel correction where new component values are reused immediately. In its component form the improved scheme looks as follows gn = (I − ∆t∆h )−1 mn (2.42) n+1 n n n n n mx + (gy mz − gz my ) mx n n n+1 mn+1 m − gxn+1 mnz ) . = (2.43) y y + (gz mx n+1 n n+1 n+1 n+1 n+1 mz mz + (gx my − gy mx ) 9 When the gyromagnetic term is omitted and we have a case of infinite damping the LL equation becomes ∂m = −m × (m × ∆m), (2.44) ∂t or equivalently ∂m = ∆m + ∇|m|2 m. (2.45) ∂t (2.45) describes heat flow for harmonic maps. An unconditionally stable two-step projection scheme for the equation is shown in [11]. The term ∇|m|2 m is considered a point wise constraint: hm,mi = 1. First solve m∗ − mn = ∆h m∗ ∆t for m∗ , then project onto the unit sphere m∗ . mn+1 = km∗ k (2.46) (2.47) The two above methods for solving equations (2.39) and (2.45) can be coupled together to solve the full LL equation as the Gauss-Seidel projection method [10]. Considering a splitting of the effective field hef f = ∆m + f, (2.48) where f = hani + hext , (2.49) the full equation can be written as ∂m = −βm × (∆m + f) − αm × m × (∆m + f). ∂t GSPM can be applied to (2.50) in three steps: Step 1: Implicit Gauss-Seidel for gyromagnetic term gn = (I − ∆t∆h )−1 (mn − f) g∗ = (I − ∆t∆h )−1 (m∗ − f) ∗ ∗ mx + (gyn mnz − gzn mny ) mx m∗y = m∗y + (gzn m∗x − gx∗ mnz ) . m∗z + (gx∗ m∗y − gy∗ m∗x ) m∗z (2.50) (2.51) (2.52) Step 2: Projection method for heat flow of harmonic maps f∗ = h∗ani + hext ∗∗ ∗ mx mx + α∆t(∆h m∗x ∗ +fx∗ ) m∗∗ = m∗y + α∆t(∆h m∗y ∗ +fy∗ ) . y m∗∗ m∗z + α∆t(∆h m∗z ∗ +fz∗ ) z Step 3: Projection onto unit sphere n+1 ∗∗ mx m 1 x∗∗ mn+1 my . = y km∗∗ k mn+1 m∗∗ z z (2.53) (2.54) (2.55) For the discretisation of the laplacian a second order finite difference scheme was used. 10 3 Method of comparison To make a comparison several numerical properties and physical constraints have been investigated for each method. The specific initial value problem we have studied is ∂m ∂t = −m × hef f − m × (m × hef f ), (3.1) m(0, t) = m(L + ∆x, t), 2πx 2πx m(x, 0) = [cos( L ), sin( L ), 0], 2 with hef f = ∂∂xm2 + hani + hext , where hani = hm, pip , p = √13 [1, 1, 1] and hext = [0, 0, 1]. For error estimations an ”exact” solution calculated using IMP with ∆t = 10−5 has been used. 3.1 Physical requirements Essential from a physical viewpoint is that the magnitude is conserved for every time step, as explained in section 2.1. The restrictions of this project forces a constant magnitude of 1. To investigate whether the methods fulfilled this constraint correctly the maximum norm was calculated for every time step. Its deviation from 1 was then plotted to see the evolution of the magnitude error. The gyromagnetic term of the LL equation is of energy conserving Hamiltonian structure [12] . For a numerical method to correctly model the physics this implies that energy has to be conserved in the case of no damping. The energy conserving properties of the methods were checked by calculating and plotting the time evolution of the discrete energy as seen in equation (2.9). Although a method does not compute energy correctly it may still result in a correct solution. This is a consequence of the interaction between the magnetic moments and the laplacian in the term for the exchange energy. 3.2 Numerical viability To determine how viable a numerical method is, certain core properties should be analysed, as detailed in section 2.3. To determine which discretisations satisfy correct solutions for a method its stability needs to be analysed. Due to the non linearity of the LL equation, performing an analytical stability analysis is difficult. Aside for IMP, which is implicit, we have performed numerical tests where the error is looked at for increasing time steps with different space steps. If there is a major error increase for a certain discretisation it can be concluded that stability has been lost. Stability results were double checked by comparing energy values. How accurate a method is can be concluded from its order of accuracy. This property determines how fast the error decreases with smaller step sizes and is consequently important for the choice of discretisation. The orders of accuracies were calculated for each scheme by looking at the errors for different time steps and inserting these values in equation (2.10). The last property analysed was the computation time. It is obviously preferable for a method to be as fast as possible and for large simulations the feasibility might even be constrained by long execution times. The computation time was investigated by timing 11 the three methods for different amounts of time steps. Linear regression was performed on the results to get an approximate function for the computation time. 4 Results General results are compiled in table 1 and a time evolution of the solution can be seen in figure 3. Table 1: General results for the three schemes Scheme Mag. conserv. Energy conserv. Stability Conv. rate Comp. time IMP Yes Yes Uncond. 2 Long MPE Yes No Cond. 2 Short GSPM Yes No Uncond. 1 Short t = 0.5 1 1 0 0 z z t=0 -1 1 0 y -1 0 50 -1 1 100 0 y x -1 1 0 0 z z t=2 1 -1 1 y -1 0 50 -1 1 100 0 y x -1 0 0 z z 1 -1 1 y 0 100 t=5 1 -1 0 50 x t=3 0 100 x t=1 0 0 50 50 -1 1 100 0 y x -1 0 50 100 x Figure 3: Solution at different times t. Computed using GSPM with ∆t = 10−4 and 100 grid points on [0,100]. The solution converges towards the effective h-field. 12 4.1 Magnitude conservation The magnitude conservation was confirmed by finding the largest magnitude error |m|−1 for every time step. Errors for ∆t = 10−3 solutions are plotted in figure 4 and as can be seen the fluctuations are very small and negligible. The errors for GSPM are on the scale of machine epsilon. 10 -14 6 Implicit midpoint 4 2 0 0 1000 1500 10 -14 2 |m|-1 500 2000 2500 3000 3500 4000 4500 5000 3500 4000 4500 5000 4000 4500 5000 Midpoint extrapolation 1 0 0 500 1000 10 -16 3 1500 2000 2500 3000 Gauss-Seidel projection 2 1 0 0 500 1000 1500 2000 2500 3000 3500 Time steps Figure 4: Magnitude fluctuations around 1 for the three methods with ∆t = 10−3 and 100 grid points on [0,100] 4.2 Energy conservation With zero damping the equation reduces to ∂m = −m × hef f , ∂t (4.1) which is of Hamiltonian structure and conservative with respect to energy. To observe how well the methods conserve this property their discrete energies were calculated using 13 equation (2.9). The energy evolution over time for the three methods are shown in figure 5. It is clear from the plots that implicit midpoint conserves energy whereas the other two schemes do not. However, the projection method diverges a lot faster than midpoint with extrapolation which is very clear from figure 6 that shows the energies in the same plot. Implicit midpoint -116.3 -116.4 -116.5 0 10 20 30 50 60 70 80 90 100 70 80 90 100 70 80 90 100 Midpoint extrapolation -116.3 Energy 40 -116.4 -116.5 0 10 20 30 40 50 60 Gauss-Seidel projection -100 -120 -140 -160 -180 0 10 20 30 40 50 60 Time Figure 5: Energy evolution without damping for the three methods with ∆t = 10−2 , T = 100 and 100 grid points on [0,100]. 14 Energy evolution without damping -116 -116.5 Energy -117 Implicit midpoint Midpoint extrapolation Gauss-Seidel projection -117.5 -118 -118.5 -119 0 20 40 60 80 100 Time Figure 6: Energy evolution without damping for the three methods on the same energy scale with ∆t = 10−2 , T = 100 and 100 grid points on [0,100]. 4.3 Stability analysis Due to the complexity of the LL equation performing analytical stability analyses is rather difficult. Instead one can analyse the methods numerically by observing how the error behaves at different time steps. If the error suddenly spikes and starts to behave erratically the stability criteria is no longer fulfilled and the method has become unstable. The IMP method is of implicit nature and therefore unconditionally stable. According to [9] the GSP method is also unconditionally stable. Test runs with large time steps have not been able to disprove this thesis and it is thus assumed true. MPE is an explicit scheme and should lose stability for large step sizes. Figure 7 shows three plots for different space steps around time steps where there is a marginal increase in maximum error. The error was approximated by comparing the last time step with solutions of finer discretisations. From this information an approximation of the stability relation was calculated. The plots in figure 7 implies a stability relation that follows the ∆t trend ∆x 2 ≤ C, where C is some constant. From table 2 it is possible to approximate the value of the constant C to: 0.1539 ± 3.22%. This result can also be confirmed by analysing the energy evolution with damping around time steps close to the stability limit. As shown in figure 8 the energy starts 15 increasing after supposed convergence for time steps larger than the stability condition. Table 2: ∆t for loss of stability for different ∆x ∆t ∆x 0.143 1 0.087 0.75 0.041 0.5 Stability dx=1 1 0.5 0 0.02 0.04 0.06 0.08 0.12 0.14 0.16 0.18 0.2 0.14 0.16 0.18 0.2 0.14 0.16 0.18 0.2 Stability dx=0.75 2 ERROR 0.1 1 0 0.02 0.04 0.06 0.08 0.1 0.12 Stability dx=0.5 4 2 0 0.02 0.04 0.06 0.08 0.1 0.12 Time Step Figure 7: MPE: Error as a function of ∆t for three different space steps. 16 Energy evolution with damping for different -100 t -120 t = 0.143 t = 0.149 t = 0.159 t = 0.189 Energy -140 -160 -180 -200 -220 -240 0 2 4 6 8 10 Time Figure 8: MPE: Energy over time with damping for different time steps with 100 grid points on [0,100]. 4.4 Convergence studies Convergence rates were tested by using an IMP solution of (3.1) with ∆t = 10−5 and 100 grid points on [0,100] as ”exact”. Absolute errors for decreasing time steps of each of the methods were then computed. The errors were calculated as the maximum error norms of all space steps at the end time T = 5. These results confirm an order of accuracy of 2 for IMP and MPE and 1 for GSPM. Table 3: Errors ∆t 0.1 0.1/2 0.1/4 0.1/8 0.1/16 Order of accuracy at time T = 5 for different ∆t IMP MPE GSPM 2.9842E-4 1.0808E-3 8.7727E-3 7.4119E-5 2.6964E-4 4.0920E-3 1.8570E-5 6.7320E-5 1.9713E-3 4.7222E-6 1.6996E-5 9.6701E-4 1.2874E-6 4.4605E-6 4.7894E-4 1.9862 1.9829 1.0471 17 4.5 Computation time A major difference between the IMP method and the other methods is the computational time required to complete a time step. Computational time was measured for each of the methods to find the dependency on the amount of time steps. In table 4 we can see that the GSPM is the fastest, with a computational time of about 2 seconds per 1000 time steps. The MPE method is about half as fast, but the IMP method has a time cost that is more than two orders of magnitude greater than the GSPM. Table 4: Computation time, in seconds, for each method using K time steps with ∆x = 1. K IMP MPE GSPM 100 18.43 0.59 0.29 400 60.96 1.54 0.75 800 105.17 2.93 1.42 1000 132.17 3.54 1.76 4000 423.34 13.67 7.36 8000 834.59 27.33 14.54 10000 1017.66 34.09 18.38 Tcomp ≈ 0.1K + 22 0.0034K + 0.2 0.0018K 5 5.1 Discussion Conservative properties We know from the theory that kmk is supposed to be constant over time. Looking at figure 4 that shows how the magnitude error evolves we can see that all three methods conserve this property well. The errors are very small and should be negligible in almost all cases. The IMP plot has a rather odd increase but the error is still very small and in a run with more time steps the error stayed at the same order of magnitude, similar to the MPE case. For GSPM m is normalised in every time step and consequently the error is constantly on the scale of machine epsilon. Figure 6 shows the energy over time and we can see that the IMP method conserves energy very well. This agrees with [13] which shows analytically that the method should conserve energy. Furthermore it is clear that both GSPM and MPE fails to keep the energy constant. Although, whereas the projection method quickly diverges the midpoint scheme does fairly well with a relatively low margin of error. In situations where the energy quantity is of importance the GSPM is consequently not ideal to use but MPE might be suitable in some cases. 5.2 Numerical performance IMP is an implicit scheme and therefore unconditionally stable. The lack of stability constraint is one of the main benefits of this method. Combined with an order of convergence of two and its energy conserving properties the IMP method is a popular LLG solver. However, due to the implicit nature its downsides are implementation difficulties 18 as well as long computation times. (Although not considered in this project, it should be possible to reduce the computational time of the IMP method by disregarding a few elements when computing the approximation to the Jacobian matrix [13].) Comparatively MPE is explicit and as figure 7 shows stability is lost for large time steps in relation to the space step. The constraint for the studied problem was approximated to be ∆t 6 0.154∆x2 which allows for some discretisation variety but not as freely as with IMP. As the order of convergence also is two what differs the most from IMP is computation time where MPE performs a lot better. In cases where the stability constraint is not limiting and energy does not have to be very accurate MPE seems to be the preferred mid point scheme. From table 4 we can see that GSPM is the fastest scheme, although similar to MPE. Seemingly unconditionally stable as well, it is suited for quick computations. However, it is unable to conserve energy and only has an order of convergence of one. It is thus debatable whether GSPM can hold up to the two mid point methods when more accurate solutions are required. 6 Conclusion We implemented three different methods for solving the LLG equation. Experiments to confirm convergences rates were performed and the results match expected rates from cited sources. The energy conservative properties of the solutions to the undamped LLG equation were investigated and it was found that the GSPM and the MPE method failed to compute this correctly. The stability constraint for the MPE method was approximated. The computational time for the IMP method was found to be two orders of magnitude greater than the other two methods. We can therefore conclude that the IMP should be used in cases where energy computation, or the use of large time steps is of importance. The GSPM should be used for fast calculations where the energy is of negligible importance. And the MPE could be used in cases where some energy inaccuracy is allowed and necessary discretisations fulfil the stability criterion as a faster replacement for the IMP. 19 References [1] D. Wei, Micromagnetics and recording materials. Springer Science & Business Media, 2012. [2] B. Gurney, M. Carey, C. Tsang, M. Williams, S. Parkin, R. Fontana Jr, E. Grochowski, M. Pinarbasi, T. Lin, and D. Mauri, “Ultrathin magnetic structures iv, edited by b. heinrich and jac bland,” 2005. [3] G. Bertotti, Hysteresis in magnetism: for physicists, materials scientists, and engineers. Academic press, 1998. [4] I. Cimrák, “A survey on the numerics and computations for the landau-lifshitz equation of micromagnetism,” Archives of Computational Methods in Engineering, vol. 15, no. 3, pp. 1–37, 2007. [5] L. Baňas, “Numerical methods for the landau-lifshitz-gilbert equation,” Numerical Analysis and Its Applications, pp. 158–165, 2005. [6] A. Aharoni, Introduction to the Theory of Ferromagnetism, vol. 109. Clarendon Press, 2000. [7] D. Arjmand, M. Poluektov, and G. Kreiss, “Atomistic-continuum multiscale modelling of magnetisation dynamics at non-zero temperature,” arXiv preprint arXiv:1702.05173, 2017. [8] C. Serpico, I. Mayergoyz, and G. Bertotti, “Numerical technique for integration of the landau–lifshitz equation,” Journal of Applied Physics, vol. 89, no. 11, pp. 6991– 6993, 2001. [9] X.-P. Wang, C. J. Garcıa-Cervera, and E. Weinan, “A gauss–seidel projection method for micromagnetics simulations,” Journal of Computational Physics, vol. 171, no. 1, pp. 357–372, 2001. [10] C. J. Garcia-Cervera, “Numerical micromagnetics: A review,” 2007. [11] E. Weinan and X.-P. Wang, “Numerical methods for the landau–lifshitz equation,” SIAM journal on numerical analysis, 2006. [12] E. Kim and K. Lipnikov, “The mimetic finite difference method for the landau– lifshitz equation,” Journal of Computational Physics, vol. 328, pp. 109–130, 2017. [13] M. d’Aquino, C. Serpico, and G. Miano, “Geometrical integration of landau–lifshitz– gilbert equation based on the mid-point rule,” Journal of Computational Physics, vol. 209, no. 2, pp. 730–753, 2005. 20
© Copyright 2024 Paperzz