Skip to content

Commit

Permalink
more exact Riemann cleaning (#2875)
Browse files Browse the repository at this point in the history
remove co_moving_frame stuff
also start removing runtime parameter from the solver itself
  • Loading branch information
zingale authored Jun 24, 2024
1 parent 6e52378 commit 61df340
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 100 deletions.
4 changes: 0 additions & 4 deletions Util/exact_riemann/_prob_params
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,3 @@ npts integer 128 y
use_Tinit integer 0 y

initial_temp_guess real 1.0d5 y

riemann_max_iter integer 10 y

co_moving_frame integer 0 y
90 changes: 45 additions & 45 deletions Util/exact_riemann/ci-benchmarks/test1-riemann.out

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions Util/exact_riemann/exact_riemann.H
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ exact_riemann() {

}

if (problem::co_moving_frame) {
amrex::Real W_avg = 0.5_rt * (problem::u_l + problem::u_r);
problem::u_l -= W_avg;
problem::u_r -= W_avg;
}

amrex::Real ustar, pstar, W_l, W_r;

riemann_star_state(problem::rho_l, problem::u_l, problem::p_l, xn,
Expand Down Expand Up @@ -86,12 +80,6 @@ exact_riemann() {
x, problem::xjump, problem::t,
rho, u, p, xn_s);

if (problem::co_moving_frame) {
amrex::Real W_avg = 0.5_rt * (problem::u_l + problem::u_r);
u += W_avg;
x += problem::t * W_avg;
}

// get the thermodynamics for this state for output

eos_t eos_state;
Expand Down
21 changes: 0 additions & 21 deletions Util/exact_riemann/inputs.moving

This file was deleted.

4 changes: 1 addition & 3 deletions Util/exact_riemann/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
#include <prob_parameters.H>
#include <eos.H>
#include <network.H>
#include <castro_params.H>

#include <exact_riemann.H>

int main(int argc, char *argv[]) {

amrex::Initialize(argc, argv);

std::cout << "starting the exact Riemann solver..." << std::endl;
std::cout << argv[1] << std::endl;
std::cout << strlen(argv[1]) << std::endl;

// initialize the external runtime parameters in C++

Expand Down
3 changes: 0 additions & 3 deletions Util/exact_riemann/riemann_rarefaction.H
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ riemann_invariant_rhs2(const amrex::Real u, const amrex::Real tau, const amrex::

amrex::ignore_unused(u);

std::cout << "in riemann_invariant_rhs2: " << u << " " << tau << " " << p << std::endl;
eos_rep_t eos_state;
eos_state.rho = 1.0_rt / tau;
eos_state.p = p;
Expand Down Expand Up @@ -326,8 +325,6 @@ rarefaction_to_u(const amrex::Real rho_s, const amrex::Real u_s, const amrex::Re

bool finished = false;

std::cout << "integrating from u: " << u << " " << ustop << " " << xi << " " << c << std::endl;

// this will be used as an initial guess to accelerate the EOS inversions

amrex::Real T = eos_state.T;
Expand Down
4 changes: 0 additions & 4 deletions Util/exact_riemann/riemann_shock.H
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ shock(const amrex::Real pstar,
2.0_rt * (1.0_rt - gammaE_bar / gammaC_bar) * (gammaE_bar - 1.0_rt) *
(pstar - p_s) / (pstar + p_s);

std::cout << "pstar, ps = " << pstar << " " << p_s << " " << gammaE_s << " " << gammaE_star << std::endl;
std::cout << (pstar/rho_s - (gammaE_star - 1.0_rt)/(gammaE_s - 1.0_rt) * p_s/rho_s);
std::cout << (pstar + 0.5_rt * (gammaE_star - 1.0_rt) * (pstar + p_s));

// there is a pathological case that if p_s - pstar ~ 0, the root finding
// just doesn't work. In this case, we use the ideas from CG, Eq. 35, and
// take W = sqrt(gamma p rho)
Expand Down
13 changes: 5 additions & 8 deletions Util/exact_riemann/riemann_star_state.H
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ riemann_star_state(const amrex::Real rho_l, const amrex::Real u_l, const amrex::
// find the exact pstar and ustar

std::cout << "solving for star state: " << std::endl;
std::cout << rho_l << " " << u_l << " " << p_l << std::endl;
std::cout << rho_r << " " << u_r << " " << p_r << std::endl;


// this procedure follows directly from Colella & Glaz 1985, section 1
// the basic idea is that we want to find the pstar that satisfies:
Expand Down Expand Up @@ -111,14 +108,13 @@ riemann_star_state(const amrex::Real rho_l, const amrex::Real u_l, const amrex::
bool converged = false;

int iter = 1;
while (! converged && iter < problem::riemann_max_iter) {
while (! converged && iter < riemann_solver::max_iters) {

// compute Z_l, W_l and Z_r, W_r -- the form of these depend
// on whether the wave is a shock or a rarefaction

amrex::Real Z_l, Z_r;

std::cout << "iteration: " << iter << " " << pstar << " " << p_l << " " << p_r << std::endl;
// left wave

if (pstar - p_l > SMALL * p_l) {
Expand Down Expand Up @@ -146,9 +142,6 @@ 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);

std::cout << "done with iteration " << iter << std::endl;
std::cout << "ustar_l/r, pstar: " << ustar_l << " " << ustar_r << " " << pstar_new << std::endl;

// estimate the error in the current star solution
amrex::Real err1 = std::abs(ustar_r - ustar_l);
amrex::Real err2 = pstar_new - pstar;
Expand All @@ -164,6 +157,10 @@ riemann_star_state(const amrex::Real rho_l, const amrex::Real u_l, const amrex::
iter++;
}

if (! converged) {
amrex::Error("star state did not converge");
}

ustar = 0.5_rt * (ustar_l + ustar_r);

std::cout << "found pstar, ustar: " << pstar << " " << ustar << std::endl;
Expand Down

0 comments on commit 61df340

Please sign in to comment.