def generate_temporal_vtk(output_path): for dtype in ("mesh", "particles"): group = VtkGroup("{}/pseudo_temporal_{}".format(output_path, dtype)) dfiles = sorted(glob.glob("{}/{}*".format(output_path, dtype))) for t, df in enumerate(dfiles): group.addFile(filepath = df, sim_time = t) group.save()
def generate_temporal_vtk(output_path): for dtype in ("mesh", "particles"): group = VtkGroup("{}/pseudo_temporal_{}".format(output_path, dtype)) dfiles = sorted(glob.glob("{}/{}*".format(output_path, dtype))) for t, df in enumerate(dfiles): group.addFile(filepath=df, sim_time=t) group.save()
y = numpy.zeros((radius_number + 1, angle_number + 1, node_number)) z = numpy.zeros((radius_number + 1, angle_number + 1, node_number)) # Group vtk_group = VtkGroup("cylinder/RiserGroup") # cnt=0 for time_index in range(time.size): for k in range(node_number): # Nodal displacement x_deviation = displacement_x[time_index][k] y_deviation = displacement_y[time_index][k] z_deviation = k/float(node_number) * length # # Trans for j in range(angle_number + 1): for i in range(radius_number + 1): rad = numpy.radians(angle_axis[j]) x[i, j, k] = radius_axis[i] * numpy.cos(rad) + x_deviation y[i, j, k] = radius_axis[i] * numpy.sin(rad) + y_deviation z[i, j, k] = z_deviation # Variables # # Output str1 = str(time_index) filename = 'cylinder/' + 'cylinder' + str1.zfill(4) filename_extension = filename + '.vts' gridToVTK(filename, x, y, z) vtk_group.addFile(filepath=filename_extension, sim_time=time[time_index]) vtk_group.save()