v_start = -1.0 p_start = -1.0 uvp_end = 1.0 duvp = (uvp_end - v_start) / n for u in frange(u_start, uvp_end, duvp): for v in frange(v_start, uvp_end, duvp): for p in frange(p_start, uvp_end * 0.88, duvp): bool_run = True if p == 1.0: bool_run = False N_nodal = shape_functions.get_node_shape_function( elem_type, u, v, p) for k in range(0, N_nodal.size): if N_nodal[k] < 0.0 or N_nodal[k] > 1.0: bool_run = False if bool_run: N = shape_functions.get_facet_shape_function( elem_type, u, v, p) Wuv = np.zeros((3, 1)) Wuv[0, 0] = N[which_face, 0] Wuv[1, 0] = N[which_face, 1] Wuv[2, 0] = N[which_face, 2] uv = np.zeros((3, 1)) uv[0, 0] = u uv[1, 0] = v uv[2, 0] = p
def interpolated_along_line(vol_phys_ID, xyz_list, pre_proc_data, results_path): operations = Operations() mesh_data = pre_proc_data.MeshData get_gauss_points_class = GaussPoints() shape_functions = ShapeFuncions() file_names = File_names() #Mesh data nodes_coordenates = mesh_data.NodesCoordenates elem_tags = mesh_data.ElemTags elem_type = mesh_data.ElemType elem_nodes = mesh_data.ElemNodes number_elements = len(elem_tags) xy_plot = list() field = list() #Reads flux file flux_results_file_name = file_names.flux_results_file_name() full_path = os.path.join(results_path, flux_results_file_name) new_flux = read_numeric_file_numpy(full_path) #Read faces_ID faces_ID_file_name = file_names.get_faces_ID_file_name() full_path = os.path.join(results_path, faces_ID_file_name) data = get_data_from_file(full_path) faces_ID = get_file_block("$faces_ID", "$Endfaces_ID", 0, data, int) #Read faces_from_to from_to_file_name = file_names.faces_from_to_file_name() full_path = os.path.join(results_path, from_to_file_name) faces_from_to = read_numeric_file_numpy(full_path) for xyz in xyz_list: counter = -1 this_element = False for elem_counter in range(0, number_elements): this_elem_type = elem_type[elem_counter] if this_elem_type == 4: counter = counter + 1 if elem_tags[elem_counter][0] in vol_phys_ID: nodes_list = mesh_data.ElemNodes[elem_counter] uvp = operations.convert_real_to_local( elem_counter, this_elem_type, xyz[0], xyz[1], xyz[2], nodes_list, nodes_coordenates) N = shape_functions.get_node_shape_function( this_elem_type, uvp[0], uvp[1], uvp[2]) if max(N) <= 1.0 and min(N) >= 0.0: this_element = True break if this_element: b_at_point = get_B_vector_point_uvp(uvp[0], uvp[1], uvp[2], elem_counter, counter, elem_type, elem_nodes, faces_ID, nodes_coordenates, new_flux, faces_from_to) b_at_point = np.array( [b_at_point[0, 0], b_at_point[1, 0], b_at_point[2, 0]]) field.append(b_at_point) else: b_at_point = np.array([0.0, 0.0, 0.0]) field.append(b_at_point) Gmsh_file_name = file_names.get_B_Gmsh_line_file_name() path = os.path.join(results_path, Gmsh_file_name) Create_Vector_field(xyz_list, field, path, "B Vector") Gmsh_file_name = "line_field.txt" path = os.path.join(results_path, Gmsh_file_name) write_numeric_file_numpy(path, field)
def interpolated_along_line(vol_phys_ID,xyz_list,pre_proc_data,results_path): operations=Operations() mesh_data=pre_proc_data.MeshData get_gauss_points_class=GaussPoints() shape_functions=ShapeFuncions() file_names=File_names() #Mesh data nodes_coordenates=mesh_data.NodesCoordenates elem_tags=mesh_data.ElemTags elem_type=mesh_data.ElemType elem_nodes=mesh_data.ElemNodes number_elements=len(elem_tags) xy_plot=list() field=list() #Reads flux file flux_results_file_name=file_names.flux_results_file_name() full_path=os.path.join(results_path,flux_results_file_name) new_flux=read_numeric_file_numpy(full_path) #Read faces_ID faces_ID_file_name=file_names.get_faces_ID_file_name() full_path=os.path.join(results_path,faces_ID_file_name) data=get_data_from_file(full_path) faces_ID=get_file_block("$faces_ID","$Endfaces_ID",0,data,int) #Read faces_from_to from_to_file_name=file_names.faces_from_to_file_name() full_path=os.path.join(results_path,from_to_file_name) faces_from_to=read_numeric_file_numpy(full_path) for xyz in xyz_list: counter=-1 this_element=False for elem_counter in range(0,number_elements): this_elem_type=elem_type[elem_counter] if this_elem_type==4: counter=counter+1 if elem_tags[elem_counter][0] in vol_phys_ID: nodes_list= mesh_data.ElemNodes[elem_counter] uvp=operations.convert_real_to_local(elem_counter,this_elem_type,xyz[0],xyz[1],xyz[2],nodes_list,nodes_coordenates) N=shape_functions.get_node_shape_function(this_elem_type,uvp[0],uvp[1],uvp[2]) if max(N)<=1.0 and min(N)>=0.0: this_element=True break if this_element: b_at_point=get_B_vector_point_uvp(uvp[0],uvp[1],uvp[2],elem_counter,counter,elem_type,elem_nodes,faces_ID,nodes_coordenates,new_flux,faces_from_to) b_at_point=np.array([b_at_point[0,0],b_at_point[1,0],b_at_point[2,0]]) field.append(b_at_point) else: b_at_point=np.array([0.0,0.0,0.0]) field.append(b_at_point) Gmsh_file_name=file_names.get_B_Gmsh_line_file_name() path=os.path.join(results_path,Gmsh_file_name) Create_Vector_field(xyz_list,field,path,"B Vector") Gmsh_file_name="line_field.txt" path=os.path.join(results_path,Gmsh_file_name) write_numeric_file_numpy(path,field)
v_start=-1.0 p_start=-1.0 uvp_end=1.0 duvp=(uvp_end-v_start)/n for u in frange(u_start,uvp_end,duvp): for v in frange(v_start,uvp_end,duvp): for p in frange(p_start,uvp_end*0.88,duvp): bool_run=True if p==1.0: bool_run=False N_nodal=shape_functions.get_node_shape_function(elem_type,u,v,p) for k in range(0,N_nodal.size): if N_nodal[k]<0.0 or N_nodal[k]>1.0: bool_run=False if bool_run: N=shape_functions.get_facet_shape_function(elem_type,u,v,p) Wuv=np.zeros((3,1)) Wuv[0,0]=N[which_face,0] Wuv[1,0]=N[which_face,1] Wuv[2,0]=N[which_face,2] uv=np.zeros((3,1)) uv[0,0]=u uv[1,0]=v uv[2,0]=p xy_plot.append(uv)