Implementation of beta fixed point solve, based on Jon M work. - #4640
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4640 +/- ##
=======================================
Coverage 49.92% 49.92%
=======================================
Files 151 151
Lines 30236 30239 +3
=======================================
+ Hits 15094 15098 +4
+ Misses 15142 15141 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hmm.. this only happens when beta is used to calculate things that relate to how beta is calculated. As far as I am aware, this was only happening in the Saamuli pedestal temperature scaling Where is the fixed point problem now for the open-source PROCESS LAR point? I just think it's really important to identify what these "circular loops" are. More importantly, are you sure this is a complete closure of the plasma calculation chain, or are there other fixed point issues? |
Description
This PR replaces the iterative idempotence treatment of plasma beta with an explicit fixed-point solve.
Previously, beta_total_vol_avg could be treated as optimisation iteration variable ixc = 5, with equality constraint icc = 1 enforcing consistency between the total beta and its thermal, fast-alpha and beam components. This means that one of PROCESS's internal closure relationships is effectively being solved through the optimisation problem.
The change instead solves
internally using scipy.optimize.fixed_point.
The thermal beta is calculated using the existing PlasmaBeta.calculate_plasma_beta() method in process.models.physics.physics.
The fixed-point calculation is performed within Caller for each model evaluation. The trial value of beta_total_vol_avg is applied after the optimisation variables have been set, ensuring that the fixed-point value is not overwritten by set_scaled_iteration_variable().
The existing MFILE/output idempotence handling is otherwise retained.
Validation
The low_aspect_ratio_DEMO.IN.DAT case was run with ixc = 5 removed while retaining beta consistency constraint icc = 1.
The case converges to essentially the same solution as main, while constraint 1 remains satisfied with zero residual. This demonstrates that the beta closure is being provided by the internal fixed-point calculation rather than by VMCON varying beta_total_vol_avg.
As a result, beta_total_vol_avg no longer needs to be exposed to the optimiser as ixc = 5. Once the fixed-point implementation is fully adopted, icc = 1 can also be removed from the optimisation problem because the same closure is enforced internally.