Skip to content

Commit

Permalink
add ext_backgroundtilt variabel (default=0 for backwards compatibilit…
Browse files Browse the repository at this point in the history
…y) which compensates in-plane tilted backgrounds for calculating the bubble position. Add test which fails for the previous implementation that did not account for this. Thanks M. Mangold for signaling this issue.
  • Loading branch information
JLeliaert committed Jan 28, 2023
1 parent 8a1f1be commit 9b47ada
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 8 deletions.
23 changes: 15 additions & 8 deletions engine/ext_bubblepos.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ var (
BubbleDist = NewScalarValue("ext_bubbledist", "m", "Bubble traveled distance", bubbleDist)
BubbleSpeed = NewScalarValue("ext_bubblespeed", "m/s", "Bubble velocity", bubbleSpeed)
BubbleMz = 1.0
BackGroundTilt = 0.25
)

func init() {
DeclVar("ext_BubbleMz", &BubbleMz, "Center magnetization 1.0 or -1.0 (default = 1.0)")
DeclVar("ext_BackGroundTilt", &BackGroundTilt, "Size of in-plane component of background magnetization. All values below this one are rounded down to perfectly out-pf-plane to improve position calculation (default = 0.25)")
}

func bubblePos() []float64 {
Expand All @@ -28,26 +30,26 @@ func bubblePos() []float64 {
}

{
var magsum float32
var weightedsum float32
var magsum float64
var weightedsum float64

for iy := range mz {
for ix := range mz[0] {
magsum += ((mz[iy][ix]*float32(BubbleMz) + 1.) / 2.)
weightedsum += ((mz[iy][ix]*float32(BubbleMz) + 1.) / 2.) * float32(iy)
magsum += (backgroundAdjust(mz[iy][ix]*float32(BubbleMz) + 1.) / 2.)
weightedsum += (backgroundAdjust(mz[iy][ix]*float32(BubbleMz) + 1.) / 2.) * float64(iy)
}
}
posy = float64(weightedsum / magsum)
}

{
var magsum float32
var weightedsum float32
var magsum float64
var weightedsum float64

for ix := range mz[0] {
for iy := range mz {
magsum += ((mz[iy][ix]*float32(BubbleMz) + 1.) / 2.)
weightedsum += ((mz[iy][ix]*float32(BubbleMz) + 1.) / 2.) * float32(ix)
magsum += (backgroundAdjust(mz[iy][ix]*float32(BubbleMz) + 1.) / 2.)
weightedsum += (backgroundAdjust(mz[iy][ix]*float32(BubbleMz) + 1.) / 2.) * float64(ix)
}
}
posx = float64(weightedsum / magsum)
Expand Down Expand Up @@ -112,3 +114,8 @@ func bubbleSpeed() float64 {

return v
}

func backgroundAdjust(arg float32) float64{
if float64(arg)< BackGroundTilt{
return float64(0)}
return float64(arg)}
28 changes: 28 additions & 0 deletions test/bubblepos.mx3
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
SetMesh(128, 128, 1, 1e-9,1e-9,0.4e-9, 1, 0, 0)

Msat =580e3
Aex = 15e-12
enabledemag=true
alpha = 0.1
Ku1=0.59e6+4*pi*1e-7*0.5*580e3*580e3
anisU=vector(0,0,1)
Dind=0.0034089785

shiftregions=false

m =neelskyrmion(1, -1).transl(-30e-9,0e-9,0)
minimize()


ext_bubbleMz = -1.0
//without compensating for in-plane tilts of the background this fails (corresponds to ext_backgroundtilt=0)
ext_backgroundtilt=0.25 //default value

TOL:=1e-9
expectv("position", ext_bubblepos.average(), vector(-3e-08,0,0), TOL)


SetMesh(128, 128, 1, 1e-9,1e-9,0.4e-9, 0, 1, 0)
m =neelskyrmion(1, -1).transl(0e-9,-30e-9,0)
minimize()
expectv("position", ext_bubblepos.average(), vector(0,-3e-08,0), TOL)

0 comments on commit 9b47ada

Please sign in to comment.