cholla-hydro / cholla

A GPU-based hydro code
https://github.com/cholla-hydro/cholla/wiki
MIT License
60 stars 32 forks source link

Updating Galaxy ICs and gravity #387

Closed mabruzzo closed 1 month ago

mabruzzo commented 3 months ago

This PR is now ready for review (modulo some changes to this description). This PR should be reviewed before #386.

Overview

The main changes I introduced in this PR include:

  1. Updating the Ideal Galaxy Initialization.
  2. Updating relevant particle initialization routines
  3. Updating some stuff about gravity routines (a minor tweak and some minor refactoring)

Most of the other stuff was inherited from work done by Orlando (and Alwin). These other areas are listed below.

Detailed Description: Updating the Ideal Galaxy Initialization

  1. Centralizing a lot of the functionality for computing quantities related to the analytic, static gravitational potential.
    • Before this pull request, a lot of this functionality was duplicated. There were a bunch of global functions defined within disk_ICs.cpp and there were a handful of functions defined as methods of DiskGalaxy. These functions had similar names and were identical (I recall that there were minor differences in variable names, but there was no difference in logic). Some of this functionality was also replicated in other parts of the codebase.
    • In this PR, I centralized all of these functions in one place. The functionality is encapsulated by a set of Potential classes (e.g. there's a class for an NFW potential and a class for a Miyamoto-Nagai disk) that are internally stored by the DiskGalaxy class
    • The DiskGalaxy class be used to call this functionality in .cpp files.
    • The underlying Potential classes can be extracted from the DiskGalaxy class and called directly in .cu files (the functionality can be used on the host or the device)
  2. To facilitate the usage of this functionality in both .cpp and .cu files I needed to move the implementation of the DiskGalaxy methods to a separate source file and the set of Potential classes into a separate header that is not explcitly included within disk_galaxy.h. This lets .cpp files include disk_galaxy.h without encountering cuda-specific extensions
  3. I did a lot of work on implementing more stable initial conditions that tries to account for the initial self-gravity of the gas disk.
  4. I made a lot of other structural changes within disk_ICs.cu.

I would like to do a little more cleanup in disk_ICs.cu. Would it be ok for me to remove the hydrostatic_column_analytical_D3D and determine_rho_eos_D3D (this functionality was already unused back when I first started working on this branch)

Detailed Description: Updating relevant particle initialization routines

[ to be added ]

Detailed Description: Gravity-Related Updates

[ to be added ]

mabruzzo commented 1 month ago

@ojwg I believe I have addressed all of your comments!