# ---------------------------------------------------------------------------------------- # SIMULATION PARAMETERS FOR THE PIC-CODE SMILEI # ---------------------------------------------------------------------------------------- from math import pi, log, sqrt, ceil from numpy import s_ from numpy import cos, sin, exp # Physical constants, SI c = 299792458. # m/s e = 1.60217663e-19 # ะก me = 9.1093837015e-31 # kg e0 = 8.8541878128e-12 # F/m # Laser wavelength = 1.8e-6 # m angular_frequency = 2. * pi * c / wavelength # 1/s # Reference quantities in SI L_r = wavelength / 2. / pi T_r = 1. / angular_frequency E_r = me * angular_frequency * c / e A_r = me * c / e B_r = me * angular_frequency / e N_r = e0 * me * angular_frequency**2 / e**2 J_r = c * e * N_r K_r = me * c**2 MeV_r = K_r / e / 1.e6 # Normalized laser wavelength l0 = 2.0 * pi # Normalized box size : long x transverse len_L = 32 len_T = 24 Lsim = [len_T*l0, len_T*l0, len_L*l0] # Mesh parameters resz = 16 # nb of cells in one laser wavelength res_factor = round(resz/16) dz = l0/resz # cell_length nx = 1 ny = 1 dx = dz * nx dy = dz * ny my_CFL = 0.99 dt = dz * my_CFL / sqrt(1./nx**2 + 1./ny**2 + 1.) # timestep every_time = ceil(len_L * sqrt(1./nx**2 + 1./ny**2 + 1.)) * res_factor # 56 - for dz = l0/16 nb_show = 16 # nb points in time to store It_time = ceil(every_time * nb_show) + 1 # number itteretion in time Tsim = It_time * dt # adjusted simulation time (normalized) # Pulse parameters lambda0 = wavelength w0 = 4 * lambda0 fwhm = l0 def myExternal_Ex(x,y,z): return 0 def myExternal_Ey(x,y,z): return 0 def myExternal_Ez(x,y,z): return 0 def myExternal_Bx(x,y,z): return 0 def myExternal_By(x,y,z): return 0 def myExternal_Bz(x,y,z): return 0 Main( geometry = "3Dcartesian", interpolation_order = 2 , cell_length = [dx, dy, dz], # 100 nm grid_length = Lsim, number_of_patches = [16, 16, 32], patch_arrangement = "linearized_XYZ", timestep = dt, simulation_time = Tsim, EM_boundary_conditions = [ ["silver-muller"] ], print_every = 200, ) ExternalField( field = "Ex", profile = myExternal_Ex ) ExternalField( field = "Ey", profile = myExternal_Ey ) ExternalField( field = "Ez", profile = myExternal_Ez ) ExternalField( field = "Bx", profile = myExternal_Bx ) ExternalField( field = "By", profile = myExternal_By ) ExternalField( field = "Bz", profile = myExternal_Bz ) every_in = every_time every_step = every_time DiagScalar( every = 10, vars = ["Uelm", "Uelm_Ex", "Uelm_Ey", "Uelm_Ez", "ExMax", "ExMin", "EyMax", "EyMin", "EzMax", "EzMin"], precision = 10 ) ix_foc = resz * round(len_T/2) iy_foc = resz * round(len_T/2) iz_foc = resz * round(len_L/2) fg = 2 * res_factor DiagFields( every = [every_in, every_step], fields = ["Ex","Ey","Ez"], subgrid = s_[::fg, ::fg, iz_foc] ) DiagFields( every = [every_in, every_step], fields = ["Ex","Ey","Ez"], subgrid = s_[::fg, iy_foc, ::fg] ) DiagFields( every = [every_in, every_step], fields = ["Ex","Ey","Ez"], subgrid = s_[ix_foc, ::fg, ::fg] ) DiagFields( every = [every_in, every_step], fields = ["Ex","Ey","Ez"], subgrid = s_[ix_foc, iy_foc, ::1] )