lanl / phoebus

Phifty One Ergs Blows Up A Star
BSD 3-Clause "New" or "Revised" License
46 stars 2 forks source link

MonopoleCart rewrite #110

Closed Yurlungur closed 2 years ago

Yurlungur commented 2 years ago

PR Summary

This PR finally rewrites the Cartesian monopole coordinate system tied to the monopole GR solver. I do the following:

  1. Extend ModifiedSystem to support geometries with a time-dependent component. The coordinate transformation is assumed to be time-independent, but the geometry itself is allowed to evolve. This basically entails computing the d/dt components of the metric gradients and transforming them into the new coordinate system as appropriate, assuming zero cross-talk between the space and time components of the metric. Note this approach only works because the coordinate transform is time-independent.
  2. Write a SphericalToCartesian transformation object, which I use in the monopole_gr interpolation from the 3d grid to the 1d grid to transform relevant quantities like the Jacobian.
  3. Define the Cartesian monopole geometry as using MonopoleCart=Modified<MonopoleSph, SphericalToCartesian>
  4. Wrap that in the Analytic and Cached geometry modifier templates
  5. Profit.

I still need to test basically all of this, but it compiles and I think it's ready for feedback from y'all if you want to take a look. @brryan @jdolence @lroberts36

PR Checklist

Yurlungur commented 2 years ago

I have added a history reduction into the tov package to plot the maximum pressure in the star as a function of time. This will let us see, e.g., quasiperiodic oscillations if we run long enough.

Yurlungur commented 2 years ago

@brryan @jdolence @lroberts36 this is now ready for review. I was able to run a (very) underresolved neutron star on a uniform grid on a single GPU with self gravity, and it's stable. So I call that a win.

In the future it would be good to do some performance optimization, as well as some more strenuous tests and not a uniform grid. I will do that in a future PR. But for the purposes of this PR, I'm pretty happy to declare victory. Some additional changes I needed to implement to get this all working:

  1. A bug fix in the sph2cart coordinate transformation to eliminate issues from coordinate singularities
  2. Outflow and reflecting boundary conditions (I tested reflecting boundary conditions to implement octant symmetry. It works.)
  3. A bug fix in the atmosphere treatment to prevent the atmosphere from diverging at the origin.
Yurlungur commented 2 years ago

Thanks, @brryan I just pushed addressing your comments. When tests pass, I'll merge.