[nmag-users] some problems about the use of "load_m_from_h5file" in Nmag

54 views
Skip to first unread message

Guoqiang Xie

unread,
Nov 19, 2014, 7:28:57 AM11/19/14
to nmag-...@lists.soton.ac.uk
dear guys:
    I am a freshman of the Nmag software,and i think Nmag is a wonderful
software,but now i have some problems about the use of "load_m_from_h5file".
    The experiment contains two part,we use Gmsh to generate the magnetic
models.

part1:
    "A.geo" contains two Physical Volumes: volume 1 and volume 2,in "A.py"
we use "sim.save_restart_file" to save the results as the filename
"A_restart.h5".in part 1 there is no problem.

part2:
    "B.geo" contains the same two Physical Volumes: volume 1 and volume
2,compared to "A.geo" the position of volume 1 is same ,but the position of
volume 2 has changed,so in "B.py" when we want to load the magnetisation
from "A_restart.h5" which was created in part 1 by using the function
"save_restart_file",some problems happens,the program can not work.....  : (

    in fact, in part 2 we only want to load volume 1's results from the
part 1's simulation,and in "A.geo" and "B.geo" the shape and position of
volume 1 are the same ,the only change is the position of volume 2.

    i have referenced the example "2.21. Example: Spin transfer torque" (
http://nmag.soton.ac.uk/nmag/current/manual/html/example_zhangli1/doc.html
) from the Nmag manual,in example the part 1 and part 2 use the same
".nmesh.h5" file and positions of the volumes did not change,that is the
difference from my experiment

    i think there are must be some methods to solve my problems using Nmag
software,can you help me to solve the problems? Looking forward to your
reply,Thank you very much!

Best regards

         Guoqiang Xie


Fangohr H.

unread,
Nov 24, 2014, 9:35:42 AM11/24/14
to Guoqiang Xie, Fangohr H., nmag-...@lists.soton.ac.uk
Dear Guoqiang,
When the mesh changes, you cannot use the restart files any more: data is saved as one vector per mesh node, and as your mesh node order is different in the second geometry (probably not even the same number of nodes?), this fails.

You have two options:

(i) to write code that populates the new magnetisation based on the old one manually. Commands you can use are summarised at

http://nmag.soton.ac.uk/nmag/current/manual/singlehtml/manual.html#obtaining-and-setting-subfield-data

Conceptually, you have to create two simulation objects in the same file: the first one is the first geometry and allows you to read the data, the second is the new geometry, and you want to set m using set_m() in this simulation based on the m in the first simulation object.

(ii) Another option would be to create the second mesh using your own code from the first mesh, and just to translate the relevant nodes in space. You may find the ascii version of the nmesh format useful for this:

http://nmag.soton.ac.uk/nmag/current/manual/html/finite_element_mesh_generation.html#ascii-nmesh


Regards,

Hans


>
> Best regards
>
> Guoqiang Xie
>
>


Reply all
Reply to author
Forward
Message has been deleted
0 new messages