ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

External field/STT term dependent on system mx/my/mz #218

Closed fgr1986 closed 2 years ago

fgr1986 commented 2 years ago

Hi,

I would like to know if it could be possible to define a field/current density function that can have not only a time dependency but a magnetization dependency.

For example, define H within Zeeman energy term as dependent on the current magnetization.

Thank you very much for all the work on the framework, Regards

fangohr commented 2 years ago

That is not possible as far as I can see. Ubermag uses OOMMF and mumax3 as the 'micromagnetic calculators' to solve the numeric problem, and as far as I know, they lack this feature.

fgr1986 commented 2 years ago

Thanks, @fangohr

Does the driver expose the time/magnetization? if that would be the case, maybe it could be able to write something like:

...
system = mm.System(name="stt_example")
...
driver = ....
...

def h_fn(t, driver=driver):
    return driver.magnetization()
....
zeeman = mm.Zeeman(H=Hx, func=h_fn)
system.energy += zeeman
....
fangohr commented 2 years ago

At the Python level all of this can be arranged fairly easily. The difficulty is in passing that information to the micromagnetic calculators efficiently (either because they have not got the functionality - that's a complete blocker then - or because the translation of the Python domain specific language you are proposing to the micromagnetic calculator language is non trivial. I think neither OOMMF nor mumax3 can apply a Zeeman field that varies as a function of the local magnetisation. [If anyone knows better, please shout.])

If your magnetisation changes very slowly in time, you could have a for-loop at the (Python) Ubermag level, in which you set the Zeeman field H1 as you like (and you have access to the magnetisation here to compute the Zeeman field as required), and ask OOMMF/mumax3 to carry out the time integration for some time interval T1 (during which the Zeeman field will be constant).

After this interval T1, you get the control back in Ubermag, can update the Zeeman field H2; taking into account the magnetisation as it is now; and then start the next time integration T2 (during which H2 will be constant). You can make the time intervals T_i as short as you need, but the overall execution performance will be the poorer the smaller the T_i is (because the jumping between the Ubermag Python level and the execution in the micromagnetic calculators is slow).

fgr1986 commented 2 years ago

That approach might help.

Thanks a lot for the suggestion :)