Exemple #1
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
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"))
np.savetxt("mater.txt", materiales)
Exemple #2
0
@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"))
Exemple #3
0
@authors: Juan Gomez
         Nicolas Guarin-Zapata
"""
from __future__ import division, print_function
from os import sys
sys.path.append('../../MAIN/')
import meshio
import solidspy.preprocesor as msh
import numpy as np
import postprocesor as pos

#
points, cells, point_data, cell_data, field_data = \
    meshio.read("prueba.msh")
#
nodes_array    = msh.node_writer(points , point_data)
nf , els1_array = msh.ele_writer(cells , cell_data , "triangle" , 1000 , 3 , 0 , 0)
nini = nf
nf , els2_array = msh.ele_writer(cells , cell_data , "triangle" , 2000 , 3 , 1 , nini)
els_array =np.append(els1_array , els2_array , axis = 0)
#
nodes_array = msh.boundary_conditions(cells , cell_data , 100 , nodes_array , -1 , -1)

cargas      = msh.loading(cells , cell_data , 300 , 0.0 , 10.0)
#
salida = pos.respuesta(cells, cell_data, 500)
#
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"))
np.savetxt("salida.txt" , salida      , fmt="%d")