Ejemplo n.º 1
0
fig.scene.camera.position = [
    -0.5286122421224984, 7.073519564703222, 0.41797665332279077
]
fig.scene.camera.focal_point = [
    -0.023579024481236895, -0.11013972148999236, -0.008308510934655955
]
fig.scene.camera.view_angle = 30.0
fig.scene.camera.view_up = [
    -0.0037900187195243585, -0.05950183212861701, 0.9982210014477975
]
fig.scene.camera.clipping_range = [2.9170787976767643, 12.55754248035167]
fig.scene.camera.compute_view_plane_normal()
fig.scene.render()

mlab.show()

############### Create intial state ##############
st = State('closure_test', load=0)
st.items.append(wr)
#st.save()
##################################################

############## Run simulation engine #############
sim = MultiWireEngine(st, dt)

f = sim.forceScheme()[0]
print(f[:, 2].argmax(), f[:, 2].max())
##################################################

##################################################
Ejemplo n.º 2
0
path[:, 1] -= path[0, 1]
### Initialize mass
mass = np.ones((n, 1))

### Create wire
wr = Wire(path, path * 0, mass, I, r=1, Bp=1, is_fixed=False)
##################################################

############### Create intial state ##############
st = State('benchmark_single_wire', load=0)
st.items.append(wr)
#st.save()
##################################################

############## Run simulation engine #############
sim = MultiWireEngine(st, dt)
start_time = time.time()
for i in range(0, int(10 / dt)):
    new_st = sim.advance()
    if i % 50 == 0:
        ##        new_st.show()
        ##        mlab.show()

        myloop = new_st.items[0]
        forces = sim.forceScheme()[0]

        fig = plt.figure(0)
        plt.plot(forces[:, 0], forces[:, 2])

        fig = plt.figure(1)
        plt.plot(myloop.p[:, 0], myloop.p[:, 2], 'o-')
Ejemplo n.º 3
0
### Create wire 
wr = Wire(path,path*0,mass,I,r=r,Bp=1,is_fixed=False)
##################################################




############### Create intial state ##############
st = State('single_loop_test',load=0)
st.items.append(wr)
##################################################


############## Run simulation engine #############
sim = MultiWireEngine(st,dt)
X,Y,Z,dx,dy,dz = get_rect_grid([-2,2],[-1,1],[0.3,2],10)


for i in [0,0,0]:
    st.items[2].I = np.sin(i*pi/600.)
    sim.state = st
    bx,by,bz = sim.getB(X,Y,Z)
    st.show()
    Bsrc = mlab.pipeline.vector_field(X,Y,Z,bx,by,bz)
    Bmag = mlab.pipeline.extract_vector_norm(Bsrc)
    ##iso = mlab.pipeline.iso_surface(Bmag, opacity=0.3)
    ##vec = mlab.pipeline.vectors(Bsrc,scale_factor=1)
    streamline = mlab.pipeline.streamline(Bmag, seedtype='plane',
                                        seed_visible=False,
                                        seed_resolution=5,