{'fraction_non_alphanumeric': 0.029600818833162745, 'fraction_numerical': 0.013633572159672466, 'mean_word_length': 4.770375620127569, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modelling of Magnetic Stray Fields in Multilayer Magnetic Films with In-Plane or Perpendicular Anisotropy

: The magnetic stray ﬁeld is an unavoidable consequence of magnetic multilayers, which may have a signiﬁcant inﬂuence on the performance of spintronic devices. Based on Maxwell’s magnetostatics theory, here we numerically calculated the distributions of magnetic stray ﬁelds and self-demagnetizing ﬁelds in a series of patterned multilayer thin-ﬁlm structures with either an in-plane or a perpendicularly magnetized ferromagnetic layer. The stray ﬁeld above the ferromagnetic layer is inhomogeneous, showing the dramatic changes near the sample edge, but the uniformity in the center region could be improved with the increasing sample size. The stray ﬁeld strength tends to zero for large samples, increases with the increase in the hard-layer thickness, and decreases with the increase in the distance D away from the ferromagnetic layer. In the multilayer samples, the separately simulated stray ﬁeld and self-demagnetizing ﬁeld within the soft layer agree well with the classic magnetostatic relationship of B = µ 0 ( H d + M ) . For the in-plane magnetized trilayer sample, the magnetic-ﬂux density within the soft ferromagnetic layer slightly decreases in the antiparallel magnetization alignment and increases in the parallel alignment state with the increase in the intermediate non-magnetic-layer thickness. In contrast, for the sample with the perpendicular magnetization, the magnetic-ﬂux density decreases as the non-magnetic layer is thickened for both the antiparallel and parallel state. This study may provide a theoretical basis for the design of thin-ﬁlm spintronic devices.


Introduction
The distribution of the magnetic dipolar or stray fields around thin-film nanostructures is crucial for various applications, including magnetic sensors [1], field-emission guns [2], magnetic-force microscopy [3], 2D field effect transistors [4], magnetic storage [1,5], and magnetic random access memory (MRAM) [6]. The magnetostatic field and self-demagnetizing field generated by the large-size magnetic thin film are often ignored. However, the magnetic field becomes pronounced for small-size devices, which may lead to inhomogeneity in magnetic tunnel junctions and may have a significant influence on the magnetic properties, thermal stability, and switching characteristics [7,8]. In addition, the cross-talk between magnetic elements due to the stray fields from their ferromagnetic layers cannot be ignored for integration. The core parts of these devices (e.g., magnetic tunnel junction or spin valves) consist of two ferromagnetic (FM) layers sandwiching a non-magnetic (NM) tunnel barrier, as illustrated in Figure 1a, where the upper magnetic layer (Layer A) is a soft layer whose magnetization is easy to rotate by external magnetic field or spin-polarized current, and the lower magnetic layer (Layer B) is the hard layer whose magnetization is fixed by adding an antiferromagnetic (AF) layer to provide a stable exchange bias field. In this case, the hard layer could generate a magnetic stray field acting at the position of the soft layer, naturally resulting in an asymmetry (offset) of hysteresis loop or switching current [8][9][10][11]. Such asymmetry is definitely undesirable for The microscopic principle of the magnetic stray fields is derived from the dipolar field of atoms. Generally, the magnetic stray fields in the magnetic thin-film samples can be studied by Maxwell's magnetostatics [3,19] or micromagnetic simulations (e.g., OOMMF [20] or MuMax3 [21]). Very recently, the influence of stray fields for the practical MRAM application with the element size smaller than 50 nm tunnel junctions has been modelled at atomic-level precision by VAMPIRE code [12], in which the stray fields caused by both the patterning defect and the non-collinear antiferromagnets have been well discussed. Interestingly, the bulk magnetization of an antiferromagnet is essentially zero, but at the nanoscale atomic lattice defects and the non-collinear nature of the antiferromagnetic spins may also lead to a magnetic stray field, which may be particularly important for nanoscale magnetic sensors or memory devices.
In this paper, in order to comprehensively analyze the scalability of the dipolar magnetic field effect, we performed a series of simulations in the multilayer samples with the in-plane or perpendicular magnetization. The samples are patterned in a rectangular shape with a fixed lateral aspect ratio of 1:2, and the sample size (short axis) varies from 50 nm to 0.5 μm. The spatial distribution of the magnetic-flux density as well as the separated stray field and the self-demagnetizing field are modelled as a function of sample size, ferromagnetic layer thickness, separated distance, and different magnetization-alignment configurations. The microscopic principle of the magnetic stray fields is derived from the dipolar field of atoms. Generally, the magnetic stray fields in the magnetic thin-film samples can be studied by Maxwell's magnetostatics [3,19] or micromagnetic simulations (e.g., OOMMF [20] or MuMax3 [21]). Very recently, the influence of stray fields for the practical MRAM application with the element size smaller than 50 nm tunnel junctions has been modelled at atomic-level precision by VAMPIRE code [12], in which the stray fields caused by both the patterning defect and the non-collinear antiferromagnets have been well discussed. Interestingly, the bulk magnetization of an antiferromagnet is essentially zero, but at the nanoscale atomic lattice defects and the non-collinear nature of the antiferromagnetic spins may also lead to a magnetic stray field, which may be particularly important for nanoscale magnetic sensors or memory devices.
In this paper, in order to comprehensively analyze the scalability of the dipolar magnetic field effect, we performed a series of simulations in the multilayer samples with the in-plane or perpendicular magnetization. The samples are patterned in a rectangular shape with a fixed lateral aspect ratio of 1:2, and the sample size (short axis) varies from 50 nm to 0.5 µm. The spatial distribution of the magnetic-flux density as well as the separated stray field and the self-demagnetizing field are modelled as a function of sample size, ferromagnetic layer thickness, separated distance, and different magnetization-alignment configurations.

Theoretical Model and Method
It is well known that for a magnetic thin film magnetized along the x direction in the film plane by a uniform external magnetic field, a north (N) pole (with positive magnetic charges) is formed at right and south (S) pole at left, as illustrated in Figure 1b. Consequently, the magnetic-charge-induced dipole fields (H lines) radiate out from the N pole to the S pole, both from the outside and inside of the sample [22]. The magnetic circuits of the dipole field H lines are closed except their direction suddenly reverses at the magnetic poles. The inside dipole field is named the self-demagnetizing field H d , while the outside is called the stray field. The self-demagnetizing field is not uniform and opposes the magnetization M, but its strength can never exceed M. In the classic magnetostatic relationship of B = µ 0 (H + M), B is the magnetic induction strength vector and µ 0 is the vacuum permeability. Thus, within the sample we have B = µ 0 (H d + M), while for the outside B = µ 0 H, as shown in Figure 1c. The flux density of B inside the magnet is therefore less than µ 0 M but in the same direction, so that the circuits of B lines are closed. In addition, the B lines depart or diverge toward the magnetic poles, and the flux density of B near the edges is less than that at the center of the sample. This is caused by the fact that the H d is stronger near the poles and has the minimum at the center. The uniform character of the self-demagnetizing effect strongly influences the behavior of magnetic thin films and is very important in possible practical spintronic devices.
We consider ferromagnetic compounds with a given magnetization M. The law of B = µ 0 (H + M) together with Maxwell's equations divB = 0 and curlH = 0 yield the Poisson's equations for the scalar magnetic potential and the components of the vector potential, respectively. From the Biot-Savart law, the magnetic-flux density B with an equivalent surface current density j m = M × n (n is the surface normal pointing out the sample) can be derived analytically, e.g., for a cuboid sample with perpendicular magnetization [3]: where L, w, and t are the geometry parameters of the sample. Based these theories, numerically, the finite-element-based software of COMSOL can be used to calculate the stray field distribution [7,23]. Here, we consider two types of patterned samples: one is the in-plane (IP) uniformly magnetized permalloy (Ni 80 Fe 20 ) with saturation magnetization M S = 0.8 MA/m [24], and the other one is the perpendicularly (Perp.) magnetized sample FePt with M S = 1.1 MA/m [25][26][27][28].

Results
Firstly, in order to study the stray fields emanating from the fixed hard layer (Layer B), we performed a series of simulations in which the soft layer (Layer A) is omitted but the detection window is located at the center of the soft layer, as illustrated in Figure 1a. The thickness of the uniformly magnetized hard layer is fixed at 10 nm, and the detection window is in the position with D = 4.5 nm. Figure 2a shows the x-component distribution of the stray fields at the detection window for the in-plane magnetized sample (magnetized along +x direction), where the sample size is 500 nm × 1000 nm. As expected, the radial component of stray field B x varies spatially, whose strength near the sample edges is stronger than that in the center region, and it shows positive and negative sign changes at both edges [7]. This feature remains with the increase in sample size, as shown in Figure 2b,d. For a better comparison, the horizontal axis in Figure 2d has been normalized with the sample length as X/L. The sample size is changed with a fixed aspect ratio of L/w = 1:2, where the length L varies from 50 to 500 nm. The stray field strength B x,c in the center region significantly decreases from 0.0955 T to 0.000346 T with the increase in sample size. Similarly, for the perpendicularly magnetized sample (magnetized along +z direction), the vertical component of stray field B z also shows sensitive changes at the surrounding edges and an almost constant value in the center region, as shown in Figure 3a. As the film is enlarged, the stray field strength gradually concentrates at the edge region while its strength B z,c in the center region gradually decreases from 0.175 T to 0.02 T. Figures 2d and 3c show the variation trend of the maximum and minimum strength of the stray fields. This size-dependent feature of the stray fields suggests that patterning only the soft layer and not the hard-pinned layer of the samples could reduce the influence of stray fields and improve its uniformity, which are helpful to solve the problem of asymmetric or offset switching in the magnetic sensors or memory application [9]. and an almost constant value in the center region, as shown in Figure 3a. As the film is enlarged, the stray field strength gradually concentrates at the edge region while its strength Bz,c in the center region gradually decreases from 0.175 T to 0.02 T. Figures 2d and  3c show the variation trend of the maximum and minimum strength of the stray fields. This size-dependent feature of the stray fields suggests that patterning only the soft layer and not the hard-pinned layer of the samples could reduce the influence of stray fields and improve its uniformity, which are helpful to solve the problem of asymmetric or offset switching in the magnetic sensors or memory application [9].   and an almost constant value in the center region, as shown in Figure 3a. As the film is enlarged, the stray field strength gradually concentrates at the edge region while its strength Bz,c in the center region gradually decreases from 0.175 T to 0.02 T. Figures 2d and  3c show the variation trend of the maximum and minimum strength of the stray fields. This size-dependent feature of the stray fields suggests that patterning only the soft layer and not the hard-pinned layer of the samples could reduce the influence of stray fields and improve its uniformity, which are helpful to solve the problem of asymmetric or offset switching in the magnetic sensors or memory application [9].   The thickness of the hard layer is also a key factor to influence the stray fields [12]. Figure 4a,c respectively show the thickness-dependent variation of stray fields for the two types of samples. In both cases, the strength of magnetic stray fields constantly increases with the thickness increasing. For the in-plane magnetized sample, as the thickness increases, the inhomogeneous distribution of stray fields becomes pronounced, showing the field at both edges is much larger than that in the center region, see Figure 4a. In contrast, for the perpendicularly magnetized sample, the uniform distribution region of stray fields gradually increases with the thickness increasing. The field strength B z,c in the center region gradually increases from 0.101 T to 0.587 T, with the hard-layer thickness t FM increasing from 50 nm to 500 nm, as shown in Figure 4c. The thickness of the hard layer is also a key factor to influence the stray fields [12]. Figure 4a,c respectively show the thickness-dependent variation of stray fields for the two types of samples. In both cases, the strength of magnetic stray fields constantly increases with the thickness increasing. For the in-plane magnetized sample, as the thickness increases, the inhomogeneous distribution of stray fields becomes pronounced, showing the field at both edges is much larger than that in the center region, see Figure 4a. In contrast, for the perpendicularly magnetized sample, the uniform distribution region of stray fields gradually increases with the thickness increasing. The field strength Bz,c in the center region gradually increases from 0.101 T to 0.587 T, with the hard-layer thickness tFM increasing from 50 nm to 500 nm, as shown in Figure 4c. The magnetic-stray-field distribution around a permanent magnet is strongly related to the spatial position above the magnet (i.e., distance) [29,30]. We find that in our case both the max and min values of the stray fields gradually decrease with the increase in distance D, as shown in Figure 4b,d. The stray-field curves gradually become smooth, and the field strength decreases from 0.01061 T (in-plane magnetized sample) and 0.01918 T (perpendicularly magnetized sample) and tends to zero, with the D increasing from 50 nm to 500 nm.
The spatially varying stray fields emanating from the hard layer could cause different mechanisms of magnetization reversal, showing that the antiparallel (AP) to parallel (P) switching starts near the edge while the P to AP switching begins in the interior of the soft layer [7]. In order to check the stray-field difference between the AP and P magnetization alignment, we ran the simulation with different magnetization configurations. The results are shown in Figure 5. Here, we suppose the thickness of the Layer A is 5 nm and that of the Layer B is 10 nm. In order to exclude the influence of the self-demagnetizing field, the magnetic film at the measured position is temporarily removed. It can be seen that the direction of the stray field acting on the hard layer (e.g., Layer A to B, black curves) is reversed because the magnetization orientation of Layer A is reversed during the transition between the AP and P alignments, but the stray field strength remains unchanged. The magnetic-stray-field distribution around a permanent magnet is strongly related to the spatial position above the magnet (i.e., distance) [29,30]. We find that in our case both the max and min values of the stray fields gradually decrease with the increase in distance D, as shown in Figure 4b,d. The stray-field curves gradually become smooth, and the field strength decreases from 0.01061 T (in-plane magnetized sample) and 0.01918 T (perpendicularly magnetized sample) and tends to zero, with the D increasing from 50 nm to 500 nm.
The spatially varying stray fields emanating from the hard layer could cause different mechanisms of magnetization reversal, showing that the antiparallel (AP) to parallel (P) switching starts near the edge while the P to AP switching begins in the interior of the soft layer [7]. In order to check the stray-field difference between the AP and P magnetization alignment, we ran the simulation with different magnetization configurations. The results are shown in Figure 5. Here, we suppose the thickness of the Layer A is 5 nm and that of the Layer B is 10 nm. In order to exclude the influence of the self-demagnetizing field, the magnetic film at the measured position is temporarily removed. It can be seen that the direction of the stray field acting on the hard layer (e.g., Layer A to B, black curves) is reversed because the magnetization orientation of Layer A is reversed during the transition between the AP and P alignments, but the stray field strength remains unchanged. On the other side, although the strength in the perpendicular sample is larger than that in the in-plane magnetized sample, the inhomogeneous distributions of the stray fields acting on the lateral position at the center of the soft layer are generally similar. On the other side, although the strength in the perpendicular sample is larger than that in the in-plane magnetized sample, the inhomogeneous distributions of the stray fields acting on the lateral position at the center of the soft layer are generally similar. In addition to the magnetic stray field emanating from the hard layer, the self-demagnetizing field of the soft layer could also influence the magnetization switching. Figure 6 shows the magnetic-flux density within the soft layer of the samples. Here, we suppose that the magnetization vectors are in the antiparallel alignment configurations. The enlarged snapshots show the details of the transition region near the boundary of the soft layer. The width of the magnetic field transition region of in-plane magnetized samples is similar to that of perpendicularly magnetized samples. The simulated magnetic fields within the soft layer in Figure 6b,d confirm the relationship of = ( + ), where is the self-demagnetizing field and where M and M are almost equal to their saturation magnetization for both the in-plane and perpendicularly magnetized soft layer.
Moreover, the magnetic-flux density has also been studied as a function of the NMlayer thickness between the two FM layers. In our simulations, the NM layer is treated as an air spacer. Figure 7 shows the simulated magnetic-flux density B at the central position of Layer A and Layer B in the cases with antiparallel or parallel magnetization alignments, where the spacer thickness varies from 10 nm to 50 nm, the Layer B is 10 nm thick, and the Layer A is 5 nm thick. It has been demonstrated that the stray field decreases with the increase in detection window distance D (see Figure 4b,d). But for the in-plane magnetized trilayer sample, the Layer-B-induced stray field has the same or opposite direction with the magnetization vector of Layer A in the antiparallel or parallel alignment state, respectively. Thus, the magnetic-flux density gradually decreases as the NM layer is thickened in the antiparallel state and increases in the parallel state, as shown in Figure 7a,b, respectively. In contrast, for the perpendicularly magnetized trilayer sample, the stray field has an opposite direction (see Figure 5c,d) in the antiparallel alignment state and the In addition to the magnetic stray field emanating from the hard layer, the selfdemagnetizing field of the soft layer could also influence the magnetization switching. Figure 6 shows the magnetic-flux density within the soft layer of the samples. Here, we suppose that the magnetization vectors are in the antiparallel alignment configurations. The enlarged snapshots show the details of the transition region near the boundary of the soft layer. The width of the magnetic field transition region of in-plane magnetized samples is similar to that of perpendicularly magnetized samples. The simulated magnetic fields within the soft layer in Figure 6b same direction in the parallel alignment state. Thus, in the parallel state, as shown in Figure 7d, the B fields in both Layer A and Layer B decrease, with the NM thickness increasing from 10 nm to 50 nm. However, in the antiparallel state, the B field in Layer A slightly decreases from 0.00992 T to 0.00907 T as the NM layer is thickened. However, in Layer B it increases from 0.01006 T to 0.01048 T, see Figure 7c.   Moreover, the magnetic-flux density has also been studied as a function of the NMlayer thickness between the two FM layers. In our simulations, the NM layer is treated as an air spacer. Figure 7 shows the simulated magnetic-flux density B at the central position of Layer A and Layer B in the cases with antiparallel or parallel magnetization alignments, where the spacer thickness varies from 10 nm to 50 nm, the Layer B is 10 nm thick, and the Layer A is 5 nm thick. It has been demonstrated that the stray field decreases with the increase in detection window distance D (see Figure 4b,d). But for the in-plane magnetized trilayer sample, the Layer-B-induced stray field has the same or opposite direction with the magnetization vector of Layer A in the antiparallel or parallel alignment state, respectively. Thus, the magnetic-flux density gradually decreases as the NM layer is thickened in the antiparallel state and increases in the parallel state, as shown in Figure 7a,b, respectively. In contrast, for the perpendicularly magnetized trilayer sample, the stray field has an opposite direction (see Figure 5c,d) in the antiparallel alignment state and the same direction in the parallel alignment state. Thus, in the parallel state, as shown in Figure 7d, the B fields in both Layer A and Layer B decrease, with the NM thickness increasing from 10 nm to 50 nm. However, in the antiparallel state, the B field in Layer A slightly decreases from 0.00992 T to 0.00907 T as the NM layer is thickened. However, in Layer B it increases from 0.01006 T to 0.01048 T, see Figure 7c.

Conclusions
In conclusion, we have presented a comprehensive theoretical study of the distribution of the magnetic stray field and the self-demagnetizing field in a trilayer system with in-plane or perpendicular anisotropy. Based on the theory of magnetostatics, the magnetic-strayfield distribution above an in-plane or perpendicularly magnetized magnetic film was discussed, which strongly depends on the sample size, thickness, and distance away from the sample surface. We find that the magnetic stray field is inhomogeneous, showing that the field near the sample edge is stronger than that in the center region. The numerical simulation result agrees well with the analytical calculation. The uniformity of stray fields in the center region could be improved with the increasing sample size, and the field strength tends to zero for large samples. In addition, the stray field strength increases with the increase in the hard-layer thickness and decreases with the increasing distance away from the hard layer. In the multilayer samples, we have separately calculated the magnetic stray field and the self-demagnetizing field, and the classic relationship of B = µ 0 (H d + M) is confirmed. But for the trilayer sample with in-plane magnetization, the magnetic-flux density within the soft ferromagnetic layer (including stray field and self-demagnetizing field) slightly decreases in the AP and increases in the P alignment state with the increase in the NM-layer thickness. In contrast, for the sample with the perpendicular magnetization, the magnetic-flux density always decreases with the increasing thickness of the NM layer for both the AP and P states. All these findings may provide guidance for engineering multilayer spintronics devices. Data Availability Statement: The study did not report any data.