def script_mesh(mesh): mesh = meshio.read("files/dam_param.msh") points = mesh.points cells = mesh.cells point_data = mesh.point_data cell_data = mesh.cell_data field_data = mesh.field_data nodes_array = msh.node_writer(points, point_data) nf, els1_array = msh.ele_writer(cells, cell_data, "triangle", 100, 3, 0, 0) nini = nf nf, els2_array = msh.ele_writer(cells, cell_data, "triangle", 200, 3, 1, nini) els_array = np.append(els1_array, els2_array, axis=0) nodes_array = msh.boundary_conditions(cells, cell_data, 2000, nodes_array, -1, 0) nodes_array = msh.boundary_conditions(cells, cell_data, 1000, nodes_array, 0, -1) np.savetxt("files/Deles.txt", els_array, fmt="%d") np.savetxt("files/Dnodes.txt", nodes_array, fmt=("%d", "%.4f", "%.4f", "%d", "%d")) return
@authors: Juan Gomez Nicolas Guarin-Zapata """ from __future__ import division, print_function import numpy as np import meshio import solidspy.preprocesor as msh # Read the mesh file points, cells, point_data, cell_data, field_data = \ meshio.read("bridge.msh") # Create elements nodes_array = msh.node_writer(points, point_data) nf, els1_array = msh.ele_writer(cells, cell_data, "triangle", 10000, 3, 0, 0) nf, els2_array = msh.ele_writer(cells, cell_data, "triangle", 20000, 3, 1, nf) els_array = np.append(els1_array, els2_array, axis=0) # Create nodes nodes_array = msh.boundary_conditions(cells, cell_data, 100, nodes_array, 0, -1) nodes_array = msh.boundary_conditions(cells, cell_data, 200, nodes_array, -1, 0) cargas = msh.loading(cells, cell_data, 300, 0.0, -1.0e6) # Save files np.savetxt("eles.txt", els_array, fmt="%d") np.savetxt("loads.txt", cargas, fmt=("%d", "%.6f", "%.6f")) np.savetxt("nodes.txt", nodes_array, fmt=("%d", "%.4f", "%.4f", "%d", "%d"))
] nodes_line = lines[id_carga] nodes_line = nodes_line.flatten() nodes_line = list(set(nodes_line)) line_x = points[nodes_line][:, 0] line_y = points[nodes_line][:, 1] return nodes_line, line_x, line_y # Read mesh file archivo = "dam.msh" points, cells, point_data, cell_data, field_data = meshio.read(archivo) # Elements nodes_array = msh.node_writer(points, point_data) nf, els_array = msh.ele_writer(cells, cell_data, "triangle", 3, 3, 0, 0) # Nodes nodes_array = msh.boundary_conditions(cells, cell_data, 1, nodes_array, -1, -1) # Loads carga_mag = 40.0 nodes_line, x_load, y_load = locate_pts_line(2, points) load_x = y_load - 40 load_y = 0.0 cargas = msh.loading(cells, cell_data, 2, load_x, load_y) # Materials materiales = np.array([[200000.0, 0.3]]) # Save files