Skip to content

Identify pellet species by element, not by label or order - #14

Merged
jmcclena merged 2 commits into
ProjectTorreyPines:masterfrom
omeneghini-pf:robust-species-detection
Nov 24, 2026
Merged

jmcclena merged 2 commits into
ProjectTorreyPines:masterfrom
omeneghini-pf:robust-species-detection

Conversation

@omeneghini-pf

Copy link
Copy Markdown
Contributor

Problem

dr_dt! picks the ablation model from exact label strings: "D" and "T", "Ne20" and "D", or "C12". Inside the Ne-D branch it assigns masses, charges and fractions by list position. The branch tests species_list[1] == "Ne" to decide the order, which never matches the label "Ne20" that selected the branch. So:

  • a layer listing Ne20 before D gets the two masses swapped, and a wrong ablation rate;
  • a layer labelled "Ne" or "C", which IMAS.ion_properties accepts, is rejected with "No ablation model";
  • a layer mixing C12 with another species silently uses the pure-carbon model.

Fix

Species are found by element from IMAS.ion_properties: the hydrogen isotopes by mass number, neon by Z = 10, carbon by Z = 6. The model is chosen from the exact set of elements in the layer, D-T, D-Ne or C. Anything else raises an error that names the species. The ablation formulas are unchanged. For the orders that already worked (D, T; T, D; D, Ne20), every variable takes the same value as before, and the OMFIT comparison test is unchanged.

Test

A new species detection testset runs run_PAM on the D3D template and checks:

  • the rate is identical when the species of a D-T or a D-Ne layer are listed in either order;
  • "Ne" and "C" work, within the small mass difference from "Ne20" and "C12";
  • a C-D mixture raises an error.

On master, 4 of these 6 checks fail. With this change all tests pass.

🤖 Generated with Claude Code

omeneghini-pf and others added 2 commits September 28, 2026 04:22
dr_dt! chose the ablation model from exact labels ("D", "T", "Ne20", "C12") and, for Ne-D, assigned masses, charges and fractions by list position: the check species_list[1] == "Ne" never matches the label "Ne20" that selects the branch, so a layer listing Ne20 before D got the two masses swapped. Layers labelled "Ne" or "C" were rejected, and a carbon-deuterium mixture silently used the pure-carbon model.

Species are now found by element with IMAS.ion_properties (hydrogen isotopes by mass number, neon Z = 10, carbon Z = 6), the model is chosen from the exact set of elements in the layer, and anything else raises an error that names the species. The formulas are unchanged. Adds a species-detection testset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jmcclena
jmcclena merged commit 26ed3b8 into ProjectTorreyPines:master Nov 24, 2026
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.

2 participants