Skip to content

Commit

Permalink
[WIP] scalar and vector-valued Zhang Li u
Browse files Browse the repository at this point in the history
  • Loading branch information
lang-m committed Jun 9, 2024
1 parent 59db5fe commit e536a94
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions mumax3c/scripts/driver.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import numbers

import discretisedfield as df
import micromagneticmodel as mm
import numpy as np
Expand Down Expand Up @@ -52,16 +54,21 @@ def driver_script(driver, system, compute=None, ovf_format="bin4", **kwargs):

if system.dynamics.get(type=mm.ZhangLi):
(zh_li_term,) = system.dynamics.get(type=mm.ZhangLi)
u = (
zh_li_term.u
if isinstance(zh_li_term.u, df.Field)
else df.Field(
if isinstance(zh_li_term.u, df.Field):
raise RuntimeError("Setting Zhang Li u with a 'Fiel' is not supported.")
elif isinstance(zh_li_term.u, numbers.Real):
u = df.Field(
mesh=system.m.mesh,
nvdim=3,
value=(1.0, 0.0, 0.0),
norm=zh_li_term.u,
)
)
elif isinstance(zh_li_term.u, dict):
raise NotImplementedError(
"Setting Zhang Li u with a 'dict' is not yet supported."
)
else: # array_like
u = df.Field(mesh=system.m.mesh, nvdim=3, value=zh_li_term.u)

mu_B = mm.consts.e * mm.consts.hbar / (2.0 * mm.consts.me)

Expand Down

0 comments on commit e536a94

Please sign in to comment.