Next: Making a hydrodynamics code
Up: Introduction
Previous: Numerical approach
Since programming this solver is a lot of work and requires even more
knowledge of the mathematics behind the equations than I described
above, I provide subroutines which contains the Roe solver, one in FORTRAN,
the other in C++. Both can be found in the anonymous ftp directory
ftp://ftp.strw.leidenuniv.nl/pub/mellema/Num_Hydro.
The FORTRAN version can be found in the file roesol.f. This subroutine
takes as input
- dr (real*8) -- the cell size
- dt (real*8)-- the time step
- gamma (real*8)-- the adiabatic index
- vol (real*8 array (0:meshmax+1)) -- the volume factor
of each cell ( in the spherical case)
- state (real*8 array (0:meshmax+1,3)) -- the state
vector
. Note that unlike the definition of in Eq. 10, this state vector should not contain the volume terms.
- flux (real*8 array (meshmax+1,3)) -- the interface
fluxes for , see Eq. 11.
- meshr (integer*4) -- size of the grid; should be smaller
than meshmax.
- ictl (integer*4) -- control variable ( in case of
errors).
The grid is assumed to be meshr cells, with meshr given in
as an argument to the the subroutine. meshr should be smaller
than the maximum size, meshmax, a parameter of the subroutine
(currently set to 2000). The points 0 and meshr+1 are the
boundary points.
There is also a C++ version of the routine, which can be found in the
file roesol.cpp. This version also needs the incldue files
Euler.h and EulerMath.h.
Next: Making a hydrodynamics code
Up: Introduction
Previous: Numerical approach
Garrelt Mellema
2003-01-20