quokka-astro / quokka

Two-moment AMR radiation hydrodynamics (with self-gravity, particles, and chemistry) on CPUs/GPUs for astrophysics
https://quokka-astro.github.io/quokka/
MIT License
46 stars 12 forks source link

add tracer particles #489

Closed BenWibking closed 9 months ago

BenWibking commented 9 months ago

Describe the proposal Add tracer particles that advect with the flow, using the face-centered velocities returned by the Riemann solver, following the Advection_AmrCore example code (https://github.com/AMReX-Codes/amrex/blob/e0b77e1fce491021696d22f1496138e8d9942d65/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp).

Additional context Tracer particles are easy to add, since the AMReX AmrTracerParticleContainer can be used: https://github.com/AMReX-Codes/amrex/blob/e0b77e1fce491021696d22f1496138e8d9942d65/Src/AmrCore/AMReX_AmrParticles.H#L293

Tracer particles are never deposited onto a grid, so it is unnecessary to have ghost/virtual particles. This makes the implementation easy. The only non-trivial steps are to call TracerPC->Redistribute after particles are advected and when regridding happens.

The Castro implementation (using cell-centered velocities) is here.

The original face-centered velocity tracer particle implementation is Harlow & Welch (1965).

BenWibking commented 9 months ago

I am not sure if it is possible to use the face-centered velocities from the Riemann solver because there may be momentum source terms that change the fluid velocity.

We instead use the end-of-timestep cell-centered velocities. (Unfortunately, this is more diffusive than using face-centered velocities. Therefore, in simulations without momentum source terms, it may be preferable to use the face-centered velocities.)

Note that cell-centered velocity tracers have problems in supersonic flows: https://ui.adsabs.harvard.edu/abs/2013MNRAS.435.1426G/abstract