-
Notifications
You must be signed in to change notification settings - Fork 3
Add interpolated fields to ESSOS #25
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
base: main
Are you sure you want to change the base?
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.
|
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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.