AMReX-Astro / Castro

Castro (Compressible Astrophysics): An adaptive mesh, astrophysical compressible (radiation-, magneto-) hydrodynamics simulation code for massively parallel CPU and GPU architectures.
http://amrex-astro.github.io/Castro
Other
298 stars 97 forks source link

a simpler / better shock detection algorithm #2704

Closed zingale closed 8 months ago

zingale commented 8 months ago

PR summary

The original algorithm was based on one in Flash but it had some normalizations in it that did not make sense. This now looks at

| (grad P - rho g) . v / |v| | / (P / dx) > eps div{U} < 0

This projects grad P in the direction of the velocity (v / |v|) and also removes the hydrostatic pressure, since only the pressure in excess of that is available to make a shock.

Here eps defaults to 2/3 and can be set at runtime via castro.shock_detection_threshold

PR motivation

PR checklist

zingale commented 8 months ago

Here's the difference in the old (left) vs new (right) shock detection for Sedov

image

zingale commented 8 months ago

I still think that the shock region is too thick -- it should only be a single zone

zingale commented 8 months ago

Here's an updated comparison, the left is the latest version, which projects the gradient in the direction of motion.

image (2)