Skip to content

Commit

Permalink
Fix analytic Jacobian in ignition_chamulak (#1294)
Browse files Browse the repository at this point in the history
The conversion back to d/dY form was missing the multiplication by A for the d/dX terms. Also, the J(ash, net_ienuc) term was missing.
  • Loading branch information
maxpkatz authored Jul 23, 2023
1 parent 9af506c commit 7652796
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
4 changes: 4 additions & 0 deletions networks/ignition_chamulak/actual_rhs.H
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,13 @@ void actual_jac (burn_t& state, MatrixType& jac)
(dens * rate * xc12tmp * xc12tmp * dsc1212dt +
dens * sc1212 * xc12tmp * xc12tmp * dratedt);

jac(Ash, net_ienuc) = -jac(C12, net_ienuc);

// Convert back to molar form

for (int i = 1; i <= neqs; ++i) {
for (int j = 1; j <= NumSpec; ++j) {
jac(i,j) *= aion[j-1];
jac(j,i) *= aion_inv[j-1];
}
}
Expand All @@ -207,6 +210,7 @@ void actual_jac (burn_t& state, MatrixType& jac)
// Convert to d / de

jac(C12, net_ienuc) = temperature_to_energy_jacobian(state, jac(C12, net_ienuc));
jac(Ash, net_ienuc) = temperature_to_energy_jacobian(state, jac(Ash, net_ienuc));
jac(net_ienuc, net_ienuc) = temperature_to_energy_jacobian(state, jac(net_ienuc, net_ienuc));
}

Expand Down
26 changes: 13 additions & 13 deletions unit_test/burn_cell/ci-benchmarks/chamulak_VODE_unit_test.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AMReX (23.07-24-g01b750d909b0) initialized
AMReX (23.07-7-g88f03408f18a-dirty) initialized
starting the single zone burn...
Maximum Time (s): 0.01585
State Density (g/cm^3): 1000000000
Expand All @@ -12,21 +12,21 @@ RHS at t = 0
ash 0.01230280576
------------------------------------
successful? 1
- Hnuc = 5.162791463e+17
- added e = 8.183024469e+15
- final T = 1424869952
- Hnuc = 5.27728638e+17
- added e = 8.364498912e+15
- final T = 1433703794
------------------------------------
e initial = 1.253426044e+18
e final = 1.261609069e+18
e final = 1.261790543e+18
------------------------------------
new mass fractions:
C12 0.966535706
O16 1.000003322e-30
ash 0.033464294
C12 0.9657902582
O16 1e-30
ash 0.03420974184
------------------------------------
species creation rates:
omegadot(C12): -2.111311924
omegadot(O16): 2.096110914e-34
omegadot(ash): 2.111311924
number of steps taken: 384
AMReX (23.07-24-g01b750d909b0) finalized
omegadot(C12): -2.158343334
omegadot(O16): 3.315374916e-44
omegadot(ash): 2.158343334
number of steps taken: 381
AMReX (23.07-7-g88f03408f18a-dirty) finalized
8 changes: 4 additions & 4 deletions unit_test/test_rhs/ci-benchmarks/chamulak.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
Xold_oxygen-16 0.05 0.4
Xold_ash 0.05 0.4
Edot 9.3682885505e-53 6.584051211e+27
J_carbon-12_carbon-12 -5030352847.9 -3.2218541118e-70
J_carbon-12_carbon-12 -60364234175 -3.8662249342e-69
J_oxygen-16_carbon-12 0 0
J_ash_carbon-12 2.1479027412e-70 3353568565.3
J_E_carbon-12 9.3682885505e-52 1.4631224913e+28
J_ash_carbon-12 2.5774832894e-69 40242822783
J_E_carbon-12 1.1241946261e-50 1.7557469896e+29
J_carbon-12_oxygen-16 0 0
J_oxygen-16_oxygen-16 0 0
J_ash_oxygen-16 0 0
Expand All @@ -24,6 +24,6 @@
J_E_ash -0 -0
J_carbon-12_E -4.4154660816e-08 -7.3754668622e-85
J_oxygen-16_E 0 0
J_ash_E 0 0
J_ash_E 4.9169779082e-85 2.9436440544e-08
J_E_E 2.1445881583e-66 1.2842772523e+11

0 comments on commit 7652796

Please sign in to comment.