Version 2 (modified by 13 years ago) ( diff ) | ,
---|
Building a 1D Hydro Code
Introduction
I've created this page to document the important aspects of building a hydro code. It contains general information that I have learned from reading Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction by E.F. Toro. In the near future, it will contain useful information from my own personal experience as I build my first hydro code.
The Euler Equations
These are the so called Euler Equations. They are also known as the fluid equations in conservative-law form. These are conceptually simple and make intuitive sense.
Name of Law | Formula |
Conservation of Mass | |
Conservation of Momentum | |
Conservation of Energy |
Where
Solving the Riemann Problem
The Riemann problem is essentially the Euler equations with discrete initial conditions. Initial data has a left state and a right state, separated by a discontinuity.
Discretisation
Discretisation is the process of taking a domain and dividing it into cells. Each cell contains data corresponding to a specific problem initialization thus creating many Riemann problems. In other words, each neighboring pair of cells is now a "local" Riemann problem. Given two neighboring cells, the left cell is the left data state, the right cell is the right data state, and the intercell boundary is the discontinuity position. Now each local Riemann problem can be solved and that solution can be used to calculate the fluxes required to update the cells to the next time step.
Godunov's First Order Upwind Scheme
Program Outline
These are the basic steps in my program SEEQUOD (Solver for Euler EQUations in One Dimension). SEEQUOD currently uses an exact Riemann solver, but will later be updated to use approximate Riemann solvers as well. Also, SEEQUOD currently uses a first order Godunov upwind scheme, but again will later be updated to use higher order update schemes. These steps should be general enough to apply to many codes that are used to solve the Euler Equations.
- Read all input data necessary for problem
- Initialize domain cells
- Begin time stepping procedure
- Apply boundary conditions for "ghost" cells
- Impose CFL condition to get appropriate time step
- Begin flux calculation procedure
- Solve local Riemann problem
- Use solution from Riemann solver to compute fluxes
- Repeat flux calculation procedure until fluxes are computed for all cells
- Use fluxes to update conserved variables
- Use updated conserved variables to update primitive variables
- Repeat time stepping procedure until final time is reached
- Output data to a file
Attachments (34)
- test1_intenergy.png (14.3 KB ) - added by 13 years ago.
- test1_pressure.png (13.7 KB ) - added by 13 years ago.
- test1_velocity.png (12.5 KB ) - added by 13 years ago.
- test2_density.png (17.1 KB ) - added by 13 years ago.
- test2_intenergy.png (17.9 KB ) - added by 13 years ago.
- test2_pressure.png (16.4 KB ) - added by 13 years ago.
- test2_velocity.png (15.2 KB ) - added by 13 years ago.
- test3_density.png (10.7 KB ) - added by 13 years ago.
- test3_intenergy.png (12.9 KB ) - added by 13 years ago.
- test3_pressure.png (12.4 KB ) - added by 13 years ago.
- test3_velocity.png (12.7 KB ) - added by 13 years ago.
- test4_density.png (10.9 KB ) - added by 13 years ago.
- test4_intenergy.png (12.2 KB ) - added by 13 years ago.
- test4_pressure.png (12.8 KB ) - added by 13 years ago.
- test4_velocity.png (9.9 KB ) - added by 13 years ago.
- test5_density.png (10.2 KB ) - added by 13 years ago.
- test5_intenergy.png (12.6 KB ) - added by 13 years ago.
- test5_pressure.png (12.5 KB ) - added by 13 years ago.
- test5_velocity.png (12.8 KB ) - added by 13 years ago.
- hllc_test1_density.png (11.5 KB ) - added by 13 years ago.
- test1_density.png (11.5 KB ) - added by 13 years ago.
- roe_nofix_test1_density.png (11.5 KB ) - added by 13 years ago.
- roe_withfix_test1_density.png (11.5 KB ) - added by 13 years ago.
- hllc_test1_intenergy.png (13.8 KB ) - added by 13 years ago.
- hllc_test1_pressure.png (11.5 KB ) - added by 13 years ago.
- hllc_test1_velocity.png (12.3 KB ) - added by 13 years ago.
- muscl_test1_density.png (11.3 KB ) - added by 13 years ago.
- muscl_test1_intenergy.png (13.7 KB ) - added by 13 years ago.
- muscl_test1_pressure.png (11.3 KB ) - added by 13 years ago.
- muscl_test1_velocity.png (12.2 KB ) - added by 13 years ago.
- muscl_test2_density.png (17.2 KB ) - added by 13 years ago.
- muscl_test2_intenergy.png (16.7 KB ) - added by 13 years ago.
- muscl_test2_pressure.png (16.0 KB ) - added by 13 years ago.
- muscl_test2_velocity.png (14.8 KB ) - added by 13 years ago.
Download all attachments as: .zip