Skip to content

Mirror model in ACCERT - #59

Open
JiaZhou-PU wants to merge 23 commits into
accert-dev:developmentfrom
JiaZhou-PU:mirror
Open

Mirror model in ACCERT#59
JiaZhou-PU wants to merge 23 commits into
accert-dev:developmentfrom
JiaZhou-PU:mirror

Conversation

@JiaZhou-PU

@JiaZhou-PU JiaZhou-PU commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Merge Request Description

This PR cleans up the Mirror model integration and prepares it for merge into the SQLite-backed ACCERT workflow.

Key updates:

  • Removed unused HTS magnet helper methods from the maintained MirrorFunc.py.
  • Updated the Mirror table builder so it only copies the maintained MirrorFunc.py.
  • Updated tutorial/accert/Mirror.son to explicitly use the same numeric baseline setup as Matt’s runFOAK.py case.
  • Confirmed the Mirror model runs through the ACCERT SQLite workflow.

For Change Request Review

  • 1. Is the merge request reference an issue? If the issue is closed, the issue close checklist shall be done.
  • 2. Is the merge request reference a task? If the task is fulfilled, the task close checklist shall be done.
  • 3. If any changes to the database, there must be an accompanying change to the all the linked tables.

@JiaZhou-PU JiaZhou-PU changed the title Mirror Mirror model in ACCERT Aug 5, 2026
@JiaZhou-PU

Copy link
Copy Markdown
Collaborator Author

Hi @NybergWISC could you please review this PR?

In particular, please check:

  • the Mirror.son baseline inputs match the intended runFOAK.py case,
  • the removed legacy split-input implementation is no longer needed,
  • the current ACCERT Mirror implementation is acceptable as the maintained starting point for the Mirror model work.

@JiaZhou-PU
JiaZhou-PU marked this pull request as ready for review August 5, 2026 22:30
@NybergWISC
NybergWISC self-requested a review August 6, 2026 18:56

@NybergWISC NybergWISC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a couple formatting comments based on Mirror being a part of general fusion models. It may be worth (soon) transitioning to naming the "fusion" model the "tokamak" model, but that doesn't need to be a part of this PR. From what I can see, the baseline values are in-line with the values from the runs used for the draft of the paper and models from Frank et al and Shah et al.

======================

This document provides a comprehensive explanation of the ACCERT running examples, including the **PWR12-BE**, **ABR1000**, **AP1000**, and **Fusion** reactor models. It integrates key ACCERT concepts to elucidate how the input files are structured and why they are designed in a particular manner.
This document provides a comprehensive explanation of the ACCERT running examples, including the **PWR12-BE**, **ABR1000**, **AP1000**, **Fusion**, and **Mirror** reactor models. It integrates key ACCERT concepts to elucidate how the input files are structured and why they are designed in a particular manner.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth changing the name of the "Fusion" reactor models to a list of the specific types or removing the extra mirror that is added here (dropping this change)

@@ -16,3 +16,4 @@ This document provides a comprehensive explanation of the ACCERT running example
ap1000
fusion

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, it may be worth changing "fusion" to "tokamak" as we start adding in more capabilities

Comment thread test/test_mirror_model.py
}
for table_name, csv_path in expected.items():
cursor.execute(f"SELECT COUNT(*) FROM {table_name}")
assert cursor.fetchone()[0] == _csv_row_count(csv_path)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of 8/6/2026 this test is failing with 80 == 81 assertion error

Comment thread test/test_mirror_model.py
""",
("OCC",),
)
assert cursor.fetchone()[0] == pytest.approx(1789930928.8581762)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of 8/6/2026 this is failing. Cost may have changed and defaults/tests may need to be updated to match

Comment thread test/test_mirror_model.py
)
rows = {name: (value, unit) for name, value, unit in cursor.fetchall()}

assert rows["P_DEC"][0] == pytest.approx(50.019897669130195)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, defaults as written seem to give 70 rather than 50

Comment thread test/test_mirror_model.py
)
rows = cursor.fetchall()
assert rows[0][0] == "P_DEC"
assert rows[0][1] == pytest.approx(50.019897669130195)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P_DEC difference between test and default outputs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update the test value with the new default

@JiaZhou-PU

Copy link
Copy Markdown
Collaborator Author

Seems forgot to update the test after the new value

Comment thread test/test_mirror_model.py
"",
"no_vpumps",
)
assert rows["no_vpumps"] == (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Significant difference in this test. Test value is 42.25 and new value is 2.26. Was there a large change in either a_EC or some difference in definition of L that caused a change here? It seems to me like 2.26 is too small but I haven't looked into the physics

Comment thread test/test_mirror_model.py
)
rows = {row[0]: row[1:] for row in cursor.fetchall()}

assert rows["HF_magnet_cost"] == (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error here due to new version not having sc_mat_scale

Comment thread test/test_mirror_model.py
("2211",),
)
total_cost, alg_name, variables = cursor.fetchone()
assert total_cost / 1e6 == pytest.approx(446.188406030979)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test seems to get 0.51 vs the 446.19 expected. This is another large change, makes me wonder if one of the lengths is messed up (L_CC or L)

Comment thread test/test_mirror_model.py
("2212",),
)
total_cost, variables = cursor.fetchone()
assert total_cost / 1e6 == pytest.approx(41.34793800403872)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a difference in EC cost again. Worth mentioning that some of the variables that are constants within the code were changed as part of edits to TEAm when I was running final versions for the first draft. I may want to re-check some of these, especially some of the radii/length definitions for the final version

@JiaZhou-PU

Copy link
Copy Markdown
Collaborator Author

Hi Matt @NybergWISC Thanks for catching the value issue.

I updated both the ACCERT SQLite database and the SQL schema/data dump so they now use the new confirmed Mirror baseline values.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NybergWISC This file will be deleted after review; put it here for easy comparison.

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