SmileiPIC / Smilei

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

timestep_over_CFL leads to an index error #727

Open OwenSlevert opened 3 weeks ago

OwenSlevert commented 3 weeks ago

Description

Hello,

when using timestep_over_CFL I get following error:

" On rank 0 [Python] Exception: simulation_time and number_of_timesteps are not defined"

When using timesteps, it works without problems. I added a shortened namelist where the error occured (it is a txt file so that I can send it here).

Thanks!

Steps to reproduce the problem

Ocured when running smilei_test

Parameters

namelist_short.txt

Z10Frank commented 3 weeks ago

Can you try to specify in the Main block:

grid_length = ...
cell_length = ...

or

number_of_cells = ...
cell_length = ...

?

I am not sure that specifying a combination of number_of_cells and grid_length is working properly, in case this can be fixed.

OwenSlevert commented 3 weeks ago

Yes, I changed it to

dx = 59.71um /1408 dr = 22.54um /532

Main( geometry = "AMcylindrical", interpolation_order = 2, number_of_AM = 1,

number_of_cells = [1408, 532],

grid_length                    = [59.71*um, 22.54*um],
cell_length                    = [dx, dr],
simulation_time                = 1000,
timestep_over_CFL              = 0.8,
#timestep                       = dt,
number_of_patches              = patches,
EM_boundary_conditions         = [["silver-muller"],["PML"],],
number_of_pml_cells            = [[0,0],[20,20]],
solve_poisson                  = False,
print_every                    = 11,
use_BTIS3_interpolation        = use_BTIS3_interpolation,
reference_angular_frequency_SI = omega0,

)

It does not crash anymore, but gives several warnings: WARNING src/Params/Params.cpp:629 (Params) CFL problem: timestep=0.266455 should be smaller than 0.235406 [...] WARNING src/Params/Params.cpp:1139 (compute) simulation_time has been redefined from 1000.000000 to 999.740105 to match timestep.

It also says that timestep = 0.266455 = 1.131895 x CFL albeit defining it differently. Thats why I am confused that it does have problems with the given CFL number.

Z10Frank commented 3 weeks ago

But by doing this, does the simulation work with stable fields? I mean your not reduced simulation.

OwenSlevert commented 3 weeks ago

When setting the CFL condition to 0.5 it works, yes. But at 0.8 it crashes.

Edit: I get the same warnings.