Aaron T. Lee's Homepage
Astronomy education, outreach, and research

Variable Gamma

Variable Gamma

 

Digital Notebook

Because we keep forgetting what we have and have not done, this page will be intended as a digital notebook that documents what we have done and what needs to be done.

 
 

Table of contents

  • Pre-Variable Gamma
    • Functions
    • Sod Tube Tests
  • The Gamma Array
  • Changing the Riemann Solver
  • Variable Gamma Tests
 

Pre-Variable Gamma

Before implementing the variable gamma array, here are some functions that will be implemented. 

  • getGamma() -- Instead of accessing the global variable 'gmm,' every call to this value in Orion2 will be replaced with getGamma(), which will still return this global value gmm when variable gamma is turned off, else it will access another array where gamma is stored for each cell. 
  • GETGAMMA() -- Fortran version of getGamma().
  • detGamma() -- At the beginning of each time step for each AMR level, detGamma() will be called in order to calculate the current value of gamma based on the cell's updated values of rho, e, and chemical abundances. This can be done in one of two ways, depending on what detGamma() passes to calcGamma(). 
  • calcGamma() -- If you input a temperature, gamma is calculated via its definitional formula. It is based off the abundances of H, He, and H_2. If you input instead an energy density, this routine uses an optimized Newton-Rhapson routine that will simultaneously calculate gamma and T from the equation of state. This is necessary because we impose gamma(H_2) as a function of temperature. 
 

One test that will be necessary to test the implementation will be the classic Sod shock tube test. Since this is a direct test of the Riemann solver, we will want to ensure that this problem continues to pass the test even when variable gamma is turned on. 

The non-variable gamma Sod Problem. Using (Nx,Ny,Nz) = (400,8,8), with two levels of refinement (refine on density gradients of 0.05), starting with t_init = 1e-6, Courant of 0.5, and allowing t to change by no more than a factor of 1.1. Outputting every 0.05 gives the third output at t = 0.15, which is displayed here. The simulation uses a domain that ranges from 0 to 1, but the plotting routine adjusts so the initial diaphragm is at x = 0. 

Sod Problem, no variable gamma, initial conditions. Done with the hydro solver and hllc.

Sod Problem, no variable gamma, initial conditions. Done with the hydro solver and hllc.

t=0.15 Sod Problem. No variable gamma implemented. Done with the hydro solver and hllc. 

t=0.15 Sod Problem. No variable gamma implemented. Done with the hydro solver and hllc. 

Since most of our actual problems use MHD, we rerun the Sod problem with the MHD and hlld solver, setting B to zero. All seems well. 

Same as above but with MHD, hlld, B=0

Same as above but with MHD, hlld, B=0

Same as above but with MHD, hlld, B=0

Same as above but with MHD, hlld, B=0

It was brought to our attention that Orion2 has never been tested with the Sod diaphragm initialized at an angle to a Cartesian direction. 

BUG Note: Having the diaphragm at an angle with MHD and AMR results in the time step plummeting to 1e-13 from a starting value of 1e-6. When AMR is turned off, it works fine. 

Trying with the HD solver, 400 x 400 x 8 grid, with a 30 degree angle.

128^3, 30 degree angle, no AMR, MHD

128^3, 30 degree angle, no AMR, MHD

400 x 400 x 8, 30 degree, 2 AMR levels, HD

400 x 400 x 8, 30 degree, 2 AMR levels, HD

 

Gamma Array

The value of gamma will be determined by the composition and energy density of the cell. The value for each cell is independent of every other cell, and each level is independent of every other level. It is calculated and stored rather than being calculated on the spot every time the value of gamma is required (calculating the value of gamma requires a Newton-Rhapson solve, which is not as fast as a function evaluation). The value is stored in a gamma array, which is an array that is independent of the state vector array, cause apparently that is too hard to implement and Orion2 is hardcoded in weird ways so to discourage this. It was originally contemplated to be a tracer field entry, but that did not make a whole lot of sense, as gamma is not advected nor is gamma part of a primitive/conservative variable pair (as is, say the velocity and momentum, or pressure and energy density).