Version 2 (modified by 8 years ago) ( diff ) | ,
---|
Exact Riemann Solver (no vacuum)
The Riemann problem is the solution of a system of hyperbolic conservation laws (in our case the Euler equations). This solver assumes two one-dimensional ideal gases separated at the origin x=0, with initial densities, velocities, and pressures given as input. It gives a solution to the set of equations
with initial conditions
The solutions to this IVP at later times are split into four regions - to the left, the initial left state, unperturbed by interaction with the right; between the left and center-left regions, there will either be a rarefaction fan or a shock (assumed ideal), across which the new equilibrium left state holds; the left and right fluids will be separated by a contact discontinuity, across which the new equilibrium right state holds (note that the right and left equilibrium states differ only in their densities); the center-right region will then be separated by a rarefaction fan or (again ideal) shock from the rightmost region, which is still in the initial right state.
The program reads input from a file called problem.data, and stores many of the relevant parameters in global variables.
NAMELIST/ProblemData/ rhoL,uL,pL,rhoR,uR,pR,gamma,tol,starttime,finaltime,frames,xL,xR,res inquire(file='problem.data', exist=ex) if (ex) then OPEN(UNIT=30, FILE='problem.data', STATUS="OLD") READ(30,NML=ProblemData) ! read into variables in namelist CLOSE(30) else print *, 'Missing problem.data. Exiting.' stop ! exit if missing end if
The state vectors WL and WR are created with overloaded constructors that also calculate useful parameters A and B and the speed of sound c for use later in the program.
These state vectors are then passed to the Newton-Raphson solver, which calls a subroutine to guess a good value for p0 (currently not very effective - just uses tol) and then iterates until the tolerance for change in pressure between steps is met.
See below for derivation of function f.
From the shock jump conditions
and the energy and EOS of an ideal gas
where
is the velocity of the fluid in the frame of the shock, the function ,can be derived to connect the left state with the pressure in the central, interaction region in the case of a shock. Similarly, in the case of a rarefaction, instead of the shock jump conditions, the isentropic equation
and the Generalized Riemann Invariant
where
is the speed of sound in the region, can be used to constructThe same analysis can be performed on the right side of the system to yield the same results.
The Riemann problem can then be solved by finding the value
such thatThe function and its first and second derivatives are well-behaved and monotonic, so we can use a simple Newton-Raphson iterative method, derived from a Taylor series expansion of f(p_*):
If our initial guess is
and , we want to change so that ; the Taylor expansion is given byDropping second order and higher terms, since we have
, we know , and solving for ,and
The iteration procedure is terminated at the term such that
where
is the (generally small) tolerance passed to the solver.Source: See Toro, Riemann Solvers and Numerical Methods for Fluid Dynamics
Attachments (10)
- test1.mp4 (8.6 MB ) - added by 8 years ago.
- test2.mp4 (5.8 MB ) - added by 8 years ago.
- test3.mp4 (171.2 KB ) - added by 8 years ago.
- test4.mp4 (333.7 KB ) - added by 8 years ago.
- test5.mp4 (1.3 MB ) - added by 8 years ago.
- ExactSolver.tar (35.5 KB ) - added by 8 years ago.
- GodunovSolver.tar (26.5 KB ) - added by 8 years ago.
- code.tar (94.0 KB ) - added by 8 years ago.
- GodunovEulerSolver.tar (45.5 KB ) - added by 8 years ago.
- AllCode.tar (93.0 KB ) - added by 8 years ago.