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

RunWhile Support #83

Open
samjrholt opened this issue Mar 1, 2024 · 1 comment
Open

RunWhile Support #83

samjrholt opened this issue Mar 1, 2024 · 1 comment

Comments

@samjrholt
Copy link
Member

@SeregaKR suggested adding support for RunWhile in mumax3c in #81. We have a few questions on this topic.

  1. What conditions (and how many) does mumax3 support in RunWhile?
  2. Are any of these conditions already present in any way in micrimagneticmodel?
  3. Is it worth making this part of the TimeDriver rather than a separate driver?
  4. Can mumax3 combine multiple conditions with logic operators?

We do in general like the following suggestion:

td = mc.<...Driver>()
td.drive(system, condition="MaxTorque > 0.005")
@SeregaKR
Copy link
Contributor

SeregaKR commented Mar 1, 2024

Separated the previous pull request. RunWhile support is in #84

Waiting for a reply from colleagues. But by quick Googling, there are a few common scenarios that I think can be implemented directly:

  1. MaxTorque < some value
  2. mx or mz (probably also my) > some value. Here it is usually passed to mumax3 as m.comp(0) for mx or m.comp(3) for mz and applying average().
    RunWhile(m.Comp(3).average() > -0.94)
  3. These two cases are also often combined with a maximum time limit:
    RunWhile(m.Comp(3).average() > -0.94 && t < 5e-9)

I think we should have a parameter for the time limit, comparison (like > or <) and number. The question is should we have separate parameters for each magnetization component or just pass the name.

td.drive(system, t=5e-9, cmp=">", mz=-0.94) or td.drive(system, t=5e-9, cmp=">", p_value=-0.94, p_name="mz")

For other cases, we can just leave td.drive(system, condition="MaxTorque > 0.005") and pass it directly to mumax3.

As you can see, mumax3 here can work with logic operators. If we want to think about time limits, then probably it's not the best idea to implement it as a separate driver. Probably the best idea that requires minimal maintenance is to add a condition parameter for TimeDriver. And just dynamically separate the cases in the script. Not sure how many conditions RunWhile supports, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants