Exemple #1
0
def __calculate_property_for_integral_points(elem: Element,
                                             univ_el: UniversalElement,
                                             layer_info: dict,
                                             property_name: str) -> list:
    property_for_ip = []  # table to collect property value for integral point
    pos_x_for_ip = []  # table to store real x position of integral point
    x_pos, _ = elem.points_coordinates_vector(
    )  # getting x coordinates of element nodes

    # calculating global pos of integral points(here only x coord)
    for shape_fun_vector in univ_el.N:
        pos_x_for_ip.append(
            np.dot(shape_fun_vector,
                   np.asarray([x_pos]).reshape(4, 1))[0])

    # now we go thought each layer and checking if ip is in specified layer
    for integral_id in range(len(univ_el.N)):
        act_layer_border = 0.
        for i, [layer_thickness, layer_properties] in enumerate(layer_info):
            if layer_thickness + act_layer_border >= pos_x_for_ip[
                    integral_id]:  # pos of first ip (most to left)
                property_for_ip.append(layer_properties[property_name])
                break
            else:  # element is in other layer, go next
                act_layer_border += layer_thickness

    return property_for_ip
Exemple #2
0
 def jacobian_matrix(self, element: Element, integral_point_id):
     jacobian = np.zeros(shape=(2, 2))  # creating matrix 2x2 from NumPy
     x_arr, y_arr = element.points_coordinates_vector(
     )  # creating list of nodes coordinates
     jacobian.itemset((0, 0),
                      np.dot(self.__dN_dksi_matrix[integral_point_id],
                             np.array([x_arr]).transpose())[0])  # dx_dksi
     jacobian.itemset((1, 0),
                      np.dot(self.__dN_deta_matrix[integral_point_id],
                             np.array([x_arr]).transpose())[0])  # dx_deta
     jacobian.itemset((1, 1),
                      np.dot(self.__dN_deta_matrix[integral_point_id],
                             np.array([y_arr]).transpose())[0])  # dy_deta
     jacobian.itemset((0, 1),
                      np.dot(self.__dN_dksi_matrix[integral_point_id],
                             np.array([y_arr]).transpose())[0])  # dy_dksi
     return jacobian