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

fix pstar convergence in exact_riemann use std::abs() #2898

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Util/exact_riemann/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ https://ui.adsabs.harvard.edu/abs/2015ApJS..216...31Z/abstract
and more details are given there.

To build the solver, simply type 'make' in this directory.


Notes:

* ``test2`` is a vacuum

The velocity in the star region should be 0, but it seems that
slight differences in the rarefaction integration from the left and
from the right give different roundoff, resulting in a small, finite
velocity. This can be controlled a bit by tightening the tolerance
in the rarefaction integration.
9 changes: 4 additions & 5 deletions Util/exact_riemann/riemann_star_state.H
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ riemann_star_state(const amrex::Real rho_l, const amrex::Real u_l, const amrex::

amrex::Real pstar_new = pstar - Z_l * Z_r * (ustar_r - ustar_l) / (Z_l + Z_r);

// estimate the error in the current star solution
amrex::Real err1 = std::abs(ustar_r - ustar_l);
amrex::Real err2 = pstar_new - pstar;
// estimate the error in the current pstar solution

if (err1 < tol * amrex::max(std::abs(ustar_l), std::abs(ustar_r)) &&
err2 < tol * pstar) {
amrex::Real error = std::abs(pstar_new - pstar);

if (error < tol * pstar) {
converged = true;
}

Expand Down