Skip to content

Commit 644d6ad

Browse files
committed
this now works
1 parent f208637 commit 644d6ad

File tree

4 files changed

+42
-23
lines changed

4 files changed

+42
-23
lines changed

util/cj_detonation/GNUmakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ MICROPHYSICS_HOME := ../..
2121
EOS_DIR := helmholtz
2222

2323
# This sets the network directory
24-
NETWORK_DIR := subch_simple
24+
NETWORK_DIR := aprox13
2525

2626
CONDUCTIVITY_DIR := stellar
2727

util/cj_detonation/README.md

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
Compute the Chapman-Jouguet detonation speed. At the moment you set
2-
the state in the source directly (`main.f90`) and then build and
3-
execute as:
1+
Compute the Chapman-Jouguet detonation speed.
2+
3+
The thermodynamic state for the fuel and ash are hardcoded
4+
into main.cpp right now.
5+
6+
You can set the network and EOS in the `GNUmakefile`.
7+
8+
At the moment, this seems to work well with the `aprox13` network.
9+
It does not seem as robust with larger nets, so some work needs to
10+
be done there.
11+
412

513
```
6-
main.Linux.gfortran.exe inputs
14+
main3d.gnu.ex inputs
715
```
816

9-
You can set the network and EOS in the `GNUmakefile`.
17+
This will solve for the CJ speed and then try to compute points on
18+
the Hugoniot curve -- it will eventually give an error saying it
19+
doesn't converge.
20+
21+
The output (`hugoniot.txt`) can then be plotted using the `cj_plot.py`
22+
script.
23+

util/cj_detonation/cj_det.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ cj_cond(const eos_t eos_state_fuel, eos_t& eos_state_ash, const Real q) {
9090
(1.0_rt + (eos_state_ash.p - eos_state_fuel.p) /
9191
(eos_state_ash.gam1 * eos_state_ash.p));
9292

93-
Real drho = eos_state_ash.rho - rho_old;
93+
drho = eos_state_ash.rho - rho_old;
9494

9595
if (std::abs(drho) < tol * eos_state_ash.rho) {
9696
converged = true;

util/cj_detonation/main.cpp

+21-16
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ using namespace amrex;
1212
#include <cj_det.H>
1313
#include <unit_test.H>
1414
#include <actual_network.H>
15+
#ifdef NEW_NETWORK_IMPLEMENTATION
16+
#include <rhs.H>
17+
#else
1518
#include <actual_rhs.H>
19+
#endif
1620

1721
using namespace unit_test_rp;
1822

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

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

25-
ParmParse ppa("amr");
26-
27-
std::string probin_file = "probin";
28-
29-
ppa.query("probin_file", probin_file);
30-
31-
std::cout << "probin = " << probin_file << std::endl;
32-
33-
const int probin_file_length = probin_file.length();
34-
Vector<int> probin_file_name(probin_file_length);
35-
36-
for (int i = 0; i < probin_file_length; i++)
37-
probin_file_name[i] = probin_file[i];
38-
3929
init_unit_test();
4030

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

85-
Real q_burn;
86-
ener_gener_rate(dymol, q_burn);
75+
Real q_burn{};
76+
77+
#ifdef NEW_NETWORK_IMPLEMENTATION
78+
79+
// note: we are assuming that the network's ener_gener_rate does not
80+
// use rhs_state -- this is true, e.g., for aprox13
81+
RHS::rhs_state_t<amrex::Real> state;
82+
amrex::constexpr_for<1, NumSpec+1>([&] (auto n)
83+
{
84+
constexpr int species = n;
85+
q_burn += RHS::ener_gener_rate<species>(state, dymol(species));
86+
});
87+
#else
88+
ener_gener_rate(dymol, q_burn);
89+
#endif
90+
91+
std::cout << "q_burn = " << q_burn << std::endl;
8792

8893
// store the shock adiabat and the detonation adiabat
8994

0 commit comments

Comments
 (0)