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

Shallow water solvers with bathymetry #126

Merged
merged 24 commits into from
Mar 31, 2017
Merged

Conversation

ketch
Copy link
Member

@ketch ketch commented Mar 5, 2017

This PR adds 3 solvers:

  1. A 1D f-wave solver for SW with bathymetry;
  2. A 2D f-wave solver for SW with bathymetry (normal only);
  3. Normal and transverse versions of the "augmented" 2D SW solvers from Geoclaw. These solvers are made PyClaw-compatible by avoiding the use of modules, which f2py couldn't handle. In the process of making this work, I removed some functionality, like mappings to the sphere and alternative solver versions. This could all be added back in; I was just trying to minimize the number of places where bugs could occur.

This is a replacement for #86, which has been waiting for over 2 years. I know the long-term dream is to do a major overhaul of the Geoclaw solvers, but I don't want to wait on that before merging this.

* master: (62 commits)
  Use simple average of wavespeeds for 2nd-order term in traffic solvers.
  Avoid artificially small CFL numbers in traffic_vc solver.
  Make q-wave traffic solvers the default.
  Replace variable-speed traffic solver with more accurate q-wave version.
  Correctly compute fluctuations for transonic shocks in vc traffic solver.
  Use underscore instead of space in 'stress_relation' key.
  Cosmetic changes to nonlinear_elasticity Python solver.
  Switch back to using f-waves in variable-speed traffic solvers.
  Add quadratic stress-strain relation as option in Python nonlinear elasticity solver.
  Update LWR traffic solvers.
  Revert "Improvements to and new solvers for LWR traffic model."
  Improvements to and new solvers for LWR traffic model.
  Don't import different solvers under the same name.
  Don't import different solvers under the same name.
  Run python-modernize on all files.
  cleaned up indentation of comments only in rpn2_shallow_roe_with_efix.f90
  the common block containing grav is needed in rpn2_shallow_roe_with_efix.f90
  Make sonic check more efficient
  modify fw(3,:) in riemann_aug_JCP geoclaw solver to put transverse velocity jump into fw(3,1) or fw(3,3) depending on interface velocity rather than into fw(3,2), as suggested by Wenwen Li.
  change sonic test to use different criticaltol as proposed by Wenwen Li
  ...
@ketch
Copy link
Member Author

ketch commented Mar 7, 2017

The augmented solver here is used in https://github.com/clawpack/apps/blob/master/notebooks/pyclaw/beach.ipynb.

The 1D f-wave solver is tested in clawpack/pyclaw#564.

@mandli
Copy link
Member

mandli commented Mar 7, 2017

Is the Python version and Fortran version consistent? I vaguely recall that there may be a discrepancy that should be fixed.

* master:
  Turn on entropy fix.
  Cleanup of Roe shallow water solver.
  Add new Roe shallow water solver with tracer.
@mandli
Copy link
Member

mandli commented Mar 7, 2017

Also thanks for resurrecting this. My dream of refactoring the solver was too ambitious clearly.

@ketch
Copy link
Member Author

ketch commented Mar 7, 2017

The Python and Fortran 1D f-wave solvers do give slightly different answers, so they must be doing something different. Let me take a look.

@ketch
Copy link
Member Author

ketch commented Mar 7, 2017

I ran a quick test and they are pretty close:

https://gist.github.com/ketch/8adf1ba9eb6e11ca8dfa996e7e1193a5

They are a bit different but both seem "correct" to me.

@mandli
Copy link
Member

mandli commented Mar 7, 2017

I can take a look, I may remember what I thought might have been wrong.

@mandli
Copy link
Member

mandli commented Mar 7, 2017

so the big difference between the two is that Python uses HLL like speeds and the Fortran uses the Roe speeds. We should probably both change to using the Einfeldt speeds. I can make the changes to both if you want.

@ketch
Copy link
Member Author

ketch commented Mar 7, 2017

That would be great. After you make the changes just issue a PR against my shallow_fwave branch.

mandli and others added 4 commits March 7, 2017 17:49
Also corrected some bugs that were found and added more problem parameters
to the Python version.
Reconcile differences between python and fortran RP for swe
… shallow_fwave

* 'shallow_fwave' of https://github.com/ketch/riemann:
  Add sea_level to common block
  Reconcile differences between python and fortran RP for swe
@ketch
Copy link
Member Author

ketch commented Mar 7, 2017

I reran the comparison and now things match up to roundoff (check the gist linked above; updated).

I guess we should make the same changes to the 2D fwave solver...

@mandli
Copy link
Member

mandli commented Mar 7, 2017

Ah sorry, should have checked that. I can do that as well.

@mandli
Copy link
Member

mandli commented Mar 8, 2017

So I have something done but I was not sure if there was a test for the 2d solver. From your previous comments it does not appear so but I wanted to make sure. I am not confident right now that what I have is going to work as it required some significant reworking of what @ketch wrote.

@ketch
Copy link
Member Author

ketch commented Mar 8, 2017

You're right about the lack of a test. I'll write one and try both versions.

Add Einfeldt speeds to 2D fwave solver
@ketch
Copy link
Member Author

ketch commented Mar 8, 2017

I think we should go ahead and merge this so that clawpack/pyclaw#564 will pass tests. Neither one will pass without the other but I think we can be confident now that together they will pass (and every solver has a test or an app now).

@ketch
Copy link
Member Author

ketch commented Mar 8, 2017

Oh, but it's probably worth deleting the commented-out code first? Sorry, I should have thought about that before I merged the secondary PR.

… shallow_fwave

* 'shallow_fwave' of https://github.com/ketch/riemann:
  remove sea_level comparison
  Initial attempt at incorporation of Einfeldt speeds
@ketch
Copy link
Member Author

ketch commented Mar 9, 2017

Okay, I've been checking more carefully and I was wrong. Commit d765c00 broke the 2D Riemann solver (it quickly generates NaNs for the test case). It's not obvious to me what is wrong with those changes. The older version gives results that look reasonable.

@mandli
Copy link
Member

mandli commented Mar 9, 2017

At the very least the determination of beta is not consistent. I am hoping to get back to this soon so I can try and take a look again.

@ketch
Copy link
Member Author

ketch commented Mar 9, 2017

I think the 1 and 0 arguments to merge are backwards, too. But I switched them and still got NaNs.

ketch added a commit to ketch/clawapps that referenced this pull request Mar 9, 2017
@mandli
Copy link
Member

mandli commented Mar 13, 2017

I fixed some things and switched methods for dealing with the normal and transverse components. There were some issues with the test case that I have corrected but things are still not working with bathymetry. I will continue to look into it.

@ketch
Copy link
Member Author

ketch commented Mar 26, 2017

I believe this is ready to merge now.

@ketch ketch merged commit 5533382 into clawpack:master Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants