예제 #1
0
n = shape(nodes)[0]                 #Number of nodes      
bc_lines = elements[1]      # Boundary condition is (bc) lines
triangles = elements[2]

potential = potential_2d('well', nodes, v0 = 2)



write_solver_input(glo_tag +'.msh', parameter = potential, dimension = 2, \
                   bc_type = 'Dir', \
                   sol_type = 'Stationary', eq = 'Schro', \
                   analysis_param = ['y', 'y', 4, 20, 15, 15, 1], \
                   bc_filename = glo_tag+'.bc')

k = read_solver_input(glo_tag +'.msh')
v, solution = schroedinger(glo_tag +'.msh')
triangles = substract_1(triangles)
triangles = triangles[:, 1:]

#k, solution = schroedinger(glo_tag +'.msh')
#z = zeros((k[0].shape[0], 3))
#print k[0].shape, z[:, 0:1].shape
#z[:, 0:2] = k[0]
#nodes = z
#triangles = k[1]
 
print v
write_vtk(glo_tag + '_1.vtk', 'this shit', '', nodes, triangles, \
            ['SCALARS', ['solution'], [solution]])
            
예제 #2
0
파일: test_1d.py 프로젝트: bebopsan/peyeQM
from math import pi
import numpy as np
from PostPro import plot_1d 
from time import time 

t0 = time()
nodes, elements = Mesh1D('simple',0,2*pi)

write_msh('lineSimple.msh', nodes, elements)

pot = Potential1D('well', nodes, V0=2)

write_solver_input('lineSimple.msh', parameter = pot, bc_type = 'Bloch',\
                      analysis_param = ['y', 'y', 4, 4, 50, 50, 1])

v, d = schroedinger('lineSimple.msh')
tf = time()
z = np.zeros((nodes.size, 3))
z[:, 0] = nodes
nodes = z
#write_vtk('test.vtk', 'thi shit', '', nodes, elements, \
#            ['SCALARS', ['Pot', 'Psi'], [pot, d]])
plot_1d('', nodes = nodes,elements = elements, parameter = pot, bc_type = 'Dir', \
         sol = d)
print 'time elapsed: \n', tf-t0, 'seconds'
##Nodes=Nodes[:,0]
##WriteMSH('lineSimple.msh',Nodes,Elems)
##Nodes,Elems=ReadVTK('test.vtk')


##Schroedinger('lineSimple.msh')
예제 #3
0
triangles = elements[2]

potential = potential_2d("well", nodes, v0=0)
write_solver_input(
    glo_tag + ".msh",
    parameter=potential,
    dimension=2,
    bc_type="Dir",
    sol_type="Stationary",
    eq="Schro",
    analysis_param=["y", "y", 20, 20, 15, 15, 1],
    bc_filename=glo_tag + ".bc",
)

k = read_solver_input(glo_tag + ".msh")
v, solution = schroedinger(glo_tag + ".msh")
triangles = substract_1(triangles)
triangles = triangles[:, 1:]

# k, solution = schroedinger(glo_tag +'.msh')
# z = zeros((k[0].shape[0], 3))
# print k[0].shape, z[:, 0:1].shape
# z[:, 0:2] = k[0]
# nodes = z
# triangles = k[1]

print v
write_vtk(glo_tag + "_dir.vtk", "this shit", "", nodes, triangles, ["SCALARS", ["solution"], [solution]])
print solution.shape
sol = test_sol(nodes, pi, 3 * pi)
write_vtk(glo_tag + "_sol.vtk", "this shit", "", nodes, triangles, ["SCALARS", ["sol"], [sol]])