def stuff(h=None,k_test=None): ts = p49_eigen.waves(hx=h[0],hy=h[1],hz=h[2],p=0.6,this_wave=wave) #, form='rb96') #k_test = nar([[1.,0.],[0.,0.],[0.,1]]) ampl = nar([1e-6,0]) kint = k_test.astype(int) ts.rotate(kint) def ugprint(label,thing, form='%5.2f'): stuff1 = " %s"%form stuffN = stuff1*len(thing) print(label+stuffN%tuple(thing)) print(" ") ugprint('h_unit ',ts.h_unit) print(" ") ugprint('a_unit0',ts.a_unit[:,0]) ugprint('b_unit0',ts.b_unit[:,0]) ugprint('c_unit0',ts.c_unit[:,0]) ugprint('B0hat0 ',ts.B0hat[:,0]) ugprint('dh ',(ts.rot['hx'][0],ts.rot['hy'][0],ts.rot['hz'][0])) ugprint('dv ',(ts.rot['vx'][0],ts.rot['vy'][0],ts.rot['vz'][0])) ugprint('drho,de',(ts.rot['d'][0],ts.rot['e'][0])) #ugprint('a_unit1',ts.a_unit[:,1]) #ugprint('b_unit1',ts.b_unit[:,1]) #ugprint('c_unit1',ts.c_unit[:,1]) #ugprint('B0hat1 ',ts.B0hat[:,1]) #ugprint('db ',(ts.rot['hx'][1],ts.rot['by'][1],ts.rot['bz'][1])) #ugprint('vb ',(ts.rot['vx'][1],ts.rot['vy'][1],ts.rot['vz'][1])) return ts
def modes(h0=1, theta=0, state=None, WRITE=False, directory='./Runs/', wave='f-', size=32, mode_tool=modes_k001): if state is None: r2 = np.sqrt(2) state = p49_eigen.waves(hx=h0 * np.cos(theta), hy=h0 * np.sin(theta) / r2, hz=h0 * np.sin(theta) / r2, p=0.6, this_wave=wave, HydroMethod=4) #state = p49_eigen.waves(hx=h0*np.cos(theta),hy=0,hz=h0*np.sin(theta),p=0.6,this_wave=wave, HydroMethod=4) mode_instance = mode_tool(size) mode_instance(size) ampl, kint = mode_instance.ampl, mode_instance.kint state.perturb(pert_shape='fft', base_size=nar([size] * 3), ampl=ampl, directory=directory, k_rot=kint, wave=wave, start=True, write=WRITE, single_wave_selector=False) these_ffts = p49_eigen.get_ffts(state.cubes, means={}) state.kstuff = { 'ampl': ampl, 'mask': mode_instance.mask, 'k': mode_instance.k3 } return state, these_ffts
amplitude[size[0] / 2:, :, :] = -1 if field is not 'Bx': the_wave = pert * amplitude * self.right[ map_to_eigen[field]][wave] self.cubes[map_to_label[field]] += the_wave for field in ['d', 'E', 'vx', 'vy', 'vz', 'Bx', 'By', 'Bz']: this_filename = "%s/%s_16.h5" % (directory, map_to_label[field]) if field in ['vx', 'vy', 'vz', 'E']: self.cubes[map_to_label[field]] /= self.cubes[ map_to_label['d']] if write: enzo_write.dump_h5(self.cubes[map_to_label[field]], this_filename) right_fast = p49_eigen.waves(P=0.6) #right_fast.perturb(base_size=nar([16]*3),pert= 1e-6,wave= 6,directory= '/Users/dcollins/scratch/Paper49b_play/r17d') print(right_fast['dv']) """ below are old things. """ def r16_cube_right_fast(directory, write=True): #base_size = nar([64]*3) base_size = nar([16] * 3) pert = 1e-6 wave = 6 quan = {} d = 1. vx = vy = vz = 0
t3a=stuff(h=[0.2,1.0,0.5],k_test=nar([[0.,0.],[1.,0.],[0.,1]])) t3b=stuff(h=[0.5,0.2,1.0],k_test=nar([[0.,0.],[0.,0.],[1.,1]])) if 1: print("Test 4: our standard test") t3 =stuff(h=[1.0,0.5,0.2],k_test=nar([[1.,0.],[0.,0.],[0.,1]])) t3a=stuff(h=[0.2,1.0,0.5],k_test=nar([[0.,0.],[1.,0.],[0.,1]])) t3b=stuff(h=[0.5,0.2,1.0],k_test=nar([[0.,0.],[0.,0.],[1.,1]])) #print("h_unit",ts.h_unit) #print("a_unit",ts.a_unit) #print("b_unit",ts.b_unit) #print("c_unit",ts.c_unit) #print("B0hat",ts.B0hat) if 0: this_system = p49_eigen.waves(bx=1.0,by=0.0,bz=0.0,p=0.6,this_wave='f-') k_test = nar([[1.,1.],[1.,0.],[0.,1]]) #ampl = nar([1e-2,1e-2]) ampl = nar([1e-2,0]) #this_system.rotate(k_test) #kint = k_test.astype(int) this_system.rot_write(k_test,base_size=nar([16]*3),pert=ampl,directory='/Users/dcollins/scratch/Paper49b_play/r103a_f-_110') if 0: this_system = p49_eigen.waves(bx=1.0,by=0.0,bz=0.0,p=0.6,this_wave='a+') k_test = nar([[2.,1.],[1.,1.],[0.,1]]) ampl = nar([1e-6,1e-6]) kint = k_test.astype(int) this_system.rot_write(k_test,base_size=nar([16]*3),pert=ampl,directory='/Users/dcollins/scratch/Paper49b_play/r101_two') if 0: this_system = p49_eigen.waves(bx=1.0,by=0.0,bz=0.0,p=0.6,this_wave='a+') k_test = nar([[1.,1.],[1.,0.],[0.,1]])
}.get(field, field) temp_taxi.slice_zlim[field] = [ this_system.quan[ifield] - 2e-6, this_system.quan[ifield] + 2e-6 ] temp_taxi.set_log[field] = False return temp_taxi if 0: #r401 r401_rj95_sq_f- directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/r401_rj95_sq_f-' name = 'r401' wave = 'f-' this_system = p49_eigen.waves(hx=1.0, hy=1.41421, hz=0.5, p=0.6, this_wave=wave, HydroMethod=6) #, form='rb96') ampl = nar([1e-6, 0]) this_system.rot_write(pert_shape='square_x', base_size=nar([16] * 3), pert=ampl, directory=directory, wave=wave) #r401=eigen_taxi(this_system,name) if 0: #r501 r501_rj95_fft_f- directory = '/Users/dcollins/scratch/Paper49b_play/Eigen/r501_rj95_fft_f-' name = 'r501' wave = 'f-'
if sim == 'rx06_like': amplitude = 1e-3 ampl = np.zeros_like(k_norm) * (1 + 0j) old_b = nar([1.0, 0.5, 1.41421]) ampl[2, 1, 2] = amplitude amplitudes = {'a-': ampl} out_dir_b = '/Users/dcollins/scratch/Paper49b_play/Spectral/rx11_mixed_1' out_dir_s = '/Users/dcollins/scratch/Paper49b_play/Spectral/rx11_mixed_s+' out_dir_f = '/Users/dcollins/scratch/Paper49b_play/Spectral/rx11_mixed_f-' if 'unlazy' not in dir(): unlazy = True if 'tsb' not in dir() or unlazy: tsb = p49_eigen.waves(hx=old_b[0], hy=old_b[1], hz=old_b[2], p=0.6, form='rb96', HydroMethod=4) blah = False for n, wave in enumerate(list(amplitudes.keys())): print("INITIALIZE %s" % wave) start = False if n == 0: start = True WRITE = False else: WRITE = True tsb.rot_write(pert_shape='fft', base_size=nar([size] * 3), pert=amplitudes[wave], directory=out_dir_b,