Repository navigation
Conversation
…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 refines the handling of the R_AND_Z_ARRAY plasma geometry model by moving the relevant calculations into the match-case structure. The logic for computing `kappa`, `triang`, `kappa95`, and `triang95` based on the last closed flux surface (LCFS) arrays is now encapsulated within the appropriate case, improving code organization and readability. The previous implementation using an if statement has been removed to streamline the code.
…olve. Plasma current: - Accept i_plasma_current = 0 and read the current from plasma_current_user_input. - Require that input to be positive, and allow it with negative triangularity. - Leave the existing scaling laws unchanged when another model is selected. Equilibrium: - Add i_equilibrium_solve. When it is 1, iterate the on-axis electron density and temperature in veqpy until their volume averages match the PROCESS targets. - Rebuild the profiles from those axis values. Scale the ion temperature by the volume-average ion-to-electron temperature ratio. - Take the density-weighted electron temperature, normalised internal inductance, and on-axis current density from the solved equilibrium.
- Revised comments to enhance understanding of the code, specifically regarding the integration of source for psin and the calculation of volume average <Bp^2>. - Improved readability by translating comments from Chinese to English and standardizing terminology.
- Introduced validation checks for user-specified plasma current and current profile index when `i_equilibrium_solve` is set to 1. - Enhanced the `Physics` class to compute the inboard and outboard toroidal magnetic fields based on the plasma equilibrium. - Updated the calculation of the total magnetic field at both inboard and outboard locations, ensuring accurate representation of plasma conditions.
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 updates the import statements in `main.py`, `init.py`, and `physics.py` to ensure consistency and clarity. Additionally, it enhances the docstrings in `input.py`, `plasma_equilibrium.py`, and `plasma_current.py` to provide better context and error handling information. These changes improve code readability and maintainability across the project.
…ntegration This commit introduces a new `VeqpyRuntime` class to manage the latest veqpy equilibrium state and its associated axis iteration results. Additionally, it enhances the `plasma_equilibrium.py` file by adding functions to check the availability of veqpy equilibrium, clear transient results, and store equilibrium data. These changes improve the handling of plasma equilibrium states and facilitate better integration with veqpy functionalities.
This commit removes the direct instantiation of `PlasmaEquilibrium` from the `Models` and `Physics` classes, replacing it with a more integrated approach using the `VeqpyRuntime` class. It enhances the `Physics` class to utilize the new equilibrium management methods, ensuring that plasma equilibrium calculations are more streamlined and consistent with the latest veqpy functionalities. Additionally, validation checks for user inputs related to plasma equilibrium are updated to improve error handling.
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.
…l_avg This commit updates the VeqpyRuntime class to include a new attribute for the volume-averaged electron density, f_temp_plasma_electron_density_vol_avg. The Physics and PlasmaEquilibrium classes are modified to store and utilize this new attribute during equilibrium calculations. Additionally, references to the equilibrium state are streamlined to improve consistency across the plasma modeling framework.
Collaborator
|
Dear @chencx04, Firstly, thank you for making this contribution to PROCESS. As an open-source code, we encourage and appreciate any and all contributions made by the wider fusion community. With a contribution of this magnitude, I think it would be necessary to have discussions outside of GitHub pull requests/issues to make any design and architecture decisions. May I encourage you to make contact with us via our contact form https://www.ukaea.org/service/process/. We look forward to hearing from you. Many thanks, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This draft PR introduces an initial integration of
[veqpy](https://github.com/FusionAlpha/veqpy)into PROCESS as an alternative tokamak equilibrium solver.The main objective is to establish the interface between the existing PROCESS equilibrium inputs and the
veqpysolver, and to evaluate howveqpycan be incorporated into the PROCESS equilibrium workflow.Current implementation
The current implementation includes:
veqpyinto the PROCESS equilibrium calculation workflow;veqpyinputs;VeqpyRuntimeinterface for managing theveqpyequilibrium calculation;veqpy;veqpyto the PROCESS workflow;veqpyequilibrium model;The current implementation is intended to provide a working integration framework and allow the PROCESS development team to review the proposed interface and data flow between PROCESS and
veqpy.Current status
The basic PROCESS–
veqpyintegration and the initial input/output interface have been implemented.The test coverage is not yet complete. In particular, dedicated unit tests for the PROCESS-to-
veqpyinput mapping and integration tests covering the complete equilibrium workflow still need to be added.Therefore, this pull request is opened as a Draft PR. At this stage, the main purpose is to obtain feedback on the integration structure, input mapping, and equilibrium output interface before completing the remaining tests and validation.
Planned work
The remaining work includes:
veqpyinput mapping;veqpyequilibrium workflow;veqpyequilibrium quantities against appropriate reference calculations;veqpyover representative PROCESS parameter variations;In particular, the robustness tests can be performed after the initial integration, together with the integration tests. This will allow
veqpyto be evaluated directly under the parameter variations encountered during PROCESS system-code calculations and optimisation.Design considerations
The integration keeps
veqpyas a separate equilibrium solver and introduces a PROCESS-side interface between the existing PROCESS equilibrium inputs and theveqpyAPI.The relevant PROCESS inputs are translated into the corresponding
veqpyrepresentation within the integration layer. Selected equilibrium quantities calculated byveqpyare then returned to PROCESS for use in the subsequent physics calculations.At this stage, feedback from the PROCESS development team would be particularly useful regarding:
veqpyinterface;veqpyequilibrium inputs;veqpyintegration within the existing PROCESS architecture.Testing
Dedicated tests for the new integration are still being developed.
Once the interface is agreed, the planned tests will cover:
veqpyinput conversion;veqpyequilibrium execution from within PROCESS;The PR will remain in draft status until the relevant unit and integration tests have been added and the integration has been validated.
Closes #4593