About the use of magneticelasticity expansion

343 views
Skip to first unread message

xuefeng zhang

unread,
Oct 6, 2023, 2:00:19 AM10/6/23
to mumax2
Dear all,

I wanted to perform simulations on magnetoelastic properties and installed the magnetoelastic properties extension following the steps in https://groups.google.com/g/mumax2/c/vJ6flBOmBrY/m/Gphq9eEKBwAJ.

But what should be done in the subsequent steps? I tried to simulate in C:\Users\public\go\src\github.com\mumax\3\cmd and it still showed that u=uniform(0,0,0) was undefined.
1-1.png2.png3.png
Hope to get advice.
Thanks

Josh Lauzier

unread,
Oct 6, 2023, 3:50:16 AM10/6/23
to mumax2
Hi,

In the second picture, it looks like the install did not finish completely. The lines that say "no required modules provide package" is an error message, and it will prevent finishing the compilation. I forget what exactly causes that particular error. I think it relates to your golang setup/version. (Also, I should note that there is a minor mistake in those instructions. You do not need step (o). In fact, if you have a clean install of golang 10.8, "go mod init" shouldn't work, as the go mod command was not added until version 11.1 . When I initially wrote that guide, I had a newer version of Golang that I downgraded to 10.8, so go mod init happened to work for me, and I didn't realize it was unnecessary. So that suggests you may have the wrong version of golang. It is possible to compile with newer versions of Golang but there are extra steps, and I don't remember them exactly. I was able to do it eventually but it took a lot of tweaking things). So what I would suggest is first verifying your go version, and then redo the steps, and see if that helps.

In the third picture, probably what is happening is that you're actually calling the normal (no magnetoelastic extension) copy of mumax. Usually this is because mumax is in your PATH variable. If the command doesn't find a mumax3.exe file in the current folder, it will check your PATH.

If it compiles successfully, your magnetoelastic version of mumax should be in ...go\bin, instead of ...go\src, unless you have a custom GOPATH.

If you're still having trouble, can you post the output of "go env"? That will help a lot with troubleshooting things like your go version.

Best,
Josh L.

xuefeng zhang

unread,
Oct 6, 2023, 4:05:49 AM10/6/23
to mumax2
Dear Josh,

Thank you very much for your reply, I chose to do the steps before step(o) with golang 1.10.8, then upgraded golang to the current version 1.21.1 and did steps (o) and (p).
And I just looked at the files under the /go/bin folder as shown in the second picture.

So should I fall back to golang 1.10.8 and do step (p) in this case?

4.png5.png

Best wishes

TuanG

unread,
Oct 6, 2023, 4:59:50 AM10/6/23
to mumax2
Dear all,

I have successfully installed the mumax3 coupled with magnetoelasticity module on my computer. I really want to simulate the effect of strain on the hysteresis loop. However, the hysteresis loops are exactly the same under different strains event I run simultaneously various strains at a time or separately. 
Here, I would like to attach the code i used. Could you please do me a favor by checking it.

With all the best,
A++

SetGridsize(128, 32, 4)
SetCellsize(4e-9, 4e-9, 4e-9)
setgeom(cuboid(512e-9, 128e-9, 16e-9))

Msat  = 1068918 //ok
Aex   = 1e-11 //ok
alpha = 0.05

m=Uniform(1,0,0)
u=Uniform(1,0,0)
du=Uniform (1,0,0)

//Elastics  parameters
c11 = 229e9 //ok
c12 = 134e9 //ok
c44 = 47.5e9 //ok, c44=(c11_c12)/2
rho = 7.2e3 //ok
eta = 0

//Magnetoelastic parameters
B1 = -9.975e5 // ok, lamda_100=-2/3*((B1)/(c11-c12)) and  lamda_111=-1/3*((B2)/(c44)),  lamda_100= lamda_111=lamda_s=-7e6
B2 = 9.975e5

FixedLayer = vector(1,0,0)
frozenDispLoc = 1
frozenDispVal = vector(1,0,0)
FreeLayerThickness = 15e-9

Bmax  := 100.0e-3
Bstep :=  2.0e-3
TableAdd(B_ext)

for B:=Bmax; B>2.0e-3; B-=5*Bstep{
ezz = -0.3
exx = 0.15
eyy = 0.15
    B_ext = vector(B, 0, B*0.001)
    tablesave()
save(m_full)
save(u)
save(ezz)
save(normstrain)
//SetSolver(5)
fixdt = 5e-13
//running
run(1e-9)
}
for B:=0.0; B>=-Bmax; B-=Bstep{
ezz = -0.3
exx = 0.15
eyy = 0.15
    B_ext = vector(B, 0, B*0.001)
    tablesave()
save(m_full)
save(u)
save(ezz)
save(normstrain)
//SetSolver(5)
fixdt = 5e-13
//running
run(1e-9)
}

for B:=Bmax; B>2.0e-3; B-=5*Bstep{
ezz = 0
exx = 0
eyy = 0
    B_ext = vector(B, 0, B*0.001)
    tablesave()
save(m_full)
save(u)
save(ezz)
save(normstrain)
//SetSolver(5)
fixdt = 5e-13
//running
run(1e-9)
}
for B:=0.0; B>=-Bmax; B-=Bstep{
ezz = 0
exx = 0
eyy = 0
    B_ext = vector(B, 0, B*0.001)
    tablesave()
save(m_full)
save(u)
save(ezz)
save(normstrain)
//SetSolver(5)
fixdt = 5e-13
//running
run(1e-9)
}

for B:=Bmax; B>2.0e-3; B-=5*Bstep{
ezz = 0.3
exx = -0.15
eyy = -0.15
    B_ext = vector(B, 0, B*0.001)
    tablesave()
save(m_full)
save(u)
save(ezz)
save(normstrain)
//SetSolver(5)
fixdt = 5e-13
//running
run(1e-9)
}
for B:=0.0; B>=-Bmax; B-=Bstep{
ezz = 0.3
exx = -0.15
eyy = -0.15
    B_ext = vector(B, 0, B*0.001)
    tablesave()
save(m_full)
save(u)
save(ezz)
save(normstrain)
//SetSolver(5)
fixdt = 5e-13
//running
run(1e-9)


Vào lúc 15:05:49 UTC+7 ngày Thứ Sáu, 6 tháng 10, 2023, xfzh...@gmail.com đã viết:

Josh Lauzier

unread,
Oct 6, 2023, 5:00:05 AM10/6/23
to mumax2
Hi,

Yes, if you stick with Go 1.10.8 for the whole process, it will avoid that particular error. Updating to a newer version of Golang will definitely cause that error, if no other changes are made.

The compilation can be done with Go 1.21.1 instead, if for some reason you need a newer Go version. But the steps will be slightly different. I did it at some point a few months ago, so I can confirm it can be done. But I don't remember the exact steps I took, because it took me several tests to get it, and I did not record the process. Ultimately, I think it involved updating the source code paths. So that everywhere that had something like "github.com/mumax/3/" instead became "github.com/Fredericvdv/Magnetoelasticity_MuMax3/", inside all the Go files (This is pretty easy to do in a program like notepad++. You can tell it to replace certain text in multiple files. So it is only one command and it will do it for all instances inside a folder). And also since you do this, you should not rename the folders, they should have the old Fredericvdv original names. That might be the only change, but I can't promise. There might be a few other tweaks I made that I don't recall.

I did just test it myself, and I was able to get it to compile with Go 1.21.1 without issues with just those changes to the source files mentioned above. 

Best regards,
Josh L.

xuefeng zhang

unread,
Oct 7, 2023, 8:12:07 AM10/7/23
to mumax2
Dear Josh
Thank you very much for your suggestion. 
I have also tried modifying the path under go1.21 and installing directly with go1.10.8. 
Now the problem still all exists in the last step. When go install, it is displayed as shown in the figure. So I would like to hear your suggestions.8.png

Best Wishes
Xuefeng Zhang

Josh Lauzier

unread,
Oct 10, 2023, 1:54:03 AM10/10/23
to mumax2
Hi,

I think that if it is still referencing modules as in that message, that Golang was not properly downgraded to 10.8 (modules were not added until later versions of Golang, so it can't use modules at all). When swapping back to 10.8, did you run the uninstaller for 1.21 first? Probably you did similar to what I did, and simply ran the 10.8 installer to overwrite 1.21 . I guess running the 10.8 installer does not properly fully uninstall newer versions (which is why my instructions had go mod init in it- because I hadn't properly downgraded to 10.8. There were remaining pieces of newer Golang related to modules despite using a 10.8 Golang. Which would not have happened had I used only 10.8 from the start). So instead, run the uninstaller for 1.21, and then the installer for 10.8. As a precaution, you can also delete the go.mod file- 10.8 should not need it. (You should also reverify what version of Go you're using using "go env" and "which go". But I suspect they may tell you 10.8 even though it is a mix of 10.8 and 1.21 files)

If you're still having issues, it might be easier to simply grab the precompiled binary that I linked in that previous thread here: https://github.com/JLauzier/MumaxMEBinary . Unless you need to modify the source code, compiling doesn't offer any advantages to simply using the precompiled binary, and it's a bit frustrating as you are seeing. The compiled version here was made with go 10.1 and Cuda 11.3. 

Cheers,
Josh L.

Gary Young

unread,
Jun 28, 2024, 7:12:21 PM6/28/24
to mumax2
Hi

I'm currently encountering a similar issue and was wondering if you've made any progress in resolving it since your last post. Any insights or suggestions you could share would be greatly appreciated.

Thank you in advance for your help.

Best regards,
Chenghao 杨承昊
Reply all
Reply to author
Forward
0 new messages