Meeting update- 2D code progress
I have code that now:
1) sets up a 2d mesh with the cylindrical explosion initial conditions
2) prints to file the initial conditions that can than be visualized (easily… ) with mathematica:
Contour plot of initial density, the density (and pressure) are higher inside of the circle:
Here it is in a 3D plot:
and the initial velocity (both in x and y) is zero everywhere on grid:
3) determines the cfl condition, and dt for the time step considering the max speed of waves traveling in either x or y
4) sweeps the grid in the x-direction and solves the local Riemann problem along intercell boundaries in x, taking into account the presence of shears
What I am stuck on doing now is writing these routines only once, so that it can be called for either the x or y sweep, with variables swapped for x and y… I could write the routines the brute force way, so that they are individualized for x and y directions (e.g. Call Sweep in X, Call Sweep in Y), but this is silly, since the equations have the same form in x and y…
I am trying to figure out how to write the routine just once, but as of now my routines involve nested do-loops that cycle through the mesh. By nesting the loops like this, it seems to define a preferred direction for the Riemann problem… one that doesn't seem to be easily swapped if I switch from x to y.
So, that is where I am — trying to write these routines the proper way, one time, and have them called with the variables swapped for x and y directions..
I also spent some time trying to figure out how to visualize the 2D data. I played with importing the 2D array data into the spreadsheet, but the data set was too large for the program to handle easily. This is what it looked like in the spreadsheet initially:
This spreadsheet's cells correspond to points in the mesh, and their values are the value of density at that mesh point. This is why we see the circle in the center of the spreadsheet, the values of these cells have fewer digits than the surround, so it looks like a circle. If the widths of the rows and columns were the same, we would see an actual circle rather than an oval.
I thought if only I could assign colors to the values in the cells, like Visit does in the mesh, it would be like a 2d psuedocolor slice. I tried getting the data into a form Visit liked, but this was time consuming to figure out, and not much information on this on the web.
Then I resorted to mathematica, which was a much easier time once the output was formatted correctly (as a list of (x,y,rho) values: (x1, y1, rho1), (x2,y2, rho2), etc.) These are the contour and 3D plots above.
Update
The fix seems to be to make the problem 1D. That is, in the x- or y-sweep, make 1d arrays corresponding to the row (or column) you are sweeping along, and feed this 1D array into a routine that 1) solves the local RP at the intercell boundaries, and 2)updates the cells along that 1D array using the Godunov conservative formula. By making 1D arrays, and isolating them from the rest of the mesh, the array has no preferred orientation relative to the rest of the mesh. Will work on implementing this fix to my code.
Attachments (4)
- spreadsheet.png (224.7 KB) - added by 11 years ago.
- rhoInit3d.png (20.4 KB) - added by 11 years ago.
- rhoInitContour.png (5.6 KB) - added by 11 years ago.
- uInit3d.png (10.1 KB) - added by 11 years ago.
Download all attachments as: .zip
Comments
No comments.