How to collect each magnetic moment component of each layer/Region

63 views
Skip to first unread message

Apukumar jana

unread,
Aug 19, 2025, 6:09:26 AMAug 19
to mumax2
Dear All,

I am doing a simulation of two layers/regions.
I want to use a term like: Crossproduct of mx of upper layer and my component of down layer.

I will be grateful if you please let me know how to save each magnetic component of each layer.

Thanks and regards
Apu

Josh Lauzier

unread,
Aug 26, 2025, 4:09:56 AMAug 26
to mumax2
Hi,

Based on your wording, I assume you want to use this for a custom field term, not just save them? If you just want to save them, you can do something like save( m.Comp(0).region(1) ).

For a custom field term using a crossproduct, you could do something like:


u1:=ConstVector(1,0,0)
u2:=ConstVector(0,1,0)

//term applied to upper layer
mx_upper_appliedtoupper:=   Mul(Dot(m,u1),u1)
my_lower_appliedtoupper:= Mul(Dot( Shifted(m,0,0,-1),shifted(u2,0,0,-1)),u2)
upperterm:= Cross(mx_upper_appliedtoupper ,my_lower_appliedtoupper)
uppertermMasked:=Masked(upperterm, layer(0))

//term applied to lower layer
mx_upper_appliedtolower:= Mul(Dot(Shifted(m,0,0,1),Shifted(u1,0,0,1)),u1)
my_lower_appliedtolower:= Mul(Dot(m,u2),u2) 
lowerterm:=  Cross(mx_upper_appliedtolower ,my_lower_appliedtolower)
lowertermMasked:= Masked(lowerterm,layer(1))

AddFieldTerm(uppertermMasked )
AddFieldTerm(lowertermMasked )

Best,
Josh L.

AKJ

unread,
Sep 22, 2025, 11:35:09 PMSep 22
to mumax2
Hi Josh L.

I am thankful for the method you provided. 

Beside, I followed bit different path to do the cross product of (m1, m2), where m1 is magnetization of layer 1 and m2 is magnetization of layer 2.
               
               First, I defined mij (i is the region number and j is x,y, or z) as m.comp(j).Region(i).average(). Then I collected the X, Y and Z component of the cross product by simple algebra. 
               Second, I used these components as magnetic field component with some scaling parameter : Bext = vector(Cross_X, Cross_Y, Cross_Z)


Thanks and regards
Apu Kumar Jana

Reply all
Reply to author
Forward
0 new messages