Changes between Version 21 and Version 22 of u/ehansen/buildcode
- Timestamp:
- 11/01/11 13:01:39 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
u/ehansen/buildcode
v21 v22 36 36 === 1. Find the pressure and velocity in the star region === 37 37 This pressure is computed through an iteration scheme. You start with a guess for the star pressure. This can be found using approximate Riemann solvers. Then, you calculate pressure functions to get a better value for the pressure. If the difference between the guess pressure and better pressure is below some tolerance then you have found the star pressure. If it is not below the tolerance, the better pressure becomes the new guess pressure and the process repeats. The star velocity is then very straightforward, as it is computed directly from the star pressure. 38 === 2. Sampl ingthe wave speed ===39 Now that we have the solution for the star region, we can get the solution everywhere. This is done by sampling the wave speed S as opposed to sampling the position x. There are essentially 10 possible solutions for any given S :38 === 2. Sample the wave speed === 39 Now that we have the solution for the star region, we can get the solution everywhere. This is done by sampling the wave speed S as opposed to sampling the position x. There are essentially 10 possible solutions for any given S. Let W be a column matrix containing the correct values for the primitive variables. 40 40 ||= =||= Left side of contact discontinuity =||= Right side of contact discontinuity =|| 41 41 ||= Data =||= [[latex($W_L$)]] =||= [[latex($W_R$)]] =|| … … 44 44 ||= Rarefaction Fan =||= [[latex($W_{L}^{FAN}$)]] =||= [[latex($W_{R}^{FAN}$)]] =|| 45 45 46 A sampling procedure involves checking several logical statements to determine which state S is in. 46 A sampling procedure involves checking several logical statements to determine which state S is in. With the Riemann problem now solved, we have the correct values for the ''primitive'' variables. 47 47 [[BR]] 48 48 == Discretisation == … … 107 107 Where v is the particle velocity and a is the sound speed. Like the boundary condition routine, the CFL condition routine must be called every time step since [[latex($S_{max}$)]] is not constant. 108 108 109 Now we have everything we need to write a hydro code. 110 109 111 [[BR]] 110 112 == Program Outline == … … 117 119 * Impose CFL condition to get appropriate time step 118 120 * Begin flux calculation procedure 119 * Solve local Riemann problem 121 * Solve local Riemann problem (primitive variable solution) 120 122 * Use solution from Riemann solver to compute fluxes 121 123 * Repeat flux calculation procedure until fluxes are computed for all cells 122 * Use fluxes to update conservedvariables124 * Use fluxes to update ''conserved'' variables 123 125 * Use updated conserved variables to update primitive variables 124 126 * Repeat time stepping procedure until final time is reached