def print_field(): for i in range(1, 299): x = i * 0.01 probed = mag.probe([x]) m_y_fe = 0.0 m_y_dy = 0.0 if len(probed) == 2: m_y_fe = probed[1][1][1] m_y_dy = probed[0][1][1] elif len(probed) == 1: m_y_fe = probed[0][1][1] print "EDATA ", x, m_y_fe, m_y_dy for i in range(1, 200): #mag.advance_time([0.0,0.5,0.0],time=0.4) # apply an external field in +y direction mag.advance_time([0.0, 2.5, 0.0], steps=1000) print "Total magnetization(%d): " % i, mag.integrate() print "Energy(%d):" % i, mag.total_energy() nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M], 'data%05d.vtk' % i, mesh=mag.default_simulation_context.mesh) sys.stdout.flush() print_field() # ../bin/nsim exchange-spring-ord2.py | perl -ne 'BEGIN{open F, ">ord2.gdata"}END{close F} m/^EDATA (.*)/ and print F "$1\n"'
mag.set_magnetization(initial_M) def debugprint(n, stem, site, pos, val): print "N=", n, " name=", stem, " site=", site, " pos=", pos, " value=", val nfem.field_entry_wise(mag.default_simulation_context.field_m, debugprint) print mag.probe([0.1]) print mag.probe([0.2]) print mag.probe([0.3]) print mag.probe([0.4]) mag.advance_time([0.0, 0.0, 0.0], time=0.001) import nfem.visual nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M], 'data%05d.vtk' % 0, mesh=mag.default_simulation_context.mesh) for i in range(1, 40): mag.advance_time([0.0, 2.5, 0.0], time=0.5) # apply an external field in +y direction #mag.advance_time([0.0,0.0,0.0],steps=100) print "Total magnetization(%d): " % i, mag.integrate() print "Energy(%d):" % i, mag.total_energy() nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M],
# nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M],'data%05d.vtk' % 0,mesh=mag.default_simulation_context.mesh) def print_field(): for i in range(1,299): x=i*0.01 probed=mag.probe([x]) m_y_fe = 0.0 m_y_dy = 0.0 if len(probed)==2: m_y_fe=probed[1][1][1] m_y_dy=probed[0][1][1] elif len(probed)==1: m_y_fe=probed[0][1][1] print "EDATA ",x,m_y_fe,m_y_dy for i in range(1,400): #mag.advance_time([0.0,0.5,0.0],time=0.4) # apply an external field in +y direction mag.advance_time([0.0,2.5,0.0],steps=1000) print "Total magnetization(%d): " % i, mag.integrate() print "Energy(%d):" %i,mag.total_energy() # nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M],'data%05d.vtk' % i,mesh=mag.default_simulation_context.mesh) sys.stdout.flush() # nfem.field_entry_wise(mag.default_simulation_context.field_m,debugprint) # so that we have all the sites print_field() # ../bin/nsim exchange-spring-ord2.py | perl -ne 'BEGIN{open F, ">ord2.gdata"}END{close F} m/^EDATA (.*)/ and print F "$1\n"'
else: return math.cos(2.0*math.pi*coords[0]/8.0) mag.set_magnetization(initial_M) def debugprint(n,stem,site,pos,val): print "N=",n," name=",stem," site=",site," pos=",pos," value=",val nfem.field_entry_wise(mag.default_simulation_context.field_m,debugprint) print mag.probe([0.1]) print mag.probe([0.2]) print mag.probe([0.3]) print mag.probe([0.4]) mag.advance_time([0.0,0.0,0.0],time=0.001) import nfem.visual nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M],'data%05d.vtk' % 0,mesh=mag.default_simulation_context.mesh) for i in range(1,40): mag.advance_time([0.0,2.5,0.0],time=0.5) # apply an external field in +y direction #mag.advance_time([0.0,0.0,0.0],steps=100) print "Total magnetization(%d): " % i, mag.integrate() print "Energy(%d):" %i,mag.total_energy() nfem.visual.fields2vtkfile([mag.default_simulation_context.field_M],'data%05d.vtk' % i,mesh=mag.default_simulation_context.mesh)