-
Notifications
You must be signed in to change notification settings - Fork 113
Fix imas loader test #1925
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
Open
Aman-codes0-0
wants to merge
110
commits into
google-deepmind:fix_imas_loader_test
Choose a base branch
from
Aman-codes0-0:fix_imas_loader_test
base: fix_imas_loader_test
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix imas loader test #1925
Aman-codes0-0
wants to merge
110
commits into
google-deepmind:fix_imas_loader_test
from
Aman-codes0-0:fix_imas_loader_test
Conversation
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
- Retune parameters to account for new He impurity - Remove neoclassical transport, pending further verification (e.g. Shaing corrections on axis) - Remove Bremsstrahlung, which was wrongly included - Improve comments
PiperOrigin-RevId: 839776050
PiperOrigin-RevId: 839914032
This commit addresses issue google-deepmind#529 by integrating ICRH minority species with the plasma composition system, ensuring physical consistency across all plasma calculations. Changes: - Add optional 'minority_species' parameter to IonCyclotronSourceConfig that allows specifying which species in plasma_composition to use as the ICRH minority (e.g., 'He3', 'D', 'T') - Add _get_minority_concentration_from_composition() helper function that extracts minority concentration from plasma composition, supporting: * Minority species in main ions (for hydrogenic species) * Minority species in impurities (for helium species) * All three impurity modes: fractions, n_e_ratios, n_e_ratios_Z_eff - Update icrh_model_func() to read minority concentration from plasma_composition when minority_species is set - Maintain backward compatibility: existing configs using minority_concentration parameter continue to work Testing: - Add test_source_with_minority_species_from_composition() to verify new functionality with He3 minority in impurities - All existing ICRH tests pass (backward compatibility confirmed) - All 651 source tests pass (no regressions) This implementation completes the first task in issue google-deepmind#529: "Map ICRH minority to either main-ion (if hydrogenic) or impurity (if He)"
PiperOrigin-RevId: 840925297
PiperOrigin-RevId: 841105328
PiperOrigin-RevId: 841156742
It was an omission earlier that divertor_domain was not in the Pydantic config. The default lower_null was being used in the internal functions. PiperOrigin-RevId: 841161054
Before it was a vector of state variables. The actual residual used for the Newton solver convergence is a scalar. PiperOrigin-RevId: 841163789
PiperOrigin-RevId: 841165700
This results in differences for the TGLFNN-UKAEA test case. T_i: Mean abs diff: 4.76e-01, mean relative diff: 3.25e-02 T_e: Mean abs diff: 5.07e-01, mean relative diff: 3.17e-02 n_e: Mean abs diff: 1.91e+17, mean relative diff: 2.11e-03 psi: Mean abs diff: 4.79e-01, mean relative diff: 2.77e-02 q: Mean abs diff: 2.24e-02, mean relative diff: 7.97e-03 PiperOrigin-RevId: 841527882
Parts requiring specific discussion on implementation left to be reviewed in another PR
…tep-ftop PiperOrigin-RevId: 841670797
The data has been moved since 1.1.1 but the colab installs from the version on PyPI. PiperOrigin-RevId: 841725848
Otherwise `import torax` fails when installing TORAX from source without the optional dep. PiperOrigin-RevId: 841734235
PiperOrigin-RevId: 841738359
…put_core_profiles_coupling PiperOrigin-RevId: 842152033
This follows the description of the rotation rule from the original QLKNN paper (van de Plassche K.L. 2020). The application of the rotation rule is gated by a flag that is false by default. Validation of this rule will be required for both QLKNN10D and QLKNN_7_11 before we can enable it by default. It is possible that the rule cannot be directly applied to QLKNN_7_11 and requires further work. PiperOrigin-RevId: 842207600
PiperOrigin-RevId: 842226735
PiperOrigin-RevId: 842230368
PiperOrigin-RevId: 842245809
- Add smooth transition between models - Fix conversion from psi with 2pi factor - Tune default parameters for an 'ok' match with NCLASS on STEP and ITER cases - Add regression test
PiperOrigin-RevId: 842249046
Needed because MEQ postprocessing does not work for all geometries and fallbacks are needed for robustness. The `_resolve_param` helper now checks if the value provided by the Geometry object is valid (non-zero and not NaN). If the Geometry value is invalid, it falls back to the value provided in the ExtendedLengyelConfig. If no fallback is available in the Config, an error is raised. PiperOrigin-RevId: 842254161
PiperOrigin-RevId: 842266001
PiperOrigin-RevId: 842273128
PiperOrigin-RevId: 842283315
…_grid`. I'm not sure of the exact behaviour but it's possible we're overriding the properties by doing this at the moment. PiperOrigin-RevId: 854125011
… variable. At the moment we assume the face values for the other variable can be linearly extrapolated from the cell values but this might not always be the case. e.g. for rmid if the underlying intermediate has greater resolution than our grid resolution this might yield incorrect values. PiperOrigin-RevId: 854125699
…hanging If a min_dt was reached computations could hang as too many steps were performed and the end state was never reached Other errors such as NAN etc generally cause a MIN_DT on the next step so this is a bit of a catch-all for all the errors Check for the other errors first as MIN_DT is the least informative and can often be caused by other errors PiperOrigin-RevId: 854235567
…_imas_loader PiperOrigin-RevId: 854236534
- Avoid using newton-raphson when not needed - aka in update tests - Move slow gradient tests to their own file - Remove the transport model from the radiation collapse to streamline PiperOrigin-RevId: 854240055
…ion-fractions PiperOrigin-RevId: 854353254
…dinate. PiperOrigin-RevId: 854375790
This change also introduces a validation module for IMAS tools within which we can home validators for different IDS objects. PiperOrigin-RevId: 854566069
…rs versus arrays etc PiperOrigin-RevId: 855158526
PiperOrigin-RevId: 855260677
The main ion information previously needed from RuntimeParamsProvider is no longer required in this function, allowing for the removal of the dependency on build_runtime_params. PiperOrigin-RevId: 855428716
Introduces a dW_dt_smoothing_time_scale parameter in the numerics config to control an exponential moving average for dW/dt. The smoothed dW/dt is now used in the calculation of P_SOL terms and the energy confinement time (tauE). The raw dW/dt is still available as a separate output, for backwards compatibility and also helping with judging the impact of the smoothing. Sim tests regenerated due to modified post processed outputs. P_SOL and P_loss terms with dW/dt verified against RAPTOR. PiperOrigin-RevId: 855645290
PiperOrigin-RevId: 855707709
Tests for `gaussian_profile` and `exponential_profile` functions: - Volume integrals equal the specified `total` parameter - Gaussian profiles peak at the specified `center` location - Profile shapes respond correctly to `width` parameters - Output shapes match the geometry grid
…imas_core_sources PiperOrigin-RevId: 856083552
This change moves the `min_rho_norm` parameter, used for axis extrapolation in psi calculations, from a hardcoded constant to a field in the `Numerics` configuration. All functions in `psi_calculations.py` that use this value now accept it as an argument, and calls to these functions are updated to pass `runtime_params.numerics.min_rho_norm`. PiperOrigin-RevId: 856140920
…ources-formulas-tests PiperOrigin-RevId: 856177150
PiperOrigin-RevId: 856207243
PiperOrigin-RevId: 856324959
…s new function. PiperOrigin-RevId: 857066892
Added cached_property to computed `CellVariable` quantities. This was very important for not blowing up compile times. PiperOrigin-RevId: 857145577
…grids. For face_grad we interpolate between sets of three points in a consistent way that is accurate to second order differences. PiperOrigin-RevId: 857219014
…29-arbitrary-ions PiperOrigin-RevId: 858124963
…k-(issue-1358)The-plotlib_run.py- PiperOrigin-RevId: 858135062
This change modifies the CoreProfiles structure to include the full ChargeStateInfo object, calculated during the core profile initialization and updates. A new cached property, impurity_density_scaling, is added to CoreProfiles to provide the scaling factor needed for true impurity density calculations, avoiding redundant computations in various source and output modules. PiperOrigin-RevId: 858172360
The definition of `toroidal_velocity` is changed from linear velocity (m/s) to angular velocity (rad/s). The calculation of the radial electric field (Er) in `rotation.py` is updated to reflect this change by multiplying the angular velocity by the major radius. Documentation and type hints are also updated to specify "toroidal angular velocity" and units of [rad/s]. PiperOrigin-RevId: 858292690
…librium_object from JSON output - Added @pydantic.model_serializer to IMASConfig class - Excludes non-serializable equilibrium_object field during serialization - Added warning logging when equilibrium_object is used - Added unit tests to verify serialization works correctly - Maintains backward compatibility with imas_filepath and imas_uri This fix allows IMAS geometry to be loaded from equilibrium_object without causing serialization errors when saving config to output.
|
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. |
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.
Navigate to the GitHub pull request creation page and create a new pull request.
URL to visit: https://github.com/Aman-codes0-0/torax/pull/new/fix_imas_loader_test
Once the page loads:
Summary
Fixes #1744 - Loading IMAS geometry from
equilibrium_objectis now compatible with saving config to output.Problem
When using
equilibrium_object(IDS object) in IMAS geometry configuration, the simulation would fail during output serialization because IDS objects cannot be JSON-serialized.Solution
Added a custom Pydantic
@model_serializerto theIMASConfigclass that:equilibrium_objectfield from serializationequilibrium_objectis used to inform usersimas_filepathandimas_uriChanges
Modified Files
torax/_src/geometry/imas.py: Added custom serializer and importstorax/_src/geometry/tests/imas_test.py: Added unit tests for serializationNew Files
test_issue_1744_fix.py: Standalone test script demonstrating the fixTesting
Added two new unit tests:
test_imas_config_serialization_with_filepath- Verifies normal serialization still workstest_imas_config_serialization_excludes_equilibrium_object- Verifies the fix for Loading IMAS geometry from equilibrium ids object is incompatible with saving config to output #1744Backward Compatibility
✅ All existing functionality preserved
✅ No breaking changes
✅ Existing tests continue to pass