Version 8 (modified by 12 years ago) ( diff ) | ,
---|
Introduction
The method I chose for practice writing a higher dimension code is the 1st order accurate, split scheme, Godunov + Exact Riemann Solver to solve the 2D Euler equations for a cylindrical explosion. Given the higher dimension of the problem, new types of waves are present in the solution, namely shears. Shears are passively advected with the flow, as can be shown by combining the continuity equation and the corresponding momenta equations.
Initialization
This method begins by initializing a 2D Cartesian grid, with a circle in the center. The primitive fluid variables (rho, x-velocity, y-velocity, pressure) are set inside and outside of this circle.
The essence of split schemes
It can be proven for linear systems of equations of higher dimension, that splitting the problem into x and y components yields an exact solution. For non-linear systems, the effort leads to a highly accurate (but not exact) solution. The concept is as follows.
We begin with a 2D mesh of initial condition
where u is the vector of primitive variables. To solve the Euler equations for this given initial condition, we split the 2D Euler equations,
into 2, 1D problems. In the x-split direction, this is given by,
and in the y- split direction this is,
Note that the first 3 equations of these different splits form just the 1D problem we have solved before. From a computational perspective, the difference for solving these sets of equations then is 1) the extra momentum equation, and 2) the presence of tangential velocity components that factor into E.
Now, the x- and y- split equations are solved on the grid independently. First the grid is sweeped in the x-direction, where it goes cell by cell on a given row and solves the initial value problem (IVP) given by the x-split equation above + the initial condition prescribed for the mesh. Once a row is is traversed, the next is traversed, until all of the grid has been solved in the x-split direction. This, by the way, is done the "normal" way— using the Godunov conservative update formula in conjunction with the exact Riemann solver.
The solution data for the x-split mesh is then stored in a 2D array, and used as the initial condition for the y-direction sweep. This sweep proceeds as above, this time moving cell by cell along a given column solving the IVP given by the y-split Euler equations above (and initial condition that is the SOLUTION to the previous x-split sweep). Once a column is traversed, the next is until the entire grid is sweeped. The solution to this last sweep is the solution to the full IVP (evolved to t+dt).
This process repeats for as many dt's needed to get to the final time of the simulation. Note, the dt is the SAME for both the x- and y-sweeps.
The method of choosing the best dt is described in Toro, chapter 16.
Upsides / Downsides
The good aspects of this choice of method (split, Godunov + Exact Riemann Solver) are: 1) accurate resolution of shear waves, 2) simple to construct.
The downside is: 1) not higher order (if wanted to add this - code could become quite complex to take into account the addition of shears into the TVD algorithms)
Download the code here
Results for cylindrical explosion
Attachments (3)
- uInit.png (10.1 KB ) - added by 11 years ago.
- rhoInit3d.png (20.4 KB ) - added by 11 years ago.
- densityMovie.gif (79.7 KB ) - added by 11 years ago.
Download all attachments as: .zip