Skip to content

Feature/veqpy - #4597

Draft
chencx04 wants to merge 22 commits into
ukaea:mainfrom
chencx04:feature/veqpy
Draft

chencx04 wants to merge 22 commits into
ukaea:mainfrom
chencx04:feature/veqpy

Conversation

@chencx04

Copy link
Copy Markdown

Description

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.

This commit introduces a comprehensive markdown file outlining the main usage scenarios of the PROCESS system, including CLI and Python API entry points, optimization, evaluation, and parameter scanning methods. It details the core calling chain, key classes involved, and provides flowcharts for better understanding. This documentation aims to enhance user guidance and clarify the operational structure of PROCESS.
…a geometry

This commit introduces a new plasma geometry option (`i_plasma_geometry = 13`) that allows users to specify the last closed flux surface using discrete (R, Z) points. It includes the addition of `r_array` and `z_array` inputs, which are validated and processed to derive key plasma parameters such as `rmajor`, `rminor`, `kappa`, and `triang`. The implementation also tracks the number of LCFS points provided and updates relevant documentation to reflect these changes.
This commit introduces new variables and logic to handle proton-boron fusion reactions in the physics model. It adds the necessary input variables for boron-11 and proton fuel fractions, updates the physics calculations to account for these new fuel types, and includes the boron atom mass constant. Additionally, it modifies the impurity radiation model to incorporate boron as a new impurity species. Relevant tests have been updated to reflect these changes.
…alculations

This commit introduces a user-defined plasma current option (`i_plasma_current = 0`) that allows users to specify the plasma current directly via `plasma_current_user_input`. It updates the relevant physics models to handle this new input, including validation checks to ensure positive values. Additionally, a new `PlasmaEquilibrium` model is added to facilitate equilibrium calculations, integrating it into the existing physics framework. Documentation is updated to reflect these changes, enhancing user guidance on plasma current configurations.
This commit adds validation logic to ensure that when plasma equilibrium is solved (`i_equilibrium_solve=1`), the plasma current and current profile index must be user-specified. It raises appropriate errors if these conditions are not met. Additionally, it updates the physics model to calculate the total magnetic field and its components, ensuring consistency in the plasma equilibrium calculations. This enhances the robustness of the plasma modeling framework.
This commit introduces a new static method `bootstrap_fraction_sauter_equilibrium` in the `PlasmaBootstrapCurrent` class to calculate the bootstrap fraction based on Sauter equilibrium conditions. Additionally, a new static method `diamagnetic_integral` is added to the `PlasmaDiamagneticCurrent` class for calculating the diamagnetic integral based on the plasma equilibrium. These enhancements improve the accuracy and functionality of the plasma current models, facilitating more detailed plasma behavior analysis.
This commit refactors the import statements in the plasma model files to ensure consistency and clarity. It also adds detailed docstrings to several methods, including error handling for invalid inputs in the plasma geometry and equilibrium classes. Additionally, it improves the readability of the plasma current calculations by restructuring conditional checks. These changes enhance the maintainability of the code and provide better guidance for future developers.
This commit introduces a new `VeqpyRuntime` class to manage the latest veqpy equilibrium state and its associated axis iteration results. It also refactors the plasma equilibrium handling in the `PlasmaEquilibrium` class, adding methods to store and clear veqpy equilibrium data. The code now checks for the availability of veqpy equilibrium results in various plasma profile calculations, improving the integration of veqpy with the existing plasma modeling framework. Additionally, logging has been added for better traceability of equilibrium state conditions.
This commit removes the direct instantiation of the `PlasmaEquilibrium` class from the `Models` and `Physics` classes, streamlining the plasma equilibrium handling. It introduces a new `plasma_equilibrium-copy.py` file that implements a fixed-boundary plasma equilibrium via optional Veqpy integration. The `check_process` function is updated to enforce validation checks for equilibrium conditions, ensuring user-defined inputs are correctly specified. Additionally, the `DataStructure` class is enhanced to include a `veqpy` attribute for managing equilibrium states, improving the overall integration of Veqpy within the plasma modeling framework.
This commit introduces a validation check in the `check_process` function to ensure that when the pedestal type is set to `GREENWALD_FRACTION` and the equilibrium solver is active (`i_equilibrium_solve = 1`), the user must provide absolute density values for pedestal and separatrix densities. An appropriate error is raised if these conditions are not met, enhancing the robustness of input handling in the plasma modeling framework.
This commit introduces new constants and methods to handle proton-boron fusion reactions in the physics model. It adds the Boron-11 mass constant and the energy calculation for the proton-boron reaction. Additionally, new attributes for tracking fusion reaction rates and power densities are included in the `PhysicsData` class. The `FusionReactionRate` class is updated with a method to calculate the fusion reaction rate for the proton-boron reaction, and relevant updates are made to the physics model to integrate these changes. Tests are also updated to ensure proper functionality of the new features.
This commit introduces a new input variable for radiation calculations in the physics model, specifically for the proton-boron fusion reaction. It adds the `i_calculate_radiation` variable to the `INPUT_VARIABLES` and updates the `PhysicsData` class to include a corresponding attribute. The physics model is enhanced to handle different radiation calculation methods based on this new input, allowing for more accurate modeling of radiation effects in plasma simulations. Additionally, relevant functions for calculating bremsstrahlung radiation are implemented, improving the overall functionality of the radiation power calculations.
…contributions

