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])

    force = nodal_force(nodes=nodes, freedom=2, force_function=force_func)

    print("Evaluating boundary conditions...")
    for i in range(len(nodes)):
        if abs(l - nodes[i, 0]) < 0.0000001:
            assembly_initial_value(stiffness, force, 2 * i, 0.0)
            assembly_initial_value(stiffness, force, 2 * i + 1, 0.0)

    print("Solving a system of linear equations")
    x = spsolve(stiffness, force)

    u = x[0::2]
    v = x[1::2]
    print(min(u), " <= u <= ", max(u))
    print(min(v), " <= Y <= ", max(v))
    draw_vtk(nodes, elements, u, title="u", show_labels=True)
    draw_vtk(nodes, elements, v, title="v", show_labels=True)
예제 #2
0
        return array([0.0, 0.0, q, 0.0, 0.0])

    force = volume_force_quads(nodes=nodes,
                               elements=elements,
                               thickness=1.0,
                               freedom=freedom,
                               force_function=force_func,
                               gauss_order=3)

    print("Evaluating boundary conditions...")
    for i in range(len(nodes)):
        if (abs(nodes[i, 0] - 0) <
                0.0000001) or (abs(nodes[i, 0] - a) < 0.0000001) or (
                    abs(nodes[i, 1] - 0) < 0.0000001) or (abs(nodes[i, 1] - a)
                                                          < 0.0000001):
            assembly_initial_value(stiffness, force, freedom * i, 0.0)
            assembly_initial_value(stiffness, force, freedom * i + 1, 0.0)
            assembly_initial_value(stiffness, force, freedom * i + 2, 0.0)
            assembly_initial_value(stiffness, force, freedom * i + 3, 0.0)
            assembly_initial_value(stiffness, force, freedom * i + 4, 0.0)

    print("Solving a system of linear equations")

    x = spsolve(stiffness, force)

    w = x[2::freedom]
    theta_x = x[3::freedom]
    theta_y = x[4::freedom]
    print(min(w), " <= w <= ", max(w))
    print(min(theta_x), " <= theta x <= ", max(theta_x))
    print(min(theta_y), " <= theta y <= ", max(theta_y))