Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mumax3c HysteresisDriver #214

Open
samjrholt opened this issue Jul 19, 2022 · 3 comments
Open

Mumax3c HysteresisDriver #214

samjrholt opened this issue Jul 19, 2022 · 3 comments
Labels
backlog Good idea, has been added to our todo list. (No time to do it, though.) documentation feature request

Comments

@samjrholt
Copy link
Member

samjrholt commented Jul 19, 2022

Originally posted by @SeregaKR in #208 (comment)

Hello again.

I'm checking documentation about making hysteresis loops. It seems that the mumax3c module doesn't have this function from the box yet. It's possible to do this now in a roundabout way by setting Zeeman energy directly and doing minimize and relax functions afterward. But this is not described in examples and docs very well. The code below shows how I tried implementing it (I needed only the Bx component changed). The code is only for the virgin curve. But now, each step generates 2 files for each field (minimize and relax) which is a bit too much.

Bmin = -1e6
Bmax =  1e6
Bstep = 1e-2

md = mc.MinDriver()
rd = mc.RelaxDriver()

for B in range(0, Bmax+Bstep,Bstep):
    system.energy.zeeman.H = (B, 0, 0)
    rd.drive(system)
    md.drive(system)

and then the same can be done for the downward and upward curves. The corresponding code in mumax3 is also attached for reference.

Bmin := -1e6
Bmax :=  1e6
Bstep := 1e-2

for B:=0.0; B<=Bmax; B+=Bstep{
    B_ext = vector(B, 0, 0)
    minimize()
    relax()
    save(m_full)
    tablesave()
}

I hope that in the future, HysteresisDriver will be implemented from the box for mumax3. It took me an embarrassingly long time to find that you can set system.energy.zeeman.H

@samjrholt
Copy link
Member Author

Hi @SeregaKR, you are correct that mumax3c does not have a HysteresisDriver implemented. In the near future we were not looking to add this functionality as we are now trying to cover this in different ways which gives the users more control, for example in mag2exp. There is documentation on how to create a virgin hysteresis curve in the mag2exp documentation. https://ubermag.github.io/documentation/notebooks/mag2exp/DC_magnetometry.html

However, if you still feel there is a need for a HysteresisDriver in mumax3c then we can talk about the best ways to implement this. Thank you for attaching the Mumax3 code for this.

@SeregaKR
Copy link

@samjrholt, thank you for the reference - I will try using it. I suggested implementing this for consistency purposes. The oomfc has HysteresisDriver, but mumax3c does not. So if you want to switch from one engine to another, you need to change your approach, e.g., using mag2exp or the code I wrote above. But in the second case, you then need to go through all the steps and merge output for the minimize and relax functions. I believe we can do it by using this << binary operator.

@lang-m
Copy link
Member

lang-m commented Jul 22, 2022

Hi @SeregaKR thanks for bringing this up and for providing some code that can solve it. The consistency issue - running the same notebook with just changing the import line for the calculator (currently oommfc or mumax3c) - that you broad up in your last comment is a good point. There will always be some very package-specific details in the different calculators that we cannot really abstract away. However, the HysteresisDriver is quite general so we will have an internal discussion about supporting it inside mumax3c. Actually adding it might however take some time as we only have limited capacity.

@lang-m lang-m added feature request backlog Good idea, has been added to our todo list. (No time to do it, though.) documentation labels Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Good idea, has been added to our todo list. (No time to do it, though.) documentation feature request
Projects
None yet
Development

No branches or pull requests

3 participants