for u in frange(u_start,u_end,du): for v in frange(v_start,v_end,dv): bool_run=False if elem_type==2: if u<1.00001-v: bool_run=True if elem_type==3: bool_run=True if bool_run: N=shape_functions.get_face_shape_function(elem_type,u,v) # print(N) Wuv=np.zeros((2,1)) Wuv[0,0]=N[whichFace,0] Wuv[1,0]=N[whichFace,1] uv=np.zeros((2,1)) uv[0,0]=u uv[1,0]=v xy_plot.append(uv) B_list.append(Wuv) #=============================================================================== # PLot file_names=File_names() results_folder=file_names.get_results_folder_name() results_path=os.path.join(folder_path,results_folder)
# area_elem=operations.get_area_element(this_elem_type,this_element_nodes,nodes_coordenates) wtri=get_gauss_points_class.get_integration_weight(this_elem_type) # integdudv=shape_functions.get_reference_element_area(this_elem_type) mu_elem=vacuum.mu0*materials_lib[region_ID_list[elem_counter]].Permeability # Get W at reference element w_local_this_element=list() #[gauss point][face] for each_integ_point in range(0,number_integ_points): #u,v coordinates u=gauss_points[each_integ_point,0] v=gauss_points[each_integ_point,1] # Shape functions @ reference element w_local_this_point=shape_functions.get_face_shape_function(this_elem_type,u,v) w_local_this_element.append(w_local_this_point) # Shape functions @ real element for each face w_real_all_points=list() # w_real_lista[0] contains the shape function of all points for face 0 # Face 0...Fn #P0 W #Pn for face_counter in range(0,number_local_faces): w_real_this_point=list() for point_counter in range(0,number_integ_points): w_local=w_local_this_element[point_counter][face_counter] w_real=operations.convert_local_real_Piola(this_elem_type,w_local[0,0],w_local[0,1],this_element_nodes,nodes_coordenates) w_real_this_point.append(w_real) w_real_all_points.append(w_real_this_point)
def Create_B_vector_plot( elem_tags_2D, tags_plot, elem_type_2D, faces_ID, new_flux, results_path, elem_nodes, nodes_coordenates, faces_list ): """ """ file_names = File_names() B_list = list() xy_plot = list() get_gauss_points_class = GaussPoints() shape_functions = ShapeFuncions() number_elements = len(elem_type_2D) operations = Operations() for elem_counter in range(0, number_elements): run_this_element = False if tags_plot == "all": run_this_element = True else: if elem_tags_2D[elem_counter][0] in tags_plot: run_this_element = True if run_this_element: this_elem_type = elem_type_2D[elem_counter] number_local_faces = shape_functions.get_number_faces(this_elem_type) gauss_points = get_gauss_points_class.get_gauss_points(this_elem_type) gauss_points = get_gauss_points_class.get_local_element_center_point(this_elem_type) number_integ_points = 1 # number_integ_points=len(gauss_points) this_element_nodes = elem_nodes[elem_counter] faces_ID_Elem = faces_ID[elem_counter] for each_integ_point in range(0, number_integ_points): u = gauss_points[each_integ_point, 0] v = gauss_points[each_integ_point, 1] xy_coord = operations.convert_local_real(this_elem_type, u, v, this_element_nodes, nodes_coordenates) xy_plot.append(xy_coord) w_local_this_point = shape_functions.get_face_shape_function(this_elem_type, u, v) b_at_point = 0 for local_face_counter in range(0, number_local_faces): face_ID = faces_ID_Elem[local_face_counter] w_local_1 = w_local_this_point[local_face_counter] w_real = operations.convert_local_real_Piola( this_elem_type, w_local_1[0, 0], w_local_1[0, 1], this_element_nodes, nodes_coordenates ) flux_at_face = new_flux[face_ID] # if flux_at_face<0: # flux_at_face=-flux_at_face if faces_list[face_ID].elem_2 == elem_counter: # w_real=aux_RNM.invert_w(w_real) flux_at_face = -flux_at_face b_at_point += flux_at_face * w_real B_list.append(np.array([b_at_point[0, 0], b_at_point[1, 0]])) Gmsh_file_name = file_names.get_Gmsh_B_field_file_name() path = os.path.join(results_path, Gmsh_file_name) Create_Vector_field(xy_plot, B_list, path, "B Vector")