Particle balance constraint#4139
Conversation
1397135 to
7687c7b
Compare
|
Opening this up now just to get the ball rolling with the review. @jonmaddock a discussion should be had about how we implement this into the regression tests, e.g is the 4 balance constraints always on as default |
|
As this is contingent on the wider "solution mode" work going in (which I am currently working on), I am converting this to a draft until that is merged. Edit: I'm wrong about this: this can go in without waiting for the above work. |
1dd8c7f to
49236ad
Compare
40ad502 to
b37ac1f
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4139 +/- ##
==========================================
- Coverage 48.86% 48.81% -0.06%
==========================================
Files 151 152 +1
Lines 29461 29671 +210
==========================================
+ Hits 14397 14484 +87
- Misses 15064 15187 +123 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0d49bab to
43e8f8c
Compare
90086ef to
37c5d94
Compare
…tium, and helium-3
… rate parameters, and update plotting functions for alpha particle flow rate and fusion DT rate.
…ple files and update related calculations and tests
…iles and update related calculations and tests
…ated plotting functions for tritium, deuterium, and alpha particle flow rates
…nd add fuelling information display
…uel burnup fraction computation across models
…y constraints for consistency models
…ing class and update plotting function calls for consistency
…uelling_required' and update references to 'molflow_plasma_fuelling_vv_injected' across models and tests
… the PlasmaFuelling class
… with improved color mapping and titles
…ficiency and recycling coefficient, and introduce METIS Alpha Confinement model
…ss and update parameter descriptions
… for tritium, deuterium, helium-3, and alpha particle balances
…clarify recycling coefficient, and introduce fuel burnup fraction equations
…s and add particle balance equations
37c5d94 to
3e5c5fd
Compare
jonmaddock
left a comment
There was a problem hiding this comment.
Please fixup these commits to reduce churn and provide more descriptive commit messages: it's a bit hard to review at the moment.
| return self._description_ | ||
|
|
||
|
|
||
| ipnvars: int = 180 |
There was a problem hiding this comment.
I don't think this belongs in this PR: it should be separate.
|
|
||
|
|
||
| @ConstraintManager.register_constraint(93, "particles/s", "=") | ||
| def constraint_equation_93(): |
There was a problem hiding this comment.
This appears to be a copy of the previous constraint.
| ), | ||
| "molflow_plasma_fuelling_vv_injected": InputVariable( | ||
| data_structure.physics_variables, float, range=(0.0, 1e24) | ||
| ), |
There was a problem hiding this comment.
Please fixup into previous commit where these were created.
|
|
||
| @ConstraintManager.register_constraint(93, "particles/s", "=") | ||
| def constraint_equation_93(): | ||
| def constraint_equation_93(constraint_registration): |
There was a problem hiding this comment.
Please fixup the original commit where this constraint was added with this commit to reduce churn for the reviewer.
| ) | ||
| ) | ||
|
|
||
| return leq(numerator, 1e10, constraint_registration) |
|
|
||
|
|
||
| @ConstraintManager.register_constraint(94, "particles/s", "<=") | ||
| def constraint_equation_94(constraint_registration): |
There was a problem hiding this comment.
Please re-write the commit message to describe why this constraint is being added: "update" is not descriptive for the reviewer. Three constraints have been modified here in a single commit.
| ) | ||
|
|
||
| return leq(numerator, 1e10, constraint_registration) | ||
| return eq(numerator / 1e20, 1e-8, constraint_registration) |
There was a problem hiding this comment.
There's a bit too much churn here: please fixup commits and write descriptive commit messages to help me review!
| / (1 - data_structure.physics_variables.f_plasma_particles_lcfs_recycled) | ||
| ) | ||
| ) | ||
| denominator = ( |
There was a problem hiding this comment.
Can't understand what the change is as commit message not descriptive: why are you making this change?
This pull request introduces a comprehensive plasma fuelling model to the codebase, including new physical variables, input parameters, constraints, and documentation. The main focus is to enable detailed particle balance and burnup fraction calculations for deuterium, tritium, and helium-3 in the plasma, and to ensure consistency through new constraint equations. Several new variables and iteration parameters are added to support these models, and the documentation is expanded to explain the physical basis and equations.
Key changes:
1. Plasma fuelling and particle balance model:
plasma_fuelling.md). This includes explanations of fuelling efficiency, recycling, and burnup fractions.PhysicsDatafor burnup fractions and detailed fusion reaction rates, enabling more granular tracking of fuel species and reactions. [1] [2]2. New input and iteration variables:
input.pyfor fuelling efficiency, injected fuel rates, and fuelling fractions for each species.3. Particle balance and consistency constraints:
constraints.pyto enforce particle balance for tritium, deuterium, helium-3, alpha particles, and to ensure fuelling fractions sum to unity. These constraints help maintain physical consistency in the plasma model.4. Documentation and navigation updates:
mkdocs.yml, making the new model easily accessible in the documentation site.5. Miscellaneous improvements:
scan.py.These changes collectively provide a robust framework for modeling plasma fuelling, tracking individual fuel species, and ensuring physical consistency in fusion plasma simulations.
Checklist
I confirm that I have completed the following checks: