AMReX-Astro / Emu

Emu is a neutrino quantum kinetics simulation code based on the particle in cell method and parallelized for CPU or GPU supercomputing architectures.
Other
10 stars 3 forks source link

Redistribute once per timestep #50

Closed dwillcox closed 3 years ago

dwillcox commented 3 years ago

Because #48 enables particle interpolation within ghost cells, we can now redistribute once per timestep instead of at each RK stage and with each particle container.

With this PR, we will allow particles to enter the first layer of ghost cells within a single timestep. This is okay, because we add an extra ghost cell and run with an advection CFL < 1.

We then only redistribute the new time data and only at the end of each timestep. This reduces the number of particle container redistributes for a single timestep of RK4 from 24 to 1.

Draft PR, will rebase on development once #49 is merged.

dwillcox commented 3 years ago

I'm convinced this is fine to merge. I turned off RNG by using inputs_1d_fiducial with a 96^3 domain of size 64 cm in each dimension, and set st4_amplitude = 0..

The input file is attached, along with the output of fcompare between the current development branch and this branch for step 0 and step 1.

Diffs are O(1e-14) relative error for all quantities except for x-y fluxes. That's okay, because in this initialization, with st4_amplitude=0, the x-y fluxes should sum to 0, so the diffs we're seeing in those components are subtractive cancellation differences.

inputs_1d_fiducial.txt fc_red-all_vs_red-post-timestep_plt1.txt fc_red-all_vs_red-post-timestep_plt0.txt