Skip to content

Commit

Permalink
this now works
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jan 5, 2025
1 parent f208637 commit 644d6ad
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion util/cj_detonation/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MICROPHYSICS_HOME := ../..
EOS_DIR := helmholtz

# This sets the network directory
NETWORK_DIR := subch_simple
NETWORK_DIR := aprox13

CONDUCTIVITY_DIR := stellar

Expand Down
24 changes: 19 additions & 5 deletions util/cj_detonation/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
Compute the Chapman-Jouguet detonation speed. At the moment you set
the state in the source directly (`main.f90`) and then build and
execute as:
Compute the Chapman-Jouguet detonation speed.

The thermodynamic state for the fuel and ash are hardcoded
into main.cpp right now.

You can set the network and EOS in the `GNUmakefile`.

At the moment, this seems to work well with the `aprox13` network.
It does not seem as robust with larger nets, so some work needs to
be done there.


```
main.Linux.gfortran.exe inputs
main3d.gnu.ex inputs
```

You can set the network and EOS in the `GNUmakefile`.
This will solve for the CJ speed and then try to compute points on
the Hugoniot curve -- it will eventually give an error saying it
doesn't converge.

The output (`hugoniot.txt`) can then be plotted using the `cj_plot.py`
script.

2 changes: 1 addition & 1 deletion util/cj_detonation/cj_det.H
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ cj_cond(const eos_t eos_state_fuel, eos_t& eos_state_ash, const Real q) {
(1.0_rt + (eos_state_ash.p - eos_state_fuel.p) /
(eos_state_ash.gam1 * eos_state_ash.p));

Real drho = eos_state_ash.rho - rho_old;
drho = eos_state_ash.rho - rho_old;

if (std::abs(drho) < tol * eos_state_ash.rho) {
converged = true;
Expand Down
37 changes: 21 additions & 16 deletions util/cj_detonation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ using namespace amrex;
#include <cj_det.H>
#include <unit_test.H>
#include <actual_network.H>
#ifdef NEW_NETWORK_IMPLEMENTATION
#include <rhs.H>
#else
#include <actual_rhs.H>
#endif

using namespace unit_test_rp;

Expand All @@ -22,20 +26,6 @@ int main(int argc, char *argv[]) {

std::cout << "starting the CJ Det solve..." << std::endl;

ParmParse ppa("amr");

std::string probin_file = "probin";

ppa.query("probin_file", probin_file);

std::cout << "probin = " << probin_file << std::endl;

const int probin_file_length = probin_file.length();
Vector<int> probin_file_name(probin_file_length);

for (int i = 0; i < probin_file_length; i++)
probin_file_name[i] = probin_file[i];

init_unit_test();

// C++ EOS initialization (must be done after Fortran eos_init and
Expand Down Expand Up @@ -82,8 +72,23 @@ int main(int argc, char *argv[]) {
eos_state_fuel.xn[n-1] * aion_inv[n-1];
}

Real q_burn;
ener_gener_rate(dymol, q_burn);
Real q_burn{};

#ifdef NEW_NETWORK_IMPLEMENTATION

// note: we are assuming that the network's ener_gener_rate does not
// use rhs_state -- this is true, e.g., for aprox13
RHS::rhs_state_t<amrex::Real> state;
amrex::constexpr_for<1, NumSpec+1>([&] (auto n)
{
constexpr int species = n;
q_burn += RHS::ener_gener_rate<species>(state, dymol(species));
});
#else
ener_gener_rate(dymol, q_burn);
#endif

std::cout << "q_burn = " << q_burn << std::endl;

// store the shock adiabat and the detonation adiabat

Expand Down

0 comments on commit 644d6ad

Please sign in to comment.