cholla-hydro / cholla

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

Fix MHD I/O & Add Restart Test #270

Closed bcaddy closed 1 year ago

bcaddy commented 1 year ago

Restart Test

Added a test for MHD and hydro restarts. It doesn't work with gravity, particles, etc but would be pretty easy to extend to those or write new tests for them based off of this test.

MHD I/O

The MHD I/O was outputting an extra cell in every direction when it should only output an extra cell in the direction of the magnetic field; i.e. the Bx dataset should be (nx+1, ny, nz) not (nx+1, ny+1, nz+1). This should fix that issue and clean up MHD I/O a bit in general.

Replaced all custom PI macros with the built in M_PI

bcaddy commented 1 year ago

I'd like @alwinm to take a look at the changes to the I/O routines in io_gpu.cu. I borrowed some ideas from my CT kernel for the indexing and did a little bit of refactoring, mostly to reduce code reuse and increase constness.

bcaddy commented 1 year ago

This is pretty much ready. Once I get @alwinm's go ahead I just need to update the test data that is impacted by this and it will be good to go.

bcaddy commented 1 year ago

Thanks for checking it out.

I agree that PI should be replaced with M_PI. I agree that the naming is unfortunate in an MPI code but it is the standard so I think we should stick with it until we switch to C++20 which has a much clearer implementation of mathematical constants.

bcaddy commented 1 year ago

@alwinm, I got bored while the tests were running and replaced all the instances of PI with M_PI

bcaddy commented 1 year ago

@evaneschneider, once the tests pass this is good to merge