Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
    elif dir == 1:
        return math.sin(2.0 * math.pi * coords[0] / 8.0)
    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
Exemplo n.º 4
0
    dir=dof_name[1][0]
    if dir==0:
        return 0.0
    elif dir==1:
        return math.sin(2.0*math.pi*coords[0]/8.0)
    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