from numpy import array l = 10.0 # beam half-length c = 2.0 # beam half-height e = 203200.0 # Young's modulus nu = 0.27 # Poison's modulus q = 100.0 # uniformly distributed load n = 51 # nodes in the first direction of computational domain m = 21 # nodes in the second direction of computational domain d = plane_strain_isotropic(e, nu) print(d) (nodes, elements) = rectangular_quads(x_count=n, y_count=m, x_origin=0.0, y_origin=-c, width=l, height=2.0 * c) stiffness = assembly_quads_stress_strain(nodes=nodes, elements=elements, thickness=1.0, elasticity_matrix=d) print("Evaluating force...") def force_func(node): if abs(node[0]) < 0.0000001: return array([0.0, -q / m]) else: return array([0.0, 0.0])
from assembly2d import assembly_quads_mindlin_plate from assembly2d import assembly_initial_value from stress_strain_matrix import plane_stress_isotropic from force import volume_force_quads from scipy.sparse.linalg import spsolve from numpy import array a = 1.0 # A side of a square plate h = 0.01 # A thickness of a square plate e = 203200.0 # The Young's modulus nu = 0.3 # The Poisson's ratio q = 0.05 # A load intensity n = 201 (nodes, elements) = rectangular_quads(x_count=n, y_count=n, x_origin=0.0, y_origin=0., width=a, height=a) stiffness = assembly_quads_mindlin_plate(nodes, elements, h, plane_stress_isotropic(e, nu)) print("Evaluating force...") def force_func(node): return array([q, 0.0, 0.0]) force = volume_force_quads(nodes=nodes, elements=elements, thickness=1.0, freedom=3,
from mesh2d import rectangular_quads from mesh2d import draw_vtk from assembly2d import assembly_quads_stress_strain from stress_strain_matrix import plane_strain_isotropic from numpy import zeros from scipy.sparse.linalg import spsolve l = 10.0 # beam half-length c = 2.0 # beam half-height e = 203200.0 # Young's modulus nu = 0.27 # Poison's modulus q = 100.0 # uniformly distributed load n = 51 # nodes in the first direction of computational domain m = 21 # nodes in the second direction of computational domain d = plane_strain_isotropic(e, nu) print(d) (nodes, elements) = rectangular_quads(x_count=n, y_count=m, x_origin=0.0, y_origin=-c, width=l, height=2.0 * c) stiffness = assembly_quads_stress_strain(nodes, elements, d) dimension = stiffness.shape[0] force = zeros(dimension) for i in range(len(nodes)): if abs(nodes[i, 0]) < 0.0000001: force[2 * i + 1] = -q / m for i in range(len(nodes)): if abs(l - nodes[i, 0]) < 0.0000001: for j in range(dimension): if stiffness[2 * i, j] != 0.0: stiffness[2 * i, j] = 0.0 if stiffness[j, 2 * i] != 0.0: stiffness[j, 2 * i] = 0.0 if stiffness[2 * i + 1, j] != 0.0: stiffness[2 * i + 1, j] = 0.0
from numpy import array, zeros, ix_ from quadrature import legendre_quad a = 10.0 # A side of a square plate factor = 3.0 b = a / factor h = a / 100.0 # A thickness of a square plate e = 1.0 # The Young's modulus nu = 0.3 # The Poisson's ratio alpha = 1.0E-4 n = 21 freedom = 5 d = plane_stress_isotropic(e, nu) (nodes, elements) = rectangular_quads(x_count=n, y_count=int(n / factor), x_origin=0.0, y_origin=0., width=a, height=b) stiffness = assembly_quads_mindlin_plate_laminated(nodes, elements, [h], [d]) print("Evaluating force...") force = thermal_force_plate_5(nodes=nodes, elements=elements, thicknesses=[h], elasticity_matrices=[d], alpha_t=alpha) # print("Evaluating boundary conditions...")
# if stiffness[position, j] != 0.0: # stiffness[position, j] = 0.0 # if stiffness[j, position] != 0.0: # stiffness[j, position] = 0.0 stiffness[position, position] = 1.0 force[position] = value if __name__ == "__main__": from mesh2d import rectangular_quads from mesh2d import rectangular_triangles from plot_coo_matrix import plot_coo_matrix d = array([[1., 1., 0.], [1., 1., 0.], [0., 0., 1.]]) (nodes, elements) = rectangular_quads(x_count=51, y_count=11, x_origin=-10.0, y_origin=-2.0, width=20.0, height=4.0) global_matrix = assembly_quads_stress_strain(nodes, elements, d) plot_coo_matrix(global_matrix) (nodes, elements) = rectangular_triangles(x_count=51, y_count=11, x_origin=-10.0, y_origin=-2.0, width=20.0, height=4.0) global_matrix = assembly_triangles_stress_strain(nodes, elements, d) plot_coo_matrix(global_matrix) (nodes, elements) = rectangular_quads(x_count=31, y_count=31, x_origin=0.0,
]) bt = b.conj().transpose() local = local + bt.dot(strain_stress_matrix).dot(b) * jacobian * w[i] for i in range(element_dimension): ii = elements[element_index, i / freedom] * freedom + i % freedom for j in range(i, element_dimension): jj = elements[element_index, j / freedom] * freedom + j % freedom global_matrix[ii, jj] += local[i, j] if i != j: global_matrix[jj, ii] = global_matrix[ii, jj] print_progress(element_index, elements_count - 1) print "\nAssembly is completed" return global_matrix if __name__ == "__main__": from numpy import array from mesh2d import rectangular_quads from mesh2d import rectangular_triangles from plot_coo_matrix import plot_coo_matrix d = array([ [1., 1., 0.], [1., 1., 0.], [0., 0., 1.] ]) (nodes, elements) = rectangular_quads(x_count=51, y_count=11, x_origin=-10.0, y_origin=-2.0, width=20.0, height=4.0) global_matrix = assembly_quads_stress_strain(nodes, elements, d) plot_coo_matrix(global_matrix) (nodes, elements) = rectangular_triangles(x_count=51, y_count=11, x_origin=-10.0, y_origin=-2.0, width=20.0, height=4.0) global_matrix = assembly_triangles_stress_strain(nodes, elements, d) plot_coo_matrix(global_matrix)