Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/imas coupling #938

Draft
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

mikesndrs
Copy link

@mikesndrs mikesndrs commented Apr 2, 2025

Wait for CLA signing

  • Set up separate directory with IMAS dependencies
  • Load IMAS equilibrium IDS into geometry
  • Save IMAS equilibrium IDS from geometry
  • Tested by comparing to CHEASE data, IMAS test dataset is based on existing CHEASE dataset

MateoBell and others added 30 commits November 15, 2024 15:22
A useful thing to know about the persistent cache is that
the hash of an object to be included in the key only needs to be constant across a given run and not between runs as helpfully explained in google-deepmind#276.

Also update an outdated comment that says otherwise.

PiperOrigin-RevId: 698339770
PiperOrigin-RevId: 698403411
PiperOrigin-RevId: 698796273
PiperOrigin-RevId: 699992434
Better reflects the intended use and interpretation of these outputs, i.e. the power exiting the confined plasma to the scrape-off-layer.

Also use new math_utils.cell_integration for all integrated powers. Regenerate test cases for new post-processed values and names (simulation results themselves remain the same).

PiperOrigin-RevId: 700000709
…umbing through to where it is used in calc_coeffs and transport models.

The rest of this change is a whole lot of plumbing and updating interfaces.

TODO in follow up changes:
- rename pedestal_model/basic.py to something more meaningful
- only conditionally compute the pedestal model depending on `set_pedestal` as it
 could be wasteful to compute this in future if we have more expensive pedestal models.

This change also doesn't introduce configuration for choosing between different pedestal models (of which there is only one atm). Propose doing that in a separate change too.

PiperOrigin-RevId: 700028014
Also add docs for configuration for the existing pedestal model and its configuration.

PiperOrigin-RevId: 700048032
The most recent release of xarray contains fixes to file persistence https://github.com/pydata/xarray/releases/tag/v2024.11.0

PiperOrigin-RevId: 700070903
Regenerate tests to include new post-processed output

PiperOrigin-RevId: 700278439
PiperOrigin-RevId: 700466574
Sanders Mike EXT and others added 22 commits January 13, 2025 10:06
to torax_imastools dir + add pyproject optional dependency

* add decorator that throws import error if needed module is not installed

* fix unavailable type hints

* rename test func to actual func name

---------

Co-authored-by: Sanders Mike EXT <[email protected]>
* add loading function for local hdf5 equilibrium

* Adding example IDS equilibrium based on EQDSK
Equilibrium generated with CHEASE from EQDSK_ITERhybrid_COCOS02
Same equilibrium available in different formats and different DD versions
- IMAS netcdf files in DDv3 and 4
- IMAS hdf5 files in DDv4

* Potential fix for automated test

* Modification of mapping to work with DDv4
Adaptation to match the change of COCOS between DDv3 and DDV4
Switched sign of psi and dpsidrhotor

* Minor modifications of the examples equilibrium
Filling b_field_phi to be compliant with DDv4

* Add load_IMAS_data to differentiate nCDf and hdf5

---------

Co-authored-by: MateoBell <[email protected]>
Co-authored-by: MateoBell <[email protected]>
* integration test and unit test for imas geometry based on chease geometry

* integration test and unit test for imas geometry based on chease geometry

* use self.skipif instead of @pytest.mark.skipip

* imas test runs

---------

Co-authored-by: Sanders Mike EXT <[email protected]>
Previous example was not the same as ITER_hybrid file
* separate torax_imastools dir per ids

* Tranfer function for geometry to imas eq
Formula for j parallel just a sketch, will probably have to be corrected

* Small correction

* Updated example config to  match argument changes

* Fix variables names and grid in the interfacing

* Group inputs into SimState and remove input IDS
Objects are naturally grouped into ToraxSimState object now
Input IDS loading removed as for now, might be reimplemented later

* Modified tests for IMAS equilibrium coupling
- Added unit tests for I/O IDS
- Modified integration tests configs (.nc to be changed)

* Small fixes + removal of jparallel for the moment

---------

Co-authored-by: MateoBell <[email protected]>
Generated from the same config. Could be changed with output with CHEASE config for comparison
Possibility to save the plasma boundary from input equilibrium
* separate torax_imastools dir per ids

* Tranfer function for geometry to imas eq
Formula for j parallel just a sketch, will probably have to be corrected

* Small correction

* Updated example config to  match argument changes

* Fix variables names and grid in the interfacing

* Group inputs into SimState and remove input IDS
Objects are naturally grouped into ToraxSimState object now
Input IDS loading removed as for now, might be reimplemented later

* Modified tests for IMAS equilibrium coupling
- Added unit tests for I/O IDS
- Modified integration tests configs (.nc to be changed)

* Small fixes + removal of jparallel for the moment

* Add output files for IMAS equilibrium tests
Generated from the same config. Could be changed with output with CHEASE config for comparison

* Re add deleted test

* Fix b0 in output equilibrium

Co-authored-by: Rick-Fusion <[email protected]>

---------

Co-authored-by: MateoBell <[email protected]>
Co-authored-by: Rick-Fusion <[email protected]>
Copy link

google-cla bot commented Apr 2, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@mikesndrs mikesndrs marked this pull request as draft April 2, 2025 11:56
@MateoBell MateoBell linked an issue Apr 2, 2025 that may be closed by this pull request
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.

7 participants