Skip to content

Conversation

@yungyuc
Copy link
Member

@yungyuc yungyuc commented Oct 22, 2022

See https://github.com/solvcon/mmnote for the notes for the shock tube problem.

@yungyuc yungyuc added the enhancement New feature or request label Oct 22, 2022
Copy link
Member Author

@yungyuc yungyuc left a 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
Copy link
Member Author

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-')
Copy link
Member Author

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]>
Copy link
Member Author

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.
Copy link
Member Author

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.
Copy link
Member Author

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.
Copy link
Member Author

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.
Copy link
Member Author

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.

@yungyuc yungyuc self-assigned this Oct 22, 2022
@yungyuc yungyuc merged commit fefa778 into solvcon:master Oct 22, 2022
@yungyuc yungyuc deleted the feature/shocktube-analytical branch October 22, 2022 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant