fangohr / oommf

OOMMF source code in git repository
24 stars 7 forks source link

problema micromagnetico 3 #17

Closed carlosRios2020 closed 5 years ago

carlosRios2020 commented 5 years ago

Hola, alquien que haya hechos los problemas propuesto en la documentacion de joommf con oommf de micromagnetismo.

estoy haciendo el 3 este el el codigo que puse en jupyter notebook

import discretisedfield as df import oommfc as oc

import numpy as np

Function for initiaising the flower state.

def m_init_flower(pos): x, y, z = pos[0]/1e-9, pos[1]/1e-9, pos[2]/1e-9 mx = 0 my = 2z - 1 mz = -2y + 1 norm_squared = mx2 + my2 + mz**2 if norm_squared <= 0.05: return (1, 0, 0) else: return (mx, my, mz)

Function for initialising the vortex state.

def m_init_vortex(pos): x, y, z = pos[0]/1e-9, pos[1]/1e-9, pos[2]/1e-9 mx = 0 my = np.sin(np.pi/2 (x-0.5)) mz = np.cos(np.pi/2 (x-0.5))

return (mx, my, mz)

def minimise_system_energy(L, m_init): print("L={:9}, {} ".format(L, m_init.name), end="") N = 16 # discretisation in one dimension cubesize = 100e-9 # cube edge length (m) cellsize = cubesize/N # discretisation in all three dimensions. lex = cubesize/L # exchange length.

Km = 1e6  # magnetostatic energy density (J/m**3)
Ms = np.sqrt(2*Km/oc.mu0)  # magnetisation saturation (A/m)
A = 0.5 * oc.mu0 * Ms**2 * lex**2  # exchange energy constant
K = 0.1*Km  # Uniaxial anisotropy constant
u = (0, 0, 1)  # Uniaxial anisotropy easy-axis

p1 = (0, 0, 0)  # Minimum sample coordinate.
p2 = (cubesize, cubesize, cubesize)  # Maximum sample coordinate.
cell = (cellsize, cellsize, cellsize)  # Discretisation.
mesh = oc.Mesh(p1=(0, 0, 0), p2=(cubesize, cubesize, cubesize),
               cell=(cellsize, cellsize, cellsize))  # Create a mesh object.

system = oc.System(name="stdprob3")
system.hamiltonian = oc.Exchange(A) + oc.UniaxialAnisotropy(K, u) + oc.Demag()
system.m = df.Field(mesh, value=m_init, norm=Ms)

md = oc.MinDriver()
md.drive(system, overwrite=True)

return system

%matplotlib inline system = minimise_system_energy(8, m_init_vortex) system.m.plot_plane("y")

system = minimise_system_energy(8, m_init_flower) system.m.plot_plane("x")

me esta botando este error si alguien me puede ayudar o le a pasado antes agradezco mucho la ayuda

PermissionError Traceback (most recent call last)

in 54 55 get_ipython().run_line_magic('matplotlib', 'inline') ---> 56 system = minimise_system_energy(8, m_init_vortex) 57 system.m.plot_plane("y") 58 in minimise_system_energy(L, m_init) 49 50 md = oc.MinDriver() ---> 51 md.drive(system, overwrite=True) 52 53 return system ~/miniconda3/lib/python3.6/site-packages/oommfc/drivers/driver.py in drive(self, system, **kwargs) 22 # Save system's magnetisation configuration omf file. 23 omffilename = filenames["omffilename"] ---> 24 system.m.write(omffilename) 25 26 miffilename = filenames["miffilename"] ~/miniconda3/lib/python3.6/site-packages/discretisedfield/field.py in write(self, filename, **kwargs) 333 def write(self, filename, **kwargs): 334 if any([filename.endswith(ext) for ext in [".omf", ".ovf", ".ohf"]]): --> 335 self._writeovf(filename, **kwargs) 336 elif filename.endswith(".vtk"): 337 self._writevtk(filename) ~/miniconda3/lib/python3.6/site-packages/discretisedfield/field.py in _writeovf(self, filename, representation) 403 "End: Segment"] 404 --> 405 f = open(filename, "w") 406 407 # Write header lines to OOMMF file. PermissionError: [Errno 13] Permission denied: 'stdprob3/m0.omf'
marijanbeg commented 5 years ago

Hi @musgo2015,

Thank you for you question. As I understand from the code you posted (unfortunately, I do not speak Spanish), you have an issue with JOOMMF. Can I ask you to translate your question in English and post it as an issue in the https://github.com/joommf/help repository.

I will close this issue here and wait for its English version in https://github.com/joommf/help repository.

Many thanks!