def do_step(k,i): print i ds = timeseries[i] #Get the surface and scalars from the first one in the series surf_poly = ttf.read_step(linesurf[i]) normals = ttf.get_data(surf_poly, 'perp') parallels = ttf.get_data(surf_poly, 'par') torsionals = ttf.get_data(surf_poly, 'phi') #Extract the wave flux mayavi field from the yt dataset fwfield = util.get_mlab_field_yt(ds, 'wave_flux_x', 'wave_flux_y', 'wave_flux_z', cube_slice=cube_slice) #Interpolate the Wave flux to the velocity surface surface_fwave_filter, surface_fwave = ttf.interpolate_vectors(fwfield.outputs[0], surf_poly) Fwperp, Fwpar, Fwphi = ttf.get_surface_velocity_comp(surface_fwave, normals, torsionals, parallels) ttf.write_wave_flux(path_join("WaveFlux_%s_%s_%s_%05i.vtp"%(cfg.driver, cfg.str_period, cfg.amp, i+1)), surf_poly, parallels, normals, torsionals, Fwpar, Fwperp, Fwphi) Fpar_line[k] = Fwpar[save_index[i]] Fperp_line[k] = Fwperp[save_index[i]] Fphi_line[k] = Fwphi[save_index[i]]
f_wave[0, :, :, :][cube_slice], f_wave[1, :, :, :][cube_slice], f_wave[2, :, :, :][cube_slice], name="Wave Flux", figure=None, ) # print 'rank', rank, -2, b2h(psutil.virtual_memory().active) # Make surface using seeds, surf filter and contour surf_field_lines, surface = ttf.create_flux_surface(bfield.outputs[0], surf_seeds[0]) # Make the PolyDataNormals object poly_norms = ttf.make_poly_norms(surface.output) # Interpolate the vfield to the surface surface_vel_filter, surface_velocities = ttf.interpolate_vectors(vfield.outputs[0], poly_norms.output) surface_mag_filter, surface_bfield = ttf.interpolate_vectors(bfield.outputs[0], poly_norms.output) surface_bpert_filter, surface_bpert = ttf.interpolate_vectors(bpert.outputs[0], poly_norms.output) # Interpolate the Wave Flux surface_fwave_filter, surface_fwave = ttf.interpolate_vectors(fwfield.outputs[0], poly_norms.output) # Interpolate the vfield to the surface surface_den_filter, surface_density = ttf.interpolate_vectors(density.outputs[0], poly_norms.output) surface_va_filter, surface_va = ttf.interpolate_vectors(valf.outputs[0], poly_norms.output) surface_cs_filter, surface_cs = ttf.interpolate_vectors(cs.outputs[0], poly_norms.output) surface_beta_filter, surface_beta = ttf.interpolate_vectors(beta.outputs[0], poly_norms.output) # Make the line the_line = ttf.get_the_line(bfield.outputs[0], surf_seeds[0], line_n)