problems on using custom_exchange

674 views
Skip to first unread message

Min Yi

unread,
Jun 26, 2018, 12:08:25 PM6/26/18
to mumax2
Dear All,
I try to use the custom_exchange to calculate hysteresis, by using the input file from https://github.com/mumax/3/blob/master/test/custom_exchange.mx3

My total input file is:
N := 50
c
:= 1e-9
SetGridsize(N, 1, N)
SetCellsize(c, c, c)

Ku1 = 4.3e3
anisU
= vector(0, 0, 1)
Msat = 1.61/4/pi*1e7

tableadd
(m_full)
Bmax := 0.1
Bstep := 0.001
MinimizerStop = 1e-7
TableAdd(B_ext)
m
= uniform(0,0,1)
for B:=Bmax; B>=-Bmax; B-=Bstep {
 B_ext
= vector(0, 0.035*B, B)
 
NewAex:=6e-12
 prefactorX
:= Const( (2 * NewAex) / (c*c*Msat.Average()))
 prefactorY
:= Const( (2 * NewAex) / (c*c*Msat.Average()))
 prefactorZ
:= Const( (2 * NewAex) / (c*c*Msat.Average()))
 left
:= Mul(prefactorX,Mul(Add(Mul(Const(-1),m),Shifted(m, 1,0,0)),Shifted(Const(1),1,0,0)))
 right
:= Mul(prefactorX,Mul(Add(Mul(Const(-1),m),Shifted(m,-1,0,0)),Shifted(Const(1),-1,0,0)))
 forward
:= Mul(prefactorY,Mul(Add(Mul(Const(-1),m),Shifted(m,0, 1,0)),Shifted(Const(1),0,1,0)))
 backward
:= Mul(prefactorY,Mul(Add(Mul(Const(-1),m),Shifted(m,0,-1,0)),Shifted(Const(1),0,-1,0)))
 up
:= Mul(prefactorZ,Mul(Add(Mul(Const(-1),m),Shifted(m,0,0, 1)),Shifted(Const(1),0,0,1)))
 down
:= Mul(prefactorZ,Mul(Add(Mul(Const(-1),m),Shifted(m,0,0,-1)),Shifted(Const(1),0,0,-1)))
 
Bc :=Add(left,Add(right,Add(forward,Add(backward,Add(up,down)))))
 
AddFieldTerm(Bc)
 addEdensTerm
(Mul(Const(-0.5),Dot(Bc,M_full)))
 minimize
()
 tablesave
()
 save
(m_full)
}
But this gives no hysteresis, as shown below



In contrast, without custom exchange, the input file
N := 50
c
:= 1e-9
SetGridsize(N, 1, N)
SetCellsize(c, c, c)

Ku1 = 4.3e3
anisU  
= vector(0, 0, 1)
Msat  = 1.61/4/pi*1e7
Aex = 6e-12

tableadd
(m_full)
Bmax  := 0.1
Bstep :=  0.001
MinimizerStop = 1e-7
TableAdd(B_ext)
m
= uniform(0,0,1)
for B:=Bmax; B>=-Bmax; B-=Bstep {
    B_ext
= vector(0, 0.035*B, B)
    minimize
()   // small changes best minimized by minimize()
    tablesave
()
    save
(m_full)
}
gives the correct hysteresis.




I do not know why the custom exchange does not work. Is there any error in my input file ? Does anybody have similar experience ?
Many thanks !

Best regards,
Min
Auto Generated Inline Image 1
Auto Generated Inline Image 2

Jeroen Mulkers

unread,
Jun 26, 2018, 4:40:26 PM6/26/18
to mum...@googlegroups.com
What I think is happening here, is that the exchange interaction becomes very strong because in each step you define and add a custom exchange field.

I think that you will get a correct hysteresis curve if you define the custom exchange field and add it as a field term only once (before you start the hysteresis loop).

--
You received this message because you are subscribed to the Google Groups "mumax2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Min Yi

unread,
Jun 26, 2018, 5:07:30 PM6/26/18
to mumax2
Thanks. Yes. I have to move it out of the B_ex loop.
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+un...@googlegroups.com.

Min Yi

unread,
Jun 27, 2018, 5:32:05 AM6/27/18
to mumax2
Hallo Jeroen,
Thanks for your tips. It works now. But I have another problem. How can I define the custom_exchange to a specific region (similar to the normal way  Ku1.setregion(1, 1e6) ) ? Is there any solution for this ?
Many thanks for your help.

Best regards,
Min




On Tuesday, June 26, 2018 at 10:40:26 PM UTC+2, Jeroen Mulkers wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+un...@googlegroups.com.

Jeroen Mulkers

unread,
Jun 27, 2018, 5:57:42 AM6/27/18
to mum...@googlegroups.com
You can mask the custom field with a shape as follows:

BcMasked := Masked( shape, Bc )

To unsubscribe from this group and stop receiving emails from it, send an email to mumax2+unsubscribe@googlegroups.com.

