panic:interface conversion:ast.Expr is nil,not ast.FuncLit

450 views
Skip to first unread message

yuqing li

unread,
Dec 14, 2022, 3:39:44 AM12/14/22
to mumax2
Hello, everyone

I am getting the following error when running the code, which is not the first time the code has been run, it was working before. I have tried some other codes which also work fine, I don't know what is wrong and how to solve it, I am attaching the code I am running with the error below, is it a problem with the code?

I would be grateful if you could help me!
AF249D282F645926427FDF1051951F4C.png
li.txt

Felipe Garcia

unread,
Dec 14, 2022, 9:30:49 AM12/14/22
to mum...@googlegroups.com
Hi,

There are several problems with the code. First, it was edited with windows so it has hidden characters that can be interpreted as control characters. Then in the script there is

gamma=2.111e5

Gamma is a function so this will produce an error. In fact you are trying to set gamma0. But that is the function gamma. In mumax3 you can set gammall which has a value in rad/Ts which has the default value 1.76e11 rad/Ts, so it is not gammaLL.

Then, one has
anisU.SetRegion(1,randNorm())

In fact, it should be
anisU.SetRegion(1,vector(randNorm(),randNorm(),randNorm()))
or whatever variation. Anisu is a vector.

In fact, that is not the final problem.It one takes a look more carefully to the original code the problem comes from the following line:
anisU.SetRegion(1,randNorm())

The last parentheses is in fact the unicode character U+FF09. That is the Fullwidth Right Parenthesis". If you change this by the standard closing parenthesis, all the other problems appear. I think go interprets that as a strange pointer operation, that is the error originally reported.That error was introduced during the editing procedure.


Best regards,
Felipe


--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mumax2/4430aca0-d6ab-4d94-a3df-7e4994e9faa1n%40googlegroups.com.

yq li

unread,
Dec 14, 2022, 8:47:29 PM12/14/22
to mumax2
Dear Felipe,

Thank you very much for your answer, it helped me to solve my problem.

yq li

unread,
Dec 15, 2022, 9:19:22 PM12/15/22
to mumax2
Dear Felipe,

I took your advice and modified my code, the code works, but I still have a small question, as you can see, in the code I divided into two regions which have different saturation magnetization intensity Ms, and it is mentioned in the literature that region 2 has a volume fraction of 60-70%, I would like to know if the output magnetization intensity is calculated automatically inside mumax? When I don't add the code Msat=0.7*Msat2+0.3*Msat1, the output has some deviation from the literature, but when I add the code, the output is even more incorrect,.

I put the code and the output below and ask for your help, thank you very much!

Best regards,
Yuqing li
在2022年12月14日星期三 UTC+8 22:30:49<pkwgarcias> 写道:
18D874EB1C5CA7C829AAD2436B8E94F4.png
li.txt
table.txt

Felipe Garcia

unread,
Dec 16, 2022, 7:30:49 AM12/16/22
to mum...@googlegroups.com
Dear Yuqing Li,

I agree it is not very clear. The best way is to add the magnetization in regions to the table. One normally also wants to know independently the contribution of each layer.
This can be do adding to your script
TableAdd(m.Region(1))
TableAdd(m.Region(2))

Then one problem appears. One obtains NaN NaN NaN from region 2. That means there is a problem because no cell belongs to region 2. There is a problem with the geometry definition and I can not help you because I do not know your intentions but I guess it is because the cellsize is comparable to the size of the ellipsoid so it contains no cell. An ellipsoid of axis 10e-9 m, it is either a cube size 10e-9 m or nothing, when it is discretized with cells of 10 nm. Also I think that the ratio 30/70 should be calculated numerically to get a more accurate value.

Best regards,
Felipe

yq li

unread,
Dec 16, 2022, 8:37:39 AM12/16/22
to mumax2
Dear Felipe,
Thank you very much for your reply, the geometry in the literature is as followsB927911A-693F-459B-8383-B2B6A1B4EE17.png
I would like to define region 2 as the spherical particles and region 1 as the remainder. I don't have a very good grasp of geometric modelling of sub-regions yet and would be very happy to have your help!

Best regards,
Yuqing li

Felipe Garcia

unread,
Dec 16, 2022, 10:06:14 AM12/16/22
to mum...@googlegroups.com
Dear Yuqing Li,

To get an idea, the best thing is to represent a circle in 2D (in 3D will be more difficult to visualize but the problem is the same). If one wants to make a circle, the discretization has to be smaller than the diameter. One will never get the ideal circle. But it will be lego-like. As soon as one reduces the cell size then it resembles more to a real circle. However, there is a lower limit because, first the computational effort and second the numerical accuracy. Basically, I recommend you to try with 2 or 1 nm cellsize to see if it works for you. To represent in 3d the final geometry one can use paraview. To have an idea, one can take a look here. https://groups.google.com/g/mumax2/c/_fjsRoUu4so/m/7KNrysCCAgAJ
I recommend you to save(regions) and then use a Threshold filter in paraview to separate each region to see whether it makes sense. This is what I can suggest about your problem.

Best regards,
Felipe

Reply all
Reply to author
Forward
0 new messages