示例#1
0
# Mesh info read in

#mesh = '../mesh/mesh_nodes_mini.txt'
#connect = '../mesh/mesh_connectivity_mini.txt'
#sides = '../mesh/sides_mini.txt'

#mesh = '../mesh/mesh_test.txt'
#connect = '../mesh/connect_test.txt'
#sides = '../mesh/sides_test.txt'

mesh = 'basic.txt'
connect = 'basic_con.txt'
sides = 'basic_sides.txt'

mesh, con_mat, top, left, bottom, right = read_in(mesh, connect, sides)
#print(bottom)
#running of code!

dim = 5

K, F = assemble(con_mat, mesh)
#i_vals,j_vals,v_vals,F = assemble_ijv(con_mat,mesh)
#BC_vals = np.zeros(dim) #set top EBC to zero
#BC_vals = np.zeros(8)
#for i in range(len(BC_vals)):
# BC_vals[i] +=5
#BC_vals = [1]
#boundary = bottom+top
#BC_vals = [10,10,10,0,0,0]
boundary = top + left + bottom + right
示例#2
0
i_vals,j_vals,v_vals = assemble_ijv(np.array([[0,1,4,3],[1,2,5,4]]),coord_mat)


file = open('../outputs/ijv.txt','w')
count = 0

while (count < len(i_vals)):
    if count != 0:
        file.write('\n')
    file.write(str(i_vals[count])+" "+str(j_vals[count])+" "+str(v_vals[count]))
    count += 1
file.close()


'''
'''
mesh = '../mesh/mesh_nodes_mini.txt'
connect = '../mesh/mesh_connectivity_mini.txt'
sides = '../mesh/sides_mini.txt'
read_in(mesh,connect,sides)

total_nodes = len(mesh)
K = assemble(connect,mesh)
file = open('../outputs/K.txt','w')
for i in range(total_nodes):
    if i != 0:
        file.write('\n')
    for j in range(total_nodes):
        file.write(str(K[i, j]))
        file.write(" ")
file.close()