Save ovf2 avery time step

136 views
Skip to first unread message

Nikolai Khokhlov

unread,
Mar 8, 2023, 9:12:58 AM3/8/23
to Boris Computational Spintronics
Hi Serban!
It is a great software, more pleasant in use, compared to OOMMF, for me personally. 
But OOMMF has a schedule option for safe 3D magnetization distribution at every particular time step. In Boris I found it for images only with saveimagefile.
How to make the same for ovf2 files? I tried saveovf2, but it saves one state only.
My script in Python is:

ns.setode('LLG', 'RK4')
time_step =  50e-15
ns.setdt(time_step)
ns.editdatasave(0, 'time', time_step*100)
ns.saveovf2('text', output_file)
ns.run()

Serban Lepadatu

unread,
Mar 8, 2023, 10:34:16 AM3/8/23
to Boris Computational Spintronics, Nikolai Khokhlov
Hi Nikolai,

You have 2 options. 

1. Use command buffering (buffer the saveovf2mag command) - see v3.8 manual pt. 274, for exactly this example
2. Use embedded Python scripting mode which allows you to implement a custom data saving schedule with a function defined in Python (see end of Tutorial 9 on embedded Python scripting).

Regards,
Serban

--
You received this message because you are subscribed to the Google Groups "Boris Computational Spintronics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to boris-computational-s...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/boris-computational-spintronics/8fc69023-f4cc-4fef-b26c-dd18cc35188an%40googlegroups.com.

Nikolai Khokhlov

unread,
Mar 8, 2023, 10:56:02 AM3/8/23
to Boris Computational Spintronics
Thank you, Serban!
1st option works perfectly!

Art

unread,
Mar 15, 2023, 8:51:47 AM3/15/23
to Boris Computational Spintronics
Hi Nikolai,

How did you do it?. I currently use the following instructions:

ns.adddata('commbuf')
ns.editstagestop(0, 'time', 10e-9)
ns.editdatasave(0, 'time', 1e-10)
ns.saveovf2mag('Domain_%time%.ovf' , bufferCommand = True)

But it usually saves 3 files for each time step. For example, for t=1e-10, Boris saves files at times of 1.01e-10, 9.9e-11 and 1.023e-10.

Serban Lepadatu

unread,
Mar 15, 2023, 9:14:39 AM3/15/23
to Boris Computational Spintronics, Art
I'm guessing you're running this with the default RKF45 evaluation method? Since this is an adaptive time-step method, it will save at times as close as possible to the indicated 1e-10 saving increment.
If you want to guarantee saving only at those increments then switch to a fixed time-step method (RK4) with a suitable small enough time-step (setdt command).

Nikolai Khokhlov

unread,
Mar 15, 2023, 9:21:01 AM3/15/23
to Boris Computational Spintronics
Hi, Art!

I came to same thought. Try to fix time step. Here is my code:

ns.setdata('commbuf')
ns.editstagestop(0, 'time', total_time)
ns.setode('LLG', 'RK4')
time_step =  100e-15
ns.setdt(time_step)
ns.editdatasave(0, 'time', time_step*4)
ns.saveovf2mag('text', f'size_{dims}x{dims}um_mag_%time%.ovf', bufferCommand = True)


Nikolai Khokhlov

unread,
Mar 15, 2023, 9:23:49 AM3/15/23
to Boris Computational Spintronics
Just to know. I used Example 30 for Spinwaves as a base for my simulations (I also do in spinwaves area).

Art

unread,
Mar 24, 2023, 7:49:52 AM3/24/23
to Boris Computational Spintronics
Hi, 

I have been using RK4 with a fixed time step of 2e14. Boris usually saves multiple files for a similar time interval, the same happens when I use an adaptive solver (like RKF54). Perhaps the issue is that instead of using "ns.setdata('commbuf')", I used "ns.adddata('commbuf')".

thanks

Serban Lepadatu

unread,
Mar 24, 2023, 8:21:27 AM3/24/23
to Boris Computational Spintronics
Hi,

I haven't noticed a problem with this, but if you send me a code snippet which produces the problem I can investigate (could it be maybe files are left-over in the output directory from a previous simulation?).

setdata sets output data, deleting all previous entries, whilst adddata appends a new data field to output. Note, in the latest version there's a simpler method to declare all output data at once in a single line (see manual page 271).

Regards,
Serban

Art

unread,
Mar 24, 2023, 4:35:20 PM3/24/23
to Boris Computational Spintronics

Hi Serban,

For example, for the case of a domain wall driven by  a spin current density:

ns.addmodule ('Py', "transport")
ns.setparam ('Py', "P", 0.5)
ns.setparam ('Py', "beta", 0.1)
ns.setparam ('Py', "damping", 0.08)

ns.disabletransportsolver(1)

ns.setode('LLG', 'RK4')
ns.setdt(1e-14)

ns.setcurrentdensity('Py',1,0,0)
ns.loadovf2curr('Py','/home/zwt/Boris/DomainWall/J=5e11.ovf')

ns.setdata('commbuf')
ns.editstagestop(0, 'time', 50e-9)
ns.editdatasave(0, 'time', 2.0e-10)
ns.saveovf2mag('/home/zwt/Boris/DomainWall/J=5e11/DomainWall_%time%.ovf' , bufferCommand = True)

ns.cuda (1)
ns.Run ()

The simulations create the files: DomainWall_0s.ovf  DomainWall_199.98ps.ovf  DomainWall_199.99ps.ovf  DomainWall_200ps.ovf  DomainWall_399.99ps.ovf  DomainWall_400ps.ovf.  To run the simulation I use  /home/zwt/BorisLin -p 1001 -s  /home/zwt/Boris/DomainWall/tst.py &.

Serban Lepadatu

unread,
Mar 25, 2023, 5:27:42 AM3/25/23
to Boris Computational Spintronics, Art
Thanks, yes there is a problem when the time saving interval is much larger than the time step, resulting in multiple saves around the time saving point. I fixed it now, so will release an update soon. What you can do for now is save every given iterations (iter), since with fixed time-step you just multiply the iterations by the time-step to get the simulation time (or else save iter and time data as well in the output file).

Reply all
Reply to author
Forward
0 new messages