A 1D gas dynamic solver

P. Judge, version 0.99, 7 June 2011

Description

This document describes a 1D hydrodynamic solver including time evolution of atoms/ions. It is written in IDL. An elementary but modern, method is used to solve for the equations of conservation of mass, momentum, energy and non-equilibrium number densities of species of H, He, C, ... within the solar atmosphere, in 1D. The equations solved are essentially those of Hansteen (1993 Astrophysical Journal, 402, 741-755). Heating is added explicitly, radiation losses are included via a lookup table, conduction is computed explicitly. In short:

Difficulties

The presence of heat conduction makes the equations highly non-linear- the time steps are adjusted so that only small steps in time are taken to ensure the intrinsic second order accuracy of the method.

Method and solution variables

The method used is an explicit time integration of the governing equations on a fixed grid, written in conservative form, using the Total Variation Diminishing Scheme concept. Here a Lax-Friedrich scheme (TVDLF) is adopted (predictor-corrector) to update solution vectors u as a function of time (when param.tvorder=2, otherwise just the first order predictor step is used). The vectors u are

          u(state, position)

Here the vector u specifies a physical variable [cgs units]:

                   u(0,*)= density
                   u(1,*)= density*velocity
                   u(2,*)= total energy density (internal plus thermal and kinetic)
                   u(3,*)= neutral hydrogen population density 
                   u(4,*)= proton population density 
If present, the remaining components (u(5....n,*)) contain number densities of He, He+, He++, C, C+, C++ ....

The algorithm is not efficient nor elegant, but results they appear to be correct. Results are stored in files

                   u0.sav  (state at time t=0)
                   u1.sav  (state at time t=1 sec)
                   ...  
                   uN.sav  (state at time t=N, N integer sec) 

Here is a gif movie of the evolution of vector u starting from a VAL-like atmosphere, but which is heated at constant rates per proton which is 50x that per hydrogen atom. The x-axes are "distance along a complete loop", from chromosphere into the corona and back down into the chromopshere at the other footpoint. It is interesting that an equilibrium has not been found- perhaps this is related to Athay's (2000) proposal that there is an ionization instability at the coronal base.

Code structure:

 

main
        states
	initial
		states
		atmosrd
		doublit
                specno
		seqtri
		gravity
	cpcv
	uplot
                states
	tvdlf
		delubar
			minmod
                call_function(param.driver)
                changes
		source
		flux
		csound
		impstep
		bound
                        boundaries

Each function/procedure is briefly documented as to its function in the procedure's header.

How to run it

Using the SSWIDL environment, simply unpack the tarball. Move to the sub-directory

example
which contains two files needed to set some parameters. Edit the file
inpt  !! EDIT THIS 
to point to the datadir directory on your system), start sswidl, and type

IDL> .run main

A window will pop up which lists the input parameters (it is an "xstruct" window IDL> xstruct,param,/edit): you can edit the values there, click commit and the program should run. Here is a list of parameters:



IDL> help,param
** Structure <31f1208>, 31 tags, length=320, data length=306, refs=1:
   GAMMA           DOUBLE           1.6666667
   BCONST          DOUBLE       1.3806200e-16
   ECHARGE         DOUBLE       1.6021890e-12
   MU              DOUBLE           1.3625000
   UMASS           DOUBLE       1.6600000e-24
   SIGMA           DOUBLE       5.6695600e-05
   KAPPA0          DOUBLE      -1.0000000e-06
   ALPHA           DOUBLE           2.5000000
   GRAV            DOUBLE          -27542.291
   HEATP           DOUBLE       2.0000000e-12
   HEATN           DOUBLE       2.0000000e-14
   DRIVER          STRING    'burst3e'
   ELEMENTS        STRING    Array[5]
   SPECMIN         INT       Array[5]
   SPECMAX         INT              8
   DATADIR         STRING    '/Users/judge/Projects/1dhd/datadir/'
   NX              INT           1025
   XMIN            DOUBLE           80000000.
   XMAX            DOUBLE       2.0839139e+09
   LIMITER         STRING    'superbee'
   TVORDER         INT              1
   RESTART         INT              2
   SOURCE_MULT     DOUBLE           1.0000000
   SLOWDOWN        DOUBLE           5.0000000
   IMPLICIT        DOUBLE           0.0000000
   COURANT_N       DOUBLE          0.80000000
   TSMALL          DOUBLE       1.0000000e-05
   TMAX            INT             30
   OSPLIT          INT              1
   DEBUG           INT              0
   IELEMENTS       INT       Array[5]

See the files

inpt

for a description of these parameters. This file sets default parameter values, which can be edited using the window which pops up after executing the IDL>.run main command.

Here is the popup window, only scalar values can be edited here.

The xstruct window

xstruct window, the scalar values can be edited and pressing "commit" will run the program, integrating up the state variables in time.

During run time, two windows pop up. Examples are given here:

Snapshot of
  evolution

Snapshot of the evolution of thermodynamic parameters.

Snapshot of changes

Snapshot of instantaneous changes in time, of the state variables as a function of position along the loop, x. In this case the state variables are rho, rho.v, total energy, hydrogen and proton densities, and the densities of neutral, ionized and doubly ionized helium, and of various ionization stages of carbon , oxygen, and silicon.

The "changes" image plot can be used to see what variables are changing the most and therefore, what variables determine the time step sizes used. this can be handy to see why the code runs slowly under certain conditions (steep gradients in temperature tend to do this).

Looking at the results and post-processing

Just to look at a run afterwards simply do

IDL> umovie

This procedure loops over the saved files u*sav and plots the evolution of the gas dynamic variables.

To examine the data carefully you can select a timestep, the data are currently saved once every second, by doing

IDL> restore,/verb,'u100.sav' ; restore the 100 second calculation
IDL> pp=pnt(u)  ; variable pp contains the presure, number density, temperature
IDL> plot,x, pp(0,*) ; plot pressure against distance along the loop
IDL> plot,x, u(3,*)  ; plot neutral hydrogen number density against distance along the loop
IDL> desc=states()  ;  get the names of the states which are solved for
IDL> print,desc     ; look at the state names 
IDL> plot,x,u(k,*)  ; plot state k against  x. 

Note that the conserved variables are rho, rhoV, total energy, these are in u(0,*), u(1,*), u(2,*), so that the function pnt(u) returns pressure, number density and temperature from these variables.

To look the emission lines after the fact, use at a run afterwards simply do

IDL> postproc, lines, emissivity
IDL> k=where(lines.lambda gt 1547. and lines.lambda lt 1549.) ; select line
IDL> plot_image,reform(emissivity(k(0),*,*))  ; display emissivity as fn. of x and time 

lines
is an IDL structure, and emissivity is the computed emissivity for each line:
emissivity(line_index, x, time)
Use
IDL> help,/structure,lines

to see what the structure variables are.


Last modified: Thu Jan 20 16:12:07 MST 2011