Min Yi

unread,
Jun 27, 2018, 5:59:11 PM6/27/18
to mumax2
Hallo Jeroen,
Thanks again for your kind help. The mask function works. But in a hard-soft-hard three-layer structure, I try two methods (directly define Aex and use custom exchange) and find that the results differ a lot.
My input by defining Aex is
N := 25
tsoft
:= 3
c
:= 1e-9
SetGridsize(2*N, 1, 2*N+tsoft)
SetCellsize(c, c, c)
khard
:= 4.3e6
mshard
:= 1.26e6
aehard
:= 10.2e-12
ksoft
:= 0.0*khard
mssoft
:= 1.0*mshard
aesoft
:= 1.0*aehard
all
:= cuboid(2*N*c,c,(2*N+tsoft)*c)
soft
:= cuboid(2*N*c,c,tsoft*c)
hard
:= all.sub(soft)
defregion
(1,hard)
defregion
(2,soft)
Ku1.setregion(1,khard)
anisU
.setRegion(1, vector(0, 0, 1))
Msat.setregion(1,mshard)
Aex.setregion(1,aehard)
Ku1.setregion(2,ksoft)
anisU
.setRegion(2, vector(0, 0, 1))
Msat.setregion(2,mssoft)
Aex.setregion(2,aesoft)
//ext_ScaleExchange(1, 2, 0.0)
ext_InterExchange
(1, 2, 10.2e-12)
tableadd
(m_full)
Bmax  := 5.5
Bstep :=  0.01

MinimizerStop = 1e-7
TableAdd(B_ext)
m
= uniform(0,0,1)
for B:=0.0; B>=-Bmax; B-=Bstep {

    B_ext
= vector(0, 0.035*B, B)
    minimize
()   // small changes best minimized by minimize()
    tablesave
()
    save
(m_full)
}


And the custom-exchange (set the hard part by custom exchange, the other exchange keeps the same as above) input file is
N := 25
tsoft
:= 3
c
:= 1e-9
SetGridsize(2*N, 1, 2*N+tsoft)
SetCellsize(c, c, c)
khard
:= 4.3e6
mshard
:= 1.26e6
aehard
:= 10.2e-12
ksoft
:= 0.0*khard
mssoft
:= 1.0*mshard
aesoft
:= 1.0*aehard
all
:= cuboid(2*N*c,c,(2*N+tsoft)*c)
soft
:= cuboid(2*N*c,c,tsoft*c)
hard
:= all.sub(soft)
defregion
(1,hard)
defregion
(2,soft)
Ku1.setregion(1,khard)
anisU
.setRegion(1, vector(0, 0, 1))
Msat.setregion(1,mshard)
//Aex.setregion(1,aehard)
Ku1.setregion(2,ksoft)
anisU
.setRegion(2, vector(0, 0, 1))
Msat.setregion(2,mssoft)
Aex.setregion(2,aesoft)
//ext_ScaleExchange(1, 2, 0.0)
ext_InterExchange
(1, 2, 10.2e-12)
NewAex := 10.2e-12

prefactorX
:= Const( (2 * NewAex) / (c*c*Msat.Average()))
prefactorY
:= Const( (2 * NewAex) / (c*c*Msat.Average()))
prefactorZ
:= Const( (2 * NewAex) / (c*c*Msat.Average()))

left
:=       Mul(prefactorX,Add(Mul(Const(-1),m),Shifted(m, 1,0,0)))
right
:=      Mul(prefactorX,Add(Mul(Const(-1),m),Shifted(m,-1,0,0)))
forward
:=    Mul(prefactorY,Add(Mul(Const(-1),m),Shifted(m,0, 1,0)))
backward
:=   Mul(prefactorY,Add(Mul(Const(-1),m),Shifted(m,0,-1,0)))
up
:=         Mul(prefactorZ,Add(Mul(Const(-1),m),Shifted(m,0,0, 1)))
down
:=       Mul(prefactorZ,Add(Mul(Const(-1),m),Shifted(m,0,0,-1)))
Bc :=Add(left,Add(right,Add(forward,Add(backward,Add(up,down)))))
Bchard := Masked(Bc,hard)
AddFieldTerm(Bchard)
addEdensTerm
(Mul(Const(-0.5),Dot(Bchard,M_full)))
tableadd
(m_full)
Bmax  := 5.5
Bstep :=  0.01

MinimizerStop = 1e-7
TableAdd(B_ext)
m
= uniform(0,0,1)
for B:=0.0; B>=-Bmax; B-=Bstep {

    B_ext
= vector(0, 0.035*B, B)
    minimize
()   // small changes best minimized by minimize()
    tablesave
()
    save
(m_full)
}

However, these two input files give two different hysteresis, as shown below

The difference is very large. I checked the input file several times, but still cannot figure out the problem. Is there any problem of the custom exchange ?

Many thanks..
Best regards,
Min

Reply all
Reply to author
Forward
0 new messages