Skip to content

fix three-way loop bug#2013

Closed
chongchonghe wants to merge 16 commits into
AMReX-Astro:mainfrom
chongchonghe:chong/micro-photo-fix
Closed

fix three-way loop bug#2013
chongchonghe wants to merge 16 commits into
AMReX-Astro:mainfrom
chongchonghe:chong/micro-photo-fix

Conversation

@chongchonghe

Copy link
Copy Markdown
Contributor

No description provided.

James471 and others added 16 commits May 30, 2026 08:28
…ariables

WIP: Add reduced speed of light to burn state and some missing radiation variables

WIP: Add reduced speed of light to burn state and some missing radiation variables
Minor fixes

WIP: Minor fixes

WIP: Minor fixes

Cleanup
Simplify photoionization eos implementation, change species masses

Simplify photoionization eos implementation, change species masses
…n EOS

The EOS was incorrectly normalizing the total heat capacity
sum_ni_fi_over_2 by dividing by the particle count before using it
for internal energy and temperature calculations. This made the
internal energy per unit mass ~1/n_total times too small, causing
the ionized gas temperature to be ~140x too low for the DTypeFront
test (n_H=139.9), giving an expansion speed of ~750 m/s instead of
the expected ~10 km/s.

Fix: separate the unnormalized sum_ni_fi_over_2 (total heat capacity,
used for e, T, dedT) from fi_over_2_avg = sum_ni_fi_over_2 /
sum_Abarinv (per-particle average, used for pressure, cs, G).

Also fix electron mass: spmasses[Electron] was set to proton mass;
now correctly set to C::m_e = 9.109e-28 g.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The radiation loop had two bugs: the upper bound `NumRadEqs` should be
`net_ienuc + NumRadEqs` (the loop never executed since net_ienuc+1 > NumRadEqs),
and `state.rn[i-1]` / `state.rn[j-1]` should be indexed relative to net_ienuc
to correctly map VODE 1-based indices to the rn[] array.  The inner loop
upper bound was also off by one (`<= i + N` → `<= i + N - 1`).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@BenWibking

Copy link
Copy Markdown
Collaborator

Since you created a new PR to James' PR, this PR can be closed, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants