The time has come to implement a gravitational potential in Cholla. To do this, I’ll need to couple the gravitational source terms to the momentum and energy equations:
and , where is the gradient of the gravitational potential (i.e. the gravitational acceleration).
To start, I’ve tried coupling the gravitational source terms in the simplest way possible to the hydro equations, via an the operator-split update at the end of the hydro step. This takes the form (in 1D):
To test this, I’ll start with the simplest potential, a 1D constant gravitational acceleration in the y-direction.
Below is a test of a 2D Rayleigh-Taylor instability with the following parameters: , , , . The two fluids are initally in hydrostatic equilibrium, so the initial pressure, , where is set such that the sound speed at the interface. The inital velocities are perturbed according to , a single mode perturbation that tapers off from the interface. The test is run in a domain , , with periodic x-boundaries and reflecting y-boundaries. For this run, I used 200x400 cells.
Below is a movie showing the evolution of the fluid until . The color-scale represents the density from to .
[EDIT: The earlier problems with the fluid bouncing around were due to a flipped sign in the initial conditions for the pressure.]