Fourier-Chebyshev Fit to B for particle tracing#2012
Fourier-Chebyshev Fit to B for particle tracing#2012
B for particle tracing#2012Conversation
…article based on the dimension of the initial conditions. `particle_tracer.py` and `optimization.py` are adapted to this change. Optimization doesn't work yet
Automatically chooses single or multiparticle based on the dimension of the initial conditions. `particle_tracer.py` and `optimization.py` are adapted to this change. Optimization doesn't work yet
…#2027) Updates the requirements on [nbsphinx](https://github.com/spatialaudio/nbsphinx) to permit the latest version. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/spatialaudio/nbsphinx/releases">nbsphinx's releases</a>.</em></p> <blockquote> <h2>nbsphinx 0.9.8</h2> <p><a href="https://pypi.org/project/nbsphinx/0.9.8/">https://pypi.org/project/nbsphinx/0.9.8/</a></p> <ul> <li>Re-enable Sphinx 8.2+</li> <li>Support <code>text/x-rst</code> MIME type in raw cells</li> <li>Support for <code>mathjax4_config</code></li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/spatialaudio/nbsphinx/blob/master/NEWS.rst">nbsphinx's changelog</a>.</em></p> <blockquote> <p>Version 0.9.8 -- 2025-11-28 -- PyPI__ -- diff__</p> <ul> <li>Re-enable Sphinx 8.2+</li> <li>Support <code>text/x-rst</code> MIME type in raw cells</li> <li>Support for <code>mathjax4_config</code></li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.8/">https://pypi.org/project/nbsphinx/0.9.8/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.7...0.9.8">https://github.com/spatialaudio/nbsphinx/compare/0.9.7...0.9.8</a></p> <p>Version 0.9.7 -- 2025-03-03 -- PyPI__ -- diff__</p> <ul> <li>Disable Sphinx 8.2+ (for now)</li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.7/">https://pypi.org/project/nbsphinx/0.9.7/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.6...0.9.7">https://github.com/spatialaudio/nbsphinx/compare/0.9.6...0.9.7</a></p> <p>Version 0.9.6 -- 2024-12-24 -- PyPI__ -- diff__</p> <ul> <li>Markdown: allow lists without leading blank line</li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.6/">https://pypi.org/project/nbsphinx/0.9.6/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.5...0.9.6">https://github.com/spatialaudio/nbsphinx/compare/0.9.5...0.9.6</a></p> <p>Version 0.9.5 -- 2024-08-13 -- PyPI__ -- diff__</p> <ul> <li>Miscellaneous fixes</li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.5/">https://pypi.org/project/nbsphinx/0.9.5/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.4...0.9.5">https://github.com/spatialaudio/nbsphinx/compare/0.9.4...0.9.5</a></p> <p>Version 0.9.4 -- 2024-05-06 -- PyPI__ -- diff__</p> <ul> <li>Require <code>docutils >= 0.18.1</code></li> <li>Minor fixes, documentation and CI updates</li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.4/">https://pypi.org/project/nbsphinx/0.9.4/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.3...0.9.4">https://github.com/spatialaudio/nbsphinx/compare/0.9.3...0.9.4</a></p> <p>Version 0.9.3 -- 2023-08-27 -- PyPI__ -- diff__</p> <ul> <li>Fix gallery regression in Sphinx 7.2</li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.3/">https://pypi.org/project/nbsphinx/0.9.3/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.2...0.9.3">https://github.com/spatialaudio/nbsphinx/compare/0.9.2...0.9.3</a></p> <p>Version 0.9.2 -- 2023-05-24 -- PyPI__ -- diff__</p> <ul> <li>Improve support for <code>sphinx_immaterial</code> theme</li> <li>Improve support for links starting with <code>#</code></li> <li>Add support for in-text citations</li> <li>LaTeX: Add support for admonition titles</li> </ul> <p>__ <a href="https://pypi.org/project/nbsphinx/0.9.2/">https://pypi.org/project/nbsphinx/0.9.2/</a> __ <a href="https://github.com/spatialaudio/nbsphinx/compare/0.9.1...0.9.2">https://github.com/spatialaudio/nbsphinx/compare/0.9.1...0.9.2</a></p> <p>Version 0.9.1 -- 2023-03-14 -- PyPI__ -- diff__</p> <ul> <li>pandoc: disable "smart" option only for version 2.0+</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/4f07420639de321d63681ee8c560f73cb0c4a85f"><code>4f07420</code></a> Release 0.9.8</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/75d6770733a5ef44553759449309a769c0329609"><code>75d6770</code></a> Avoid a logging error</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/dd96f11edb14f7c2027c7ef50663f8c05a014278"><code>dd96f11</code></a> DOC: Update URL for the <img> element</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/d97c0111c4af0423216d217234d87ed73013958d"><code>d97c011</code></a> Add support for mathjax4_config (<a href="https://redirect.github.com/spatialaudio/nbsphinx/issues/854">#854</a>)</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/4882668244e8c0d7b36d0743f9fbc1a48d3160da"><code>4882668</code></a> Fix nbsphinx_assume_equations to work with newer versions of Sphinx</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/95372a74c543565b5e02357db5e248fb865a8326"><code>95372a7</code></a> CI: use "uv" for "publish" workflow</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/9ce8c26cfa363a357b760ed1b0cc45ecb92de1f4"><code>9ce8c26</code></a> setup.py -> pyproject.toml</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/394b9ee5611109db6b234e44e2b61da8e939ac8d"><code>394b9ee</code></a> DOC: use anonymous hyperlinks for embedded URLs</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/ab8592199d6637045b6f77992f10138590130d6b"><code>ab85921</code></a> Bump actions/upload-artifact from 4 to 5</li> <li><a href="https://github.com/spatialaudio/nbsphinx/commit/76122c23c9568305eb6da15abd5278981e8960b1"><code>76122c2</code></a> Bump actions/download-artifact from 4 to 6</li> <li>Additional commits viewable in <a href="https://github.com/spatialaudio/nbsphinx/compare/0.8.12...0.9.8">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rory Conlin <wconlin@princeton.edu>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Memory benchmark result| Test Name | %Δ | Master (MB) | PR (MB) | Δ (MB) | Time PR (s) | Time Master (s) |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
test_objective_jac_w7x | 3.78 % | 3.813e+03 | 3.957e+03 | 144.13 | 39.78 | 36.26 |
test_proximal_jac_w7x_with_eq_update | -1.27 % | 6.663e+03 | 6.579e+03 | -84.80 | 162.72 | 161.50 |
test_proximal_freeb_jac | 0.41 % | 1.316e+04 | 1.321e+04 | 53.79 | 84.83 | 83.43 |
test_proximal_freeb_jac_blocked | 0.41 % | 7.461e+03 | 7.492e+03 | 30.73 | 72.51 | 73.21 |
test_proximal_freeb_jac_batched | -1.25 % | 7.538e+03 | 7.444e+03 | -94.36 | 72.91 | 73.10 |
test_proximal_jac_ripple | -2.37 % | 3.608e+03 | 3.523e+03 | -85.50 | 65.70 | 65.71 |
test_proximal_jac_ripple_bounce1d | -0.08 % | 3.566e+03 | 3.564e+03 | -2.77 | 76.55 | 76.55 |
test_eq_solve | 0.60 % | 1.992e+03 | 2.004e+03 | 12.00 | 93.79 | 94.69 |For the memory plots, go to the summary of |
…ence, update functions to accept FourierChebyshevField
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2012 +/- ##
==========================================
- Coverage 95.75% 95.67% -0.09%
==========================================
Files 102 102
Lines 28344 28471 +127
==========================================
+ Hits 27142 27239 +97
- Misses 1202 1232 +30
🚀 New features to boost your workflow:
|
|
For some reason, this suffers from GPU synchronisation miserably, and for more particles, it is slower than direct approach. |
|
Maybe for these kinds of single node Grid creation, we can use a spline for only the radial part of zernike polynomials. The most expensive part of the transform calculation is the recurrence in the r_dense = jnp.linspace(0.01, 1, 1000)
dense_zernike = zernike_radial(r=r_dense, l=l, m=m)
radial_spline = interpax.Interpolator1D(x=r_dense, f=dense_zernike)
# this should replace zernike call in transform.build
transforms = get_transforms(data_keys, eq, grid, jitable=True, radial_spline=radial_spline)I haven't tested it yet, but it should potentially solve the problem other options had. |
FourierChebyshevFieldwhich has a couple of methods to be compatible with optimization,init: only resolution infobuild: creates grid and transformsfit: given params and profiles (these change during optimization), fits a new Fourier-Chebyshev series.evaluate: Evaluate the series at requested point.Example usage will be,
Todo:
trace_particlesshould initializeFourierChebyshevFieldand by default use it. Add a flag to use Equilibrium fieldplot_particle_trajectoriesetc should also be able to use the interpolated field.