This commit modifies the radiation power calculation functions to incorporate synchrotron radiation alongside bremsstrahlung radiation. The power density calculations for both the plasma core and outer regions are updated to reflect this enhancement, improving the accuracy of radiation modeling in plasma simulations.
This commit updates the physics model to include new scaling calculations for the L-H transition based on Takizuka 2004. It modifies the `INPUT_VARIABLES` to extend the `i_l_h_threshold` range, updates the `PhysicsData` class to accommodate additional power threshold values, and implements the corresponding methods for nominal, upper, and lower bounds in the `PlasmaConfinementTransition` model. These enhancements improve the accuracy of plasma transition modeling and expand the capabilities of the physics framework.
…threshold

This commit improves the documentation for the L-H transition power threshold calculations in the `PlasmaConfinementTransition` model, providing detailed parameter descriptions and references for proton-boron fusion scaling. Additionally, a warning is added in the `check_process` function to alert users when the `i_l_h_threshold` is set to specific values without necessary corrections, enhancing user awareness and model accuracy.
…tion

This update adds a validation check in the check_process function to ensure that the deuterium, tritium, and helium-3 fuel ion fractions sum to zero. Additionally, it enhances the existing validation to include checks for boron-11 and proton fractions, raising a ProcessValidationError if the conditions are not met. This improves the robustness of the fuel ion fraction calculations.
…ions

This commit introduces the run_pb_fusion method in the Physics class, which calculates essential plasma physics parameters for a tokamak fusion reactor. The method includes calculations for plasma composition, current, and safety factors, while also handling various plasma profiles and inductance. Additionally, it raises a ProcessValueError for illegal input values, enhancing error handling. This update significantly expands the functionality of the physics model, providing a comprehensive routine for plasma physics analysis.
…d accuracy

This commit updates the docstring of the plasma_composition_pb method to provide a clearer description of its functionality, specifically focusing on the plasma composition for proton-boron-11 fuel. The method's calculations have been detailed, including adjustments for charge neutrality and the handling of various plasma components. Additionally, the error handling for input values has been refined to enhance robustness. These changes improve the documentation and maintainability of the physics model.
This commit introduces the Kurskiev spherical tokamak confinement time scaling to the plasma confinement model. A new confinement time model option is added, and the corresponding calculation method is implemented. The method combines L-mode and H-mode data without an isotope-mass term. Additionally, unit tests are updated to validate the new scaling function, enhancing the overall functionality and accuracy of the plasma confinement calculations.
This commit introduces a conditional check for proton-boron fusion reactions in the Physics class, allowing the use of the plasma_composition_pb method when applicable. Additionally, the obsolete run_pb_fusion method has been removed to streamline the code and improve maintainability. These changes enhance the flexibility of the plasma model for different fusion scenarios.
The density-based burnup assumed one alpha per fuel-ion pair, so the unburnt fuel term was 0.5 n_fuel. Proton-boron-11 produces three alphas per pair, which is the same ratio as 1.5 n_fuel in the denominator. Physics.run and the stellarator path now pass i_fusion_reactions, and phyaux uses that factor when the reaction is p-b11 and burnup_in is not set.
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.

1 participant