Open
Conversation
- Introduced tests for `InterpolatedField` including linear and quadratic fields, ensuring exactness and JIT compatibility. - Implemented tests for `RegularGridInterpolant3D` to validate building and evaluation with linear fields, including skip function behavior. - Added tests for `SurfaceRZFourier` to verify geometry, normals, cross-sectional area, and field evaluations on surfaces. - Included a mock magnetic field for testing `B_on_surface`, `BdotN`, and `BdotN_over_B` functions. - Established a `SurfaceClassifier` with tests for signed distances and vectorized evaluations. - Ensured numerical stability by enabling x64 precision in tests.
Collaborator
Author
|
@eduardolneto I refactored the surface classifier, and it appears to run faster. Could you check if it is faster for you and gives the same results? |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces field interpolation capabilities to ESSOS to solve performance issues with long field line tracing and particle tracing in coil fields. The implementation builds on SIMSOPT's interpolation methods and adds comprehensive support for both general interpolated fields and VMEC-native coordinate interpolation.
Key changes:
- Implements
InterpolatedFieldandRegularGridInterpolant3Dclasses for fast 3D field interpolation - Adds
InterpolatedVmecNativefor native (s,θ,φ) coordinate interpolation - Enhances
SurfaceClassifierwith improved performance and phi wrapping capabilities
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| essos/interpolated_field.py | Core interpolation framework with Lagrange basis functions, regular grid interpolants, and coordinate transformations |
| essos/surfaces.py | Enhanced SurfaceClassifier with cKDTree optimization and phi wrapping support |
| tests/test_interpolated_field.py | Comprehensive test suite covering interpolation rules, grid operations, and VMEC native interpolation |
| tests/test_surfaces.py | Test suite for surface geometry, field evaluation, and classification functionality |
| examples/trace_fieldlines_interpolated.py | Example demonstrating interpolated field usage for field line tracing with performance timing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…mpilation in surface tests
…ssifier. It now uses different methods for cpu and for gpu. Also changed use_fundamental_phi default value to False
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.
This PR (still in draft) introduces field interpolation in ESSOS. This solves the issue of really long field line tracing times and long particle tracing times in coil fields. This is based on the interpolation methods used in SIMSOPT.
An example is shown in VMEC, but the goal is to have a general interpolated field for any magnetic field class instead of specific implementations.