You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dear ubermag team @fangohr@marijanbeg
1st Calculate Spin Current Density Js then Calculate Charge Current Density Jc
after this spin polarisation eficiency = Js/Jc
∂m/∂t=−γ 0m×Heff+αm× ∂m/∂t+Ts
Js =− (γ0/μ0Ms)m×Heff
Jc=V/R
import oommfc as oc
import discretisedfield as df
import micromagneticmodel as mm
# 1. Set up the thin film geometry
Lx = Ly = 100e-9 # Film dimensions in the x and y directions (m)
thickness = 5e-9 # Film thickness (m)
cell_size = (5e-9, 5e-9, 5e-9) # Cell size (m)
mesh = df.Mesh(p1=(0, 0, 0), p2=(Lx, Ly, thickness), cell=cell_size)
# 2. Define the Hamiltonian
A = 1e-11 # Exchange constant (J/m)
K = 1e3 # Anisotropy constant (J/m^3)
Ms = 1.32e6 # Saturation magnetization (A/m)
H = (0, 0, 1e6) # External magnetic field (A/m)
exchange = mm.Exchange(A=A)
anisotropy = mm.UniaxialAnisotropy(K=K, u=(0, 0, 1))
zeeman = mm.Zeeman(H=H)
hamiltonian = exchange + anisotropy + zeeman
system = mm.System(name="thin_film")
system.hamiltonian = hamiltonian
# 3. Specify the dynamics
alpha = 0.1 # Gilbert damping parameter
gamma0 = 2.211e5
system.dynamics = mm.Precession(gamma0=gamma0) + mm.Damping(alpha=alpha)
# 4. Set up the initial magnetization configuration
def m_initial(pos):
x, y, z = pos
if z < thickness / 2:
return (1, 0, 0) # Magnetization pointing in the x-direction
else:
return (-1, 0, 0) # Magnetization pointing in the opposite x-direction
system.m = df.Field(mesh, nvdim=3, value=m_initial, norm=Ms)
# 5. Run the simulation
td = oc.TimeDriver()
td.drive(system, t=1e-9, n=100)
# 7. Calculate Spin and Charge Current Densities
mu0 = 4 * np.pi * 1e-7 # Permeability of free space (H/m)
# Calculate effective field
Heff = system.hamiltonian.effective_field(system.m)
# Calculate spin current density
Js = -gamma0 / (mu0 * Ms) * df.Field(mesh, value=np.cross(system.m.array, Heff))
# Calculate charge current density if applicable
# Replace the following with actual values from your simulation
V = 1 # Applied voltage (V)
R = 1 # Resistance of the device (Ohm)
Jc = V / R
print("Spin current density:", Js)
print("Charge current density:", Jc)
but it give error
`AxisError Traceback (most recent call last)
Cell In[18], line 8
5 Heff = system.hamiltonian.effective_field(system.m)
7 # Calculate spin current density
----> 8 Js = -gamma0 / (mu0 * Ms) * df.Field(mesh, value=np.cross(system.m.array, Heff))
10 # Calculate charge current density if applicable
11 # Replace the following with actual values from your simulation
12 V = 1 # Applied voltage (V)
File ~\miniconda3\envs\ubermag\Lib\site-packages\numpy\core\numeric.py:1588, in cross(a, b, axisa, axisb, axisc, axis)
1586 # Check axisa and axisb are within bounds
1587 axisa = normalize_axis_index(axisa, a.ndim, msg_prefix='axisa')
-> 1588 axisb = normalize_axis_index(axisb, b.ndim, msg_prefix='axisb')
1590 # Move working axis to the end of the shape
1591 a = moveaxis(a, axisa, -1)
AxisError: axisb: axis -1 is out of bounds for array of dimension 0`
please help me out i want to calculate value of Jc and Js as well as graph of it from where we can find the value of these Js and Jc.
The text was updated successfully, but these errors were encountered:
Running OOMMF (ExeOOMMFRunner)[2024/05/17 15:17]... (13.8 s)
Effective field (Heff) is None. Unable to calculate spin current density.
Effective field (Heff): None
Shape of system.m.array: (20, 20, 1, 3)
i hope this result you are asking. if anything else is needed please ask.
Dear ubermag team @fangohr @marijanbeg
1st Calculate Spin Current Density Js then Calculate Charge Current Density Jc
after this spin polarisation eficiency = Js/Jc
∂m/∂t=−γ 0m×Heff+αm× ∂m/∂t+Ts
Js =− (γ0/μ0Ms)m×Heff
Jc=V/R
but it give error
`AxisError Traceback (most recent call last)
Cell In[18], line 8
5 Heff = system.hamiltonian.effective_field(system.m)
7 # Calculate spin current density
----> 8 Js = -gamma0 / (mu0 * Ms) * df.Field(mesh, value=np.cross(system.m.array, Heff))
10 # Calculate charge current density if applicable
11 # Replace the following with actual values from your simulation
12 V = 1 # Applied voltage (V)
File ~\miniconda3\envs\ubermag\Lib\site-packages\numpy\core\numeric.py:1588, in cross(a, b, axisa, axisb, axisc, axis)
1586 # Check axisa and axisb are within bounds
1587 axisa = normalize_axis_index(axisa, a.ndim, msg_prefix='axisa')
-> 1588 axisb = normalize_axis_index(axisb, b.ndim, msg_prefix='axisb')
1590 # Move working axis to the end of the shape
1591 a = moveaxis(a, axisa, -1)
AxisError: axisb: axis -1 is out of bounds for array of dimension 0`
please help me out i want to calculate value of Jc and Js as well as graph of it from where we can find the value of these Js and Jc.
The text was updated successfully, but these errors were encountered: