DESC
DESC copied to clipboard
change field line integration to use diffrax
Made the changes and the tests added pass in isolation, but I think there are some incompatibility issues with some other packages possibly...
- [ ] set default min stepsize (or choose fixed stepsize instead of adaptive) based off of this paper
- [ ] profile against jax odeint , with/without the terminating event (is it compile time etc?)
closes #609
The RuntimeWarning for numpy header size being different is still an issue, I think because the warning is coming from C level code (@f0uriest @unalmis any ideas on how to ignore those? seems like a filterwarnings problem), right now I have in a blanket ignore RuntimeWarning but that is not really what we want, I opened an issue to see if pytest knows how to resolve it https://github.com/pytest-dev/pytest/issues/11304
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.45%. Comparing base (
a4220a4) to head (acf1c98). Report is 2206 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #610 +/- ##
==========================================
- Coverage 95.45% 95.45% -0.01%
==========================================
Files 95 95
Lines 23419 23429 +10
==========================================
+ Hits 22354 22363 +9
- Misses 1065 1066 +1
| Files with missing lines | Coverage Δ | |
|---|---|---|
| desc/magnetic_fields/_core.py | 96.61% <100.00%> (+0.04%) |
:arrow_up: |
it looks like there are older versions of diffrax that work with older versions of jax. They might not have the discrete terminating event stuff but might still be useful for being able to select different integration schemes etc.
exp. decrease RHS outside the bounding box (exp(-r)*B) and try older version
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_midres | -3.98 +/- 5.49 | -2.57e-02 +/- 3.55e-02 | 6.21e-01 +/- 3.1e-02 | 6.46e-01 +/- 1.7e-02 |
test_build_transform_fft_highres | -5.12 +/- 3.82 | -5.40e-02 +/- 4.03e-02 | 1.00e+00 +/- 3.8e-02 | 1.06e+00 +/- 1.4e-02 |
test_equilibrium_init_lowres | -6.77 +/- 2.85 | -2.81e-01 +/- 1.19e-01 | 3.87e+00 +/- 8.7e-02 | 4.15e+00 +/- 8.0e-02 |
test_objective_compile_atf | -0.44 +/- 3.12 | -3.49e-02 +/- 2.48e-01 | 7.93e+00 +/- 2.1e-01 | 7.96e+00 +/- 1.3e-01 |
test_objective_compute_atf | -0.53 +/- 2.12 | -5.40e-05 +/- 2.17e-04 | 1.02e-02 +/- 1.1e-04 | 1.02e-02 +/- 1.9e-04 |
test_objective_jac_atf | +0.26 +/- 1.38 | +4.96e-03 +/- 2.65e-02 | 1.92e+00 +/- 1.7e-02 | 1.92e+00 +/- 2.1e-02 |
test_perturb_1 | +2.56 +/- 5.52 | +3.16e-01 +/- 6.80e-01 | 1.26e+01 +/- 5.8e-01 | 1.23e+01 +/- 3.5e-01 |
test_proximal_jac_atf | +0.34 +/- 1.47 | +2.78e-02 +/- 1.19e-01 | 8.12e+00 +/- 6.9e-02 | 8.09e+00 +/- 9.7e-02 |
test_proximal_freeb_compute | +2.33 +/- 1.08 | +4.26e-03 +/- 1.98e-03 | 1.87e-01 +/- 1.5e-03 | 1.83e-01 +/- 1.2e-03 |
test_build_transform_fft_lowres | +0.30 +/- 6.13 | +1.60e-03 +/- 3.26e-02 | 5.33e-01 +/- 2.4e-02 | 5.31e-01 +/- 2.1e-02 |
test_equilibrium_init_medres | +1.40 +/- 5.57 | +5.74e-02 +/- 2.29e-01 | 4.17e+00 +/- 2.3e-01 | 4.11e+00 +/- 3.5e-02 |
test_equilibrium_init_highres | +1.59 +/- 2.35 | +8.64e-02 +/- 1.28e-01 | 5.53e+00 +/- 1.2e-01 | 5.45e+00 +/- 4.5e-02 |
test_objective_compile_dshape_current | +0.40 +/- 1.18 | +1.54e-02 +/- 4.49e-02 | 3.82e+00 +/- 8.8e-03 | 3.81e+00 +/- 4.4e-02 |
test_objective_compute_dshape_current | +0.63 +/- 1.60 | +2.19e-05 +/- 5.52e-05 | 3.48e-03 +/- 3.9e-05 | 3.46e-03 +/- 3.9e-05 |
test_objective_jac_dshape_current | -1.70 +/- 5.33 | -6.86e-04 +/- 2.14e-03 | 3.96e-02 +/- 1.4e-03 | 4.03e-02 +/- 1.6e-03 |
test_perturb_2 | +0.48 +/- 1.96 | +8.30e-02 +/- 3.38e-01 | 1.73e+01 +/- 1.9e-01 | 1.72e+01 +/- 2.8e-01 |
test_proximal_freeb_jac | -0.42 +/- 0.77 | -3.18e-02 +/- 5.76e-02 | 7.48e+00 +/- 3.2e-02 | 7.51e+00 +/- 4.8e-02 |
test_solve_fixed_iter | -0.31 +/- 61.51 | -1.52e-02 +/- 3.05e+00 | 4.95e+00 +/- 2.2e+00 | 4.96e+00 +/- 2.1e+00 |
@dpanici I know you can't formally approve this but lmk if you have any comments