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

Zeeman "func" error #198

Closed
Ponsudana opened this issue Mar 12, 2022 · 9 comments · Fixed by ubermag/oommfc#88
Closed

Zeeman "func" error #198

Ponsudana opened this issue Mar 12, 2022 · 9 comments · Fixed by ubermag/oommfc#88
Assignees
Labels
bug A bug in Ubermag

Comments

@Ponsudana
Copy link

Hello Ubermag team,

I tried to define a circularly polarized field as expressed by,
equation
I got an error as "local variable 'mif' referenced before assignment" when defining both cos and sin function.
When using the predefined sin function as func='sin', the OOMMF run was successful, but the field direction is different for the defined cos function.
Field.zip
Both the notebooks are attached and any comments on this will be helpful.
Thank you,
Regards,
Ponsudana

@lang-m
Copy link
Member

lang-m commented Mar 14, 2022

Hi @Ponsudana
thanks for reporting your problems. You have discovered two bugs in oommfc when using multiple time-dependent fields (or currents) simultaneously.

@lang-m lang-m added the bug A bug in Ubermag label Mar 14, 2022
@lang-m lang-m self-assigned this Mar 14, 2022
@Ponsudana
Copy link
Author

Hi @lang-m
Thank you for your response. May I know when this bug will be fixed?

lang-m added a commit to ubermag/oommfc that referenced this issue Mar 14, 2022
@lang-m lang-m added the in progress Addressed in an open PR label Mar 14, 2022
@lang-m lang-m removed the in progress Addressed in an open PR label Mar 15, 2022
@Ponsudana
Copy link
Author

Hello @lang-m
Should I wait for the next updated ubermag version for this bug to be resolved? How can I run my programs without this error?
Thank you,

@lang-m
Copy link
Member

lang-m commented Mar 16, 2022

Hi @Ponsudana
Please wait for the next release. We are already working on it and plan to finish the release by tomorrow evening. I'll send another message.

@Ponsudana
Copy link
Author

Hi @lang-m
Thank you for the update.

@lang-m
Copy link
Member

lang-m commented Mar 17, 2022

@Ponsudana ubermag version 0.61.2 is now available on conda-forge (and PyPI).

@Ponsudana
Copy link
Author

Hi @lang-m
I've updated the ubermag version. Thank you so much for the quick update.
Now, the Zeeman terms are defined correctly as per sin and cos functions.
But, there is no change in the magnetization dynamics.
I've attached my notebooks.
Field_new.zip

Is something wrong with my program?
While defining Zeeman, dt is the time steps in seconds. So, if I wish to drive the system for 1ns in 200 steps, dt=5ps. Is this correct definition for dt in mm.Zeeman(H=H1, func=cos_wave, dt=5e-12, name= 'zeeman1')?

@lang-m
Copy link
Member

lang-m commented Mar 21, 2022

Hi @Ponsudana
The definition of dt is independent of the number of timesteps used in the timedriver (and completely unrelated). It defines a "resolution" at which your function defining the time dependency is sampled (only those samples are then forwarded to OOMMF). Typically, you would use a (much) smaller value for dt. The value mostly depends on how fast your function is changing (as we internally numerically compute derivatives and the simulation works best if these derivative values do not become too big). Try maybe with a starting point around dt=1e-12 - dt=1e-13. A good indication for a too large value would be if your simulation gets stuck at some point during the time evolution.

In your notebook you have only defined system.energy but subsequently you run the TimeDriver. You have to also define system.dynamics if you want to use the TimeDriver.

@Ponsudana
Copy link
Author

Hi @lang-m
Thanks for the clear explanation about dt.
I was focusing on energy terms and forgot to define the dynamics.
Thanks for pointing that out.

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

Successfully merging a pull request may close this issue.

2 participants