Skip to content

Particle balance constraint updated#4395

Open
chris-ashe wants to merge 17 commits into
mainfrom
particle_balance_constraint_fixed
Open

Particle balance constraint updated#4395
chris-ashe wants to merge 17 commits into
mainfrom
particle_balance_constraint_fixed

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Added a detailed plasma fuelling model and particle balance equations for deuterium, tritium, helium-3, and alpha particles to the documentation (plasma_fuelling.md). This includes explanations of fuelling efficiency, recycling, and burnup fractions.
  • Added new physics variables in PhysicsData for burnup fractions and detailed fusion reaction rates, enabling more granular tracking of fuel species and reactions.

2. New input and iteration variables:

  • Introduced new input parameters in input.py for fuelling efficiency, injected fuel rates, and fuelling fractions for each species.
  • Added corresponding iteration variables for these new inputs, allowing them to be varied during optimization and scans.

3. Particle balance and consistency constraints:

  • Implemented new constraint equations (93–97) in constraints.py to 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.
  • Updated numerics to include these new constraints, increasing the total number of constraints and variables.

4. Documentation and navigation updates:

  • Added the new plasma fuelling documentation page to the navigation in mkdocs.yml, making the new model easily accessible in the documentation site.

5. Miscellaneous improvements:

  • Added Avogadro's number to the constants module for use in physical calculations.
  • Improved output reporting for constraint errors in 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.


🎨 Output additions

Expanded and added more values for rates to the fusion reaction summary page:
image

Added a fuelling summary page that shows the contour graphs of the fuelling solutions, along with burnup data:

image

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

…ng to be used to solve the fuelling and burnup equations
…riton, needed to know the indvidual fuel production and removal rates
…ude the equations for main fuel species flow and thermal alpha flow
… for the burnup and fuelling rate now being calculated implicitly
…ass. Add details for some fusion reactions also
@chris-ashe chris-ashe added Physics Relating to the physics models Variable rename Input/Output Files Issues related to the input and output data files Documentation Improvements or additions to documentation Plotting labels Jun 29, 2026
@chris-ashe chris-ashe mentioned this pull request Jun 29, 2026
6 tasks
@chris-ashe chris-ashe marked this pull request as ready for review June 29, 2026 12:36
@chris-ashe chris-ashe requested a review from a team as a code owner June 29, 2026 12:36

@j-a-foster j-a-foster 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.

Just a couple of notes, otherwise happy with the changes.

Comment thread process/core/io/plot/summary.py Outdated
f"Plasma power: {mfile.get('p_plasma_alpha_mw', scan=scan):.4f} MW\n"
f"Beam power: {mfile.get('p_beam_alpha_mw', scan=scan):.4f} MW\n\n"
f"Rate density total: {mfile.get('fusden_alpha_total', scan=scan):.4e} particles/m$^3$/sec\n"
f"Rate density, plasma: {mfile.get('fusden_plasma_alpha', scan=scan):.4e} particles/m$^3$/sec\n\n"

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.

Why are these /sec and not /s?

linewidths=2,
)

# Plot star for mfile values

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.

Is it worth adding a note or legend that explains what the star means in the PDF?

@jonmaddock jonmaddock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Please sort out the PR description: I think it's too verbose and misses/buries the key point which is that you're introducing constraints to enforce density equilibrium of individual ion species. Why are you making this PR?
  • Have you removed the original molflow_plasma_fuelling_required as an output? I might have missed that
  • I counted 6 new optimisation parameters and 5 new constraints: as per our conversation, can you describe how this might work in solution mode, i.e. when we require a determined system?
  • Some plots to demonstrate these changes would be useful: for example how the constraints are accommodated with increasing te or ne, for example. How does this change the current large tokamak solution?
  • Please don't rebase until the PR is approved, so we can track comments
  • How does this compare to the existing burnup calculation? Has it been removed?
  • The created docs were excellent
  • I'd like this PR to include what equations and parameters should be included in optimisation and solution scenarios. If the solution system is under-determined, how useful is it?
  • I'm not sure about the fuelling composition constraint and total fuelling rate. Would individual species rates reduce the dimensionality?
  • Should the recycling fraction and fuelling efficiency be optimisation parameters? (I realise we've discussed this, but I think it should be made clear why these can be used to solve the constraints).

Thanks for the fixed-up commits, this was much easier to review.

Comment thread process/models/physics/fuelling.py Outdated


class PlasmaFuelling(Model):
"""Class to hold plasma fuelling calculations for plasma processing."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Plasma processing? Could you be a bit more descriptive here?

Comment thread process/models/physics/fuelling.py Outdated
Returns
-------
float
Alpha particle flow rate in the plasma exhaust (particles/s).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this the wrong way around? It's the flow rate into the plasma (for a positive returned value), not the exhaust?

Comment thread process/models/physics/fuelling.py Outdated
nd_plasma_alphas_vol_avg: float,
vol_plasma: float,
) -> float:
"""Calculate the alpha particle flow rate in the plasma exhaust.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't these be in the exhaust model?

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.

The comment has been ammended, since it works the exact same as the other fuel models and returns the source rate, I think it is best to leave it with the group.


self.data.physics.fusrat_dt_total = (
self.data.physics.p_dt_total_mw * 1e6 / (constants.D_T_ENERGY)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are all of these not already calculated elsewhere?

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.

No, I had to add them. We have values for the powers but all of the actual rates were done in situ before. There is changes to the fusion power summary page which I will add to the PR overview also


Notes
-----
The fusion rate is multiplied by two to convert from nucleus pairs to particles,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not multiplied by 2 here.

* data.physics.vol_plasma
* data.physics.f_plasma_fuel_helium3
) / (
data.physics.t_energy_confinement

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does He3 follow the energy confinement time rather than the tau_alpha / tau_E = 5 relation?

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.

This is a point we should discuss, I dont see why we wouldn't treat it the same as 4He

\tau_{\alpha} = f_{\alpha}\tau_{\text{E}}\frac{R}{1-R}\tau_{\text{ne}}
$$

This is the model currently in METIS[^2] and is found in [^3]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But this isn't used in Process?


--------------

### Tritium Flow Rate | `calculate_plasma_tritium_flow_rate()`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure about "flow rate": it's the density derivative in the plasma.

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.

I left it as flow rate as the functions returns the net particle flow in the plasma, so not necessarily the density

f_{\text{fuelling,D}} + f_{\text{fuelling,T}} + f_{\text{fuelling,3He}} = 1.0
$$

**It is recommended to have this constraint on as it is a plasma consistency model**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you need to be more explicit about the system of equations (i.e. all of the above constraints) and the solution parameters (i.e. optimisation parameters) used to solve them. What's should the user do to enforce all of these constraints in their optimisation problem?

)

plot_fuelling_info(pages["fuelling"], m_file, scan)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can I see these plots in the PR please?

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 add

@chris-ashe

Copy link
Copy Markdown
Collaborator Author

@timothy-nunn If I try and use the functions in fuelling.py instead of re-writing the equations explicitly in constraint.py I get an inf error on the first iteration, would you be able to look at this as we had problems before about the constraint value

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

Labels

Documentation Improvements or additions to documentation Input/Output Files Issues related to the input and output data files Physics Relating to the physics models Plotting Variable rename

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants