# Initialization

To test the operator splitting, I initialized the grid with the same conditions as the Jeans test I did with astrobear (see that wiki page under the self-gravity section of my user page). Namely, I computed the Jeans length (in cm) for a gas of density rho = 3.34d-21 g/cc, temperature T = 100 K, and gamma = 1.0001. I then seeded the grid (that was 50x Jeans length long) with the prescribed density, velocity, and pressure perturbations as derived before. The density form was straightforward,

where rscale = rho_0, and k is the wavenumber of the Jeans mode.

The background pressure (P0) and pressure perturbation (P1) was given by the ideal gas law,

The velocity formula was a little more involved, looking like

where the growthrate is given by,

In order to keep the velocity perturbation dimensionless, the factor out in front of the Sin(kx) needed to be scaled to computational units. This involved a factor of lscale for k, rhoscale for rho_0 in the growthrate, and a term for scaled gravity in the growthrate.

# Scaling gravitational constant

To get a form for 'scalegrav', I noted I needed a scale factor for time, given the units of G are

To derive a scale for time, I needed to use the 3 scales I had already defined: lscale, rhoscale, pscale. I did this with the following equations,

which gives an expression for the relationship between the scales. Rearranging and solving for timescale, we have

Thus, the scaled version of the gravitational constant is given by,

With all quantities properly scaled, the initial condition (in computational units) looks like,

density:

velocity:

and pressure:

With these initial conditions for the primitive variables of the hydro solver, I then began time-stepping through the solution, using periodic boundaries on both my box and poisson solver (see).

# Boundary Conditions

To test my code with the Jeans instability test, I used periodic boundary conditions on the box and the poisson solver. For periodic BCs on the elliptic solver, this required subtracting off the mean density from the vector for rho, and using this as the source function.

# Code Outline

- Sets up problem scales
- Initializes the grid with the prescribed perturbations for Jeans instability
- Sets boundary conditions on box
- Finds max speed and uses CFL condition to get dt
- Takes a hydro step; i.e. solves the local Riemann problem, gets fluxes, updates cells
- Takes a source step, finds the mean of the density distribution, sets up the source term vector f=4 Pi G (rho-rhoavg), sends to the Jacobi solver, finds the solution for the gravitational potential phi, using phi, updates the velocity and energy of the cells
- Updates time and checks whether tfinal has been reached
- Sets boundary conditions on box
- Gets dt
- …

# Results

To get the final time (in computational units), I had the code print out tfinal=5/growthrate, and used this in my problem.data for the simulation time. I defined a new array to send to the poisson solver for the source function, that was the density array with the mean density subtracted off.

### Attachments (3)

- rhohydroinit.png (35.1 KB ) - added by 11 years ago.
- phydroinit.png (9.2 KB ) - added by 11 years ago.
- uhydroinit.png (66.6 KB ) - added by 11 years ago.

Download all attachments as: .zip

**Note:**See TracWiki for help on using the wiki.