Hello, everyone!
I want to generate 41 grains in a model and select 11 grains as the first phase grains and the remaining 30 grains as the second phase grains, I simulated this using the following code and the simulation shows that the model is fully magnetised at the very beginning of the application of the applied magnetic field, which is obviously not correct. Can you please help me to see what is wrong with the code? Or what can I do to divide the 41 grains generated so that 11 grains are in the first phase and the remaining 30 grains are in the second phase?
Thank you for your help! Thank you! Here is my code:
OutputFormat = OVF2_TEXT
SetGridSize(128, 128, 2)
SetCellSize(128e-9/128, 128e-9/128, 2e-9/2)
shape:=Cuboid(128e-9,128e-9,2e-9)
Setgeom(Cuboid(128e-9,128e-9,2e-9))
alpha = 0.02
angle :=1e-4
randomSeed := 1234567
grains := ext_make3dgrains(40e-9,1,41,shape,randomSeed)
SetGrainMap(grains)
for i:=1;i<42;i++{
if i==1||i==5||i==9||i==13||i==17||i==21||i==25||i==29||i==33||i==37||i==41{
Msat.SetRegion(i,854e3)
Aex.SetRegion(i,594e-14)
Ku1.SetRegion(i,3066e3)
}else{
Msat.SetRegion(i,122e4)
Aex.SetRegion(i,99e-13)
Ku1.SetRegion(i,511e4)
}
}
for i:=1;i<42;i++{
axis1:= vector(randNorm(), randNorm(), randNorm())
anisU.SetRegion(i,axis1)
}
for n:=1; n<41; n++{
for j:=n+1; j<42; j++{
ext_ScaleExchange(n, j, 0.5)
}
}
m = RandomMag()
run(1e-9)
save(regions)
save(Ku1)
save(anisU)
save(exchCoupling)
relax()
save(m)
saveas(m, "randommag")
Bmax := 14.0
Bstep := 0.1
MinimizerStop = 1e-6
FixDt = 1e-12
TableAdd(B_ext)
for B := 0.0; B <= Bmax; B += Bstep {
B_ext = vector(0.00001,B*sin(angle),B*cos(angle))
minimize()
tablesave()
save(m)
save(B_demag)
}
for B := Bmax; B >= -Bmax; B -= Bstep {
B_ext = vector(0.00001,B*sin(angle),B*cos(angle))
minimize()
tablesave()
save(m)
save(B_demag)
}
for B := -Bmax; B <= Bmax; B += Bstep {
B_ext = vector(0.00001,B*sin(angle),B*cos(angle))
minimize()
tablesave()
save(m)
save(B_demag)
}
save(m)
TableSave()