Skip to content
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

Shock tube eqs #1058

Open
Fratorhe opened this issue Jul 15, 2024 · 2 comments
Open

Shock tube eqs #1058

Fratorhe opened this issue Jul 15, 2024 · 2 comments
Labels

Comments

@Fratorhe
Copy link

Fratorhe commented Jul 15, 2024

Hello,

I am trying to implement the shock tube equations as described in: https://en.wikipedia.org/wiki/MUSCL_scheme
Currently, I have implemented it as described in the attached file.
However, I get this error: AttributeError: 'binOp' object has no attribute 'divergence'.
I used the term (u * p).divergence as described in the FAQ

shocktube (copy).txt

Instead, if I rewrite the term (u * p).divergence as:
+ p.grad[0] * u + u.grad[0] * p
The code performs decently well, leading to the comparison shown in the attachments compared to literature values (dashed -- lines).
The two solid lines correspond to:

  • Blue: 2000 cells, no sweep.
  • Orange: 600 cells, with sweep.

velocity_comparison.pdf
pressure_comparison.pdf
density_comparison.pdf

Could you give me some advice on the best way to set it up?

Best,
Francisco

PS. I saw this old mailing list post: https://fipy.nist.narkive.com/ZLce9x2l/compressible-euler-equations
but the files are not attached...

@wd15
Copy link
Contributor

wd15 commented Jul 17, 2024

It appears that .divergence doesn't work for CellVariables. It does work for FaceVariables so it's best to evaluate (u * p) as a FaceVariable. Use (u.faceValue * p.faceValue).divergence to make it work. It's best to use that form as u and p might be constrained on the boundaries and this format should pick that up (instead of (u * p).faceValue.divergence).

Note that the text at the end of this section in the FAQ appears to suggest that .divergence does exist for CellVariables, which is not the case.

@Fratorhe
Copy link
Author

This worked well, thanks a lot!

@guyer guyer added the question label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants