Warwick-Plasma / epoch

Particle-in-cell code for plasma physics simulations
https://epochpic.github.io
GNU General Public License v3.0
176 stars 57 forks source link

Any suggestion about large scale simulation in epoch? #397

Closed xiaowang119 closed 1 year ago

xiaowang119 commented 2 years ago

Hi, friends.

I prepare to simulate a plasma configuration with spatial scale of meter and density of order 1e22/m^3 in epoch. But limited by Debye length, it will produce a massive grids.

Status-Mirror commented 2 years ago

Hi Xiaowang,

I have experience with this, as I often run laser-solid simulations with cold, dense plasma - which has a tiny Debye length. PIC codes suffer from numerical heating when you don't have enough resolution, and your plasma particles gain energy non-physically. However, there are ways to prevent this.

I find that you don't actually need to resolve your Debye length to run simulations. If you make the EPOCH code with the line:

DEFINES += $(D)PARTICLE_SHAPE_BSPLINE3

un-commmented in the Makefile text document (remove the leading #), then the macro-particle shapes will span more cells. Additionally, adding the line:

smooth_currents = T

into your control block will also help to prevent self-heating. With BSPLINEs and current smoothing working together, the rate of self-heating drops significantly.

One way to test the effect of self-heating in the code is to set up a small simulation (10 by 10 cells in 2D), with the density and temperature you plan to use in the simulation. Use periodic boundary conditions, and ignore any lasers. Once the simulation is set up, you can run it for your simulation time, and plot how the temperature of the code evolves during the run-time. This way, you can quickly test the effects of cell size on the heating level and simulation run-time, to find an acceptable trade-off.

Hope this helps, Stuart

xiaowang119 commented 2 years ago

Hi Stuart,

Thank you so much for your detailed advice, which will be great helpful to solve my problem. I'll try it and give feedback on the results.

Thanks again. Xiaowang

Status-Mirror commented 1 year ago

Sounds great. I'm going to close the issue now, but feel free to continue messaging on this thread if you have any further questions.

xiaowang119 commented 1 year ago

That's ok! I have try the method above and found that it only works if the grid precision is not more than too many times the Debye length. But in my case, the density was too high (which would have resulted in a tiny Debye length) , and the simulation scale was too large, and the simulation time was on the order of milliseconds. So the problem seems unsolvable.

I will continue to explore solutions. Thank you again for your help and giving me such a good idea.

Status-Mirror commented 1 year ago

Ah okay - milliseconds would be quite long for EPOCH2D. It's rare I see a simulation exceeding a few picoseconds in duration using the PIC method. You may get closer to your goal using the 1D version of EPOCH, but I doubt you could push this to millisecond time-scales.

For modelling plasma physics on these time and length scales, you may have more success using a radiation hydrodynamics code. Good luck with your modelling!