import numpy as np twopi = 2*np.pi twopi2 = twopi**2. mi = 100.0 # ion mass, unit me # let the reference frequency wr = wci (ion cyclotron frequency) # length normalized to c/wci = wpiwci * di # time normalized to 1/wci # B field normalized to me*wci/e # density normalized to epsilon_0 * me * wci^2/e^2 # temperature normalized to me*c^2 # wpi/wci wpiwci = 100 Ti_Te = 1./4 # ratio Ti/Te beta = 5e-4 # total beta beta_e = beta / (1+Ti_Te) beta_i = beta / (1+1/Ti_Te) Te1 = 0.25*beta_e*mi/wpiwci**2. # Te (one component) Ti1 = 0.25*beta_i*mi/wpiwci**2. # Ti (one component) Te = [Te1, Te1, Te1] Ti = [Ti1, Ti1, Ti1] n0 = mi*wpiwci**2. ppc = 100 # particles per cell, same for e, i # ---------- basic setup ------------------- box = [30./wpiwci,0.5/wpiwci] # c/wci res = [3200,1600] # resolution: cell number per unit number_of_patches = [128,1] tmax = 400. # max run time, wci^-1 #********** DO NOT CHANGE ********************** dr =[ 1./i for i in res ] dt_CFL = 1./np.sqrt(sum(i**2 for i in res)) # Courant condition rest = (1./dt_CFL)/0.98 dt =1./rest # timesteps to finish one time unit Nt = int(rest) # sim. dimension dim = len(box) # adjust box size (cells) to be divided by number_of_pathces for i in range(dim): fac = float(box[i])*res[i]/number_of_patches[i] if fac!=fac//1: fac = int(fac)+1 box[i] = float(fac)*number_of_patches[i]/res[i] # total number of cells cells = list( np.array(box)*np.array(res) ) #************************************************ dump_freq = Nt # dump every wci^-1 flush_freq = 20*dump_freq # ------------ global settings -------------------- Main( geometry = "2Dcartesian", interpolation_order = 2, grid_length = box, cell_length = dr, # each must be power of 2; total must be greater than MPI process number number_of_patches = number_of_patches, #patch_arrangement = "linearized_ZYX", timestep = dt, simulation_time = tmax, EM_boundary_conditions = [ ['PML'], ['periodic'], # ['silver-muller'], # ['silver-muller'], ], number_of_pml_cells=[[64]], solve_poisson = False, # "False" to have a neutralizing background # reference_angular_frequency_SI = 3.e8/0.4e-6, #speed of light / laser wavelegth print_every = 1e4, # random_seed = smilei_mpi_rank ) ## ------------ load balancing -------------- #LoadBalancing( # initial_balance = True, # every = 5*Nt, # cell_load = 1., # frozen_particle_load = 1., #) #------------ vectorization --------------- # Vectorization( # mode = "adaptive", # reconfigure_every = 20, # initial_mode = "on" # ) #---------- moving window -------------- # MovingWindow( # time_start = 0., # velocity_x = 1., # ) # -------------- filtering --------------- # CurrentFilter( # model = "binomial", # passes = [4, 2], # ) # FieldFilter( # model = "Friedman", # theta = 0., # ) # ----------------- laser pulse ---------------------- # def time_envelope(t): # if 04.) # DiagTrackParticles(species ="ion", every = [0, dump_freq], flush_every=flush_freq, attributes = ["x", "px", "py", "pz",] ) # DiagTrackParticles(species ="elec", every = [0, dump_freq], flush_every=flush_freq, attributes = ["x", "px", "py", "pz",] ) # ----------- checkpoints for restarts ------------------------ # Checkpoints( # # restart_dir = "dump1", # # restart_number = 1, # dump_minutes = 15.5*60, # dump_step = 0, # exit_after_dump = True, # keep_n_dumps = 1, # )