-
Notifications
You must be signed in to change notification settings - Fork 56
Add code for the analytical solution of the shock tube problem #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
yungyuc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first version of the analytical solution. Unit tests are added.
| self.step = 0 | ||
|
|
||
| self.svr = svr | ||
| self.shocktube = shocktube |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new shocktube object contains both the analytical and numerical solution.
| self.line_velocity, = self.ax.plot(x, svr.velocity[::2], 'g+') | ||
| self.line_pressure, = self.ax.plot(x, svr.pressure[::2], 'b+') | ||
| self.ax.grid() | ||
| self.density_ana, = self.ax.plot(x, st.density_field, 'r-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plot for both analytical and numerical solution.
| @@ -0,0 +1,312 @@ | |||
| # Copyright (c) 2022, Yung-Yu Chen <[email protected]> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The euler1d module is now public.
| def __init__(self): | ||
| self.gamma = None | ||
|
|
||
| # Zones 1 and 5 are given. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order the zone variables by the calculation order.
| # and 5). | ||
| p45 = self.calc_pressure45() | ||
|
|
||
| # Use the normal shock relationship. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First step after the given conditions: use the normal shock relationship
| self.velocity3 = self.velocity4 | ||
| self.pressure3 = self.pressure4 | ||
|
|
||
| # Use the expansion wave for density in zone 3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second step after the given: use expansion wave.
| coord = self.svr.coord[::2] # Use the numerical solver. | ||
| self.coord = coord.copy() # Make a copy; no write back to argument. | ||
|
|
||
| # Determine the zone location and the Boolean selection arrays. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calculate the field by zone.
See https://github.com/solvcon/mmnote for the notes for the shock tube problem.