Skip to content

Conversation

@jjwalkowiak
Copy link

Description

Main changes:

  • coil minor radius scaling for stellarators
  • corrected stress equation for vacuum vessel
  • corrected coil height (this was actually more on the pre-process side)
  • stellarator module refactoring

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.

jjwalkowiak and others added 30 commits March 7, 2025 16:45
@jjwalkowiak jjwalkowiak requested a review from a team as a code owner February 3, 2026 15:19
@timothy-nunn timothy-nunn self-assigned this Feb 3, 2026
Copy link
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

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

This is just a rough first review. Once these changes have been actioned I can do a more detailed review and get @ym1906 involved (and maybe others).

I notice that there are quite a few style violations. Most of these can be solved by using pre-commit https://ukaea.github.io/PROCESS/development/pre-commit/.

Copy link
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

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

A couple of other things I have noticed.

@timothy-nunn
Copy link
Collaborator

When you have actioned all of the comments please do click the 🔄 icon in the reviewer section to tell me you are ready for the next review.

You might also want to consider adding in a test case to our tests/regression/input_files... this will allow us to check the file runs to completion.

@jjwalkowiak
Copy link
Author

process/stellarator/coils/coils.py:70:23: RUF052 Local dummy variable _tmarg is accessed
I have no idea what _tmarg is doing.
process/stellarator/coils/quench.py:101:5: N802 Function name calculate_vv_max_force_density_from_W7X_scaling should be lowercase
Do you really want to have w7x instead of W7X?

@timothy-nunn
Copy link
Collaborator

process/stellarator/coils/coils.py:70:23: RUF052 Local dummy variable _tmarg is accessed I have no idea what _tmarg is doing. process/stellarator/coils/quench.py:101:5: N802 Function name calculate_vv_max_force_density_from_W7X_scaling should be lowercase Do you really want to have w7x instead of W7X?

  1. Rename _tmarg to tmarg
  2. You can add "W7X" to this list

    PROCESS/pyproject.toml

    Lines 207 to 229 in ca03a41

    ignore-names = [
    "*PROCESS*",
    "*Bt*",
    "*Bp*",
    "*keV*",
    "*MPa*",
    "*H*",
    "*T*",
    "*D*",
    "*He*",
    "*Be*",
    "C",
    "N",
    "O",
    "Ne",
    "Si",
    "Ar",
    "Fe",
    "Ni",
    "Kr",
    "Xe",
    "W",
    ]


def calculate_vv_max_force_density_from_W7X_scaling(rad_vv: float) -> float:
"""Actual VV force density from scaling [MN/m^3]
Based on reference values from W-7X."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Based on reference values from W-7X."""
Based on reference values from W-7X.
"""


f_a: float = None
f_st_i_total: float = None
"""Actual totail coil current to reference value from stella_config file"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"""Actual totail coil current to reference value from stella_config file"""
"""Actual total coil current to reference value from stella_config file"""

Comment on lines 97 to 103
# This is the old version, left for now for comparison.
# build_variables.available_radial_space = stellarator_variables.f_r * (
# stellarator_configuration.stella_config_derivative_min_lcfs_coils_dist
# * stellarator_configuration.stella_config_rminor_ref
# * (1 / stellarator_variables.f_aspect - 1)
# + stellarator_configuration.stella_config_min_plasma_coil_distance
# )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# This is the old version, left for now for comparison.
# build_variables.available_radial_space = stellarator_variables.f_r * (
# stellarator_configuration.stella_config_derivative_min_lcfs_coils_dist
# * stellarator_configuration.stella_config_rminor_ref
# * (1 / stellarator_variables.f_aspect - 1)
# + stellarator_configuration.stella_config_min_plasma_coil_distance
# )

Comment on lines 211 to 212
# po.write(self.outfile,10)
# 10 format(t43,'Thickness (m)',t60,'Radius (m)')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# po.write(self.outfile,10)
# 10 format(t43,'Thickness (m)',t60,'Radius (m)')

+ current_drive_variables.p_hcd_injected_electrons_mw
) / current_drive_variables.eta_hcd_primary_injector_wall_plug
else:
logger.error(f"isthtr {stellarator_variables.isthtr} \n")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logger.error(f"isthtr {stellarator_variables.isthtr} \n")
logger.error(f"isthtr {stellarator_variables.isthtr}")

Comment on lines 233 to 237
# stellarator_variables.f_coil_aspect = (
# (physics_variables.rmajor / stellarator_variables.r_coil_minor) /
# (stellarator_configuration.stella_config_rmajor_ref /
# stellarator_configuration.stella_config_coil_rminor)
# )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# stellarator_variables.f_coil_aspect = (
# (physics_variables.rmajor / stellarator_variables.r_coil_minor) /
# (stellarator_configuration.stella_config_rmajor_ref /
# stellarator_configuration.stella_config_coil_rminor)
# )

surfaces with Fourier coefficients')
"""
physics_variables.vol_plasma = (
# stellarator_variables.f_r * stellarator_variables.f_a**2 * stellarator_configuration.stella_config_plasma_volume
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# stellarator_variables.f_r * stellarator_variables.f_a**2 * stellarator_configuration.stella_config_plasma_volume

Comment on lines 984 to 986
# heat_transport_variables.ipowerflow

# fwbs_variables.blktmodel
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# heat_transport_variables.ipowerflow
# fwbs_variables.blktmodel

physics_variables.p_plasma_rad_mw = (
physics_variables.p_plasma_rad_mw + physics_variables.psolradmw
)
# pden_plasma_rad_mw = physics_variables.p_plasma_rad_mw / physics_variables.vol_plasma # this line OVERWRITES the original definition of pden_plasma_rad_mw, probably shouldn't be defined like that as the core does not lose SOL power.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# pden_plasma_rad_mw = physics_variables.p_plasma_rad_mw / physics_variables.vol_plasma # this line OVERWRITES the original definition of pden_plasma_rad_mw, probably shouldn't be defined like that as the core does not lose SOL power.

Comment on lines 2321 to 2322
# Calculate physics_variables.beta limit. Does nothing atm so commented out
# call stblim(physics_variables.beta_vol_avg_max)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Calculate physics_variables.beta limit. Does nothing atm so commented out
# call stblim(physics_variables.beta_vol_avg_max)

@timothy-nunn timothy-nunn requested a review from ym1906 February 4, 2026 11:31
@timothy-nunn
Copy link
Collaborator

Please also ensure the unit test failures are fixed and that the regression tests stop failing with an error

@jjwalkowiak
Copy link
Author

Please also ensure the unit test failures are fixed and that the regression tests stop failing with an error

I solved most issues with units test, but with regression tests it will be more complicated.

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