Skip to content
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

2X faster vmec_fieldlines #243

Merged
merged 15 commits into from
Aug 28, 2022
Merged

Conversation

rahulgaur104
Copy link
Contributor

@rahulgaur104 rahulgaur104 commented Jul 4, 2022

Hi everyone,

In the vmec_diagnostics.py script, to find theta_vmec for a given theta_pest, one needs a non-linear root-finding algorithm. I have added a faster root finder to the vmec_fieldlines function. This function, written by Alan Goodman, speeds up the root-finding procedure by a factor of eight and the vmec_fieldlines function by at least a factor of two.

 Date:      Sun Jul 3 21:25:39 2022 -0400
 Committer: Rahul Gaur <rg6256@stellar-intel.princeton.edu>
	modified:   ../../src/simsopt/mhd/vmec_diagnostics.py
	modified:   test_vmec_diagnostics.py
@codecov
Copy link

codecov bot commented Jul 16, 2022

Codecov Report

Merging #243 (bb3b940) into master (22a3b66) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #243   +/-   ##
=======================================
  Coverage   91.80%   91.80%           
=======================================
  Files          60       60           
  Lines        8984     8985    +1     
=======================================
+ Hits         8248     8249    +1     
  Misses        736      736           
Flag Coverage Δ
unittests 91.80% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/simsopt/mhd/vmec_diagnostics.py 99.04% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/simsopt/mhd/vmec_diagnostics.py Outdated Show resolved Hide resolved
src/simsopt/mhd/vmec_diagnostics.py Show resolved Hide resolved
src/simsopt/mhd/vmec_diagnostics.py Outdated Show resolved Hide resolved
src/simsopt/mhd/vmec_diagnostics.py Outdated Show resolved Hide resolved
src/simsopt/mhd/vmec_diagnostics.py Show resolved Hide resolved
@landreman
Copy link
Contributor

Also, fzero_resisduals_function could return derivatives with respect to theta_vmec, so scipy.optimize.newton could then use derivative-based root-finding. This would reduce the number of function evaluations, which would probably speed things up.

vmec_fieldlines: reduced number of iterations for root finding
@landreman landreman self-requested a review August 28, 2022 21:17
@landreman landreman merged commit c5bc6ef into hiddenSymmetries:master Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants