SmileiPIC / Smilei

Particle-in-cell code for plasma simulation
https://smileipic.github.io/Smilei
334 stars 119 forks source link

Unstable prescribed field with moving window #308

Closed afzalraghavi closed 8 months ago

afzalraghavi commented 3 years ago

Dear developers, I'm using the master branch t wrk with prescribed block. In rest frame it works well but with moving window it generates an unexpected electromagnetic field that is not physicslly right. With regards, Afzal

afzalraghavi commented 3 years ago

x-special/nautilus-clipboard copy file:///home/afzal/smilei-v4.5/runs/tests/2d_fel.py

mccoys commented 3 years ago

Hello Could you provide an example ?

afzalraghavi commented 3 years ago

Hi. Hear is a sample manuscript which shows different behavior with and without moving window in the presence of prescribed field.

import math l0 = 2.0math.pi # laser wavelength t0 = l0 # optical cicle dx = .2 dtrans = 3. dt = 0.95dx nx = 2561 ntrans = 6410 Lx = nx dx Ltrans = ntransdtrans npatch_x = 8 npatch_r = 8 lw = Lx/1#2*gamma*2l0 kw=2.*math.pi/lw

Main( geometry = "2Dcartesian", interpolation_order = 2, timestep = dt, simulation_time = 10Lx, #int(1Lx/dt)*dt, cell_length = [dx, dtrans], grid_length = [ Lx, Ltrans], number_of_patches = [npatch_x, npatch_r], clrw = nx/npatch_x, EM_boundary_conditions = [ ["silver-muller","silver-muller"] ], solve_poisson = False, solve_relativistic_poisson = True, print_every = 100, random_seed = smilei_mpi_rank )

MovingWindow( time_start = 0.0, velocity_x = 1.0 )

Define the wiggler field

B0 = 0.05 def Bz(x,z,t): return B0math.sin(kwx) PrescribedField( field = "Bz", profile = Bz )

list_fields = ['Ey','Ez','Bz']

DiagFields( every = 100, fields = list_fields ) DiagScalar(every = 10, vars=['Uelm','Ukin_eon','Utot','Uexp'])

mccoys commented 3 years ago

Sorry for the late response. Prescribed fields do not work with the moving window. We are still not sure how to do this but we will look into it when possible

mccoys commented 3 years ago

Just to keep you posted on this issue. It is unclear for us whether there is a good rationale to implement PrescribedFields with the moving window. It adds a bunch of complexity in the code that we may want to avoid. PrescribedFields are unphysical in almost all situations, and were only supposed to be used in very particular cases for test purposes. We will likely not progress rapidly on this issue because there are other more pressing matters.