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

Reverse-Mode Differentiable Ideal-Ballooning Stability Solver #1170

Merged
merged 272 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
272 commits
Select commit Hold shift + click to select a range
c72b51d
temporary fix for axis limits of derivatives of contravariant basis v…
rahulgaur104 Sep 30, 2023
d996cf3
removing unused/redundant basis vector
rahulgaur104 Sep 30, 2023
641f989
created a new master_compute_data.pkl
rahulgaur104 Sep 30, 2023
69e166e
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Sep 30, 2023
eea93fb
small fix in _metric.py
rahulgaur104 Sep 30, 2023
0adc1fd
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Sep 30, 2023
2930598
adding master_compute_data.pkl; had to remove pre-commit temporarily
rahulgaur104 Oct 1, 2023
b3e8177
adding a test for the ballooning solver + some changes to the solver
rahulgaur104 Oct 1, 2023
91a111d
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Oct 2, 2023
bee8b20
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Oct 7, 2023
5782aa1
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Oct 10, 2023
9b9e538
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Oct 11, 2023
5d15cc0
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Oct 14, 2023
5d85cbb
Solver now giving relatively sensible values, derivatives of gradpar_…
rahulgaur104 Oct 17, 2023
5af0c55
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Oct 17, 2023
9cadb18
fixing bugs in geometry-related calculation
rahulgaur104 Oct 17, 2023
fb6e90b
trying to pass tests
rahulgaur104 Oct 21, 2023
21ba604
allow deprecation warning in desc.compute._stability
rahulgaur104 Oct 21, 2023
2a4f68b
removing a non-DESC log file
rahulgaur104 Oct 21, 2023
e845b01
wrapping the ballooning solver in the Objective class
rahulgaur104 Oct 21, 2023
2c173cc
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Oct 22, 2023
ad5e7b6
adding field-aligned grid for ballooning + modified __init__.py
rahulgaur104 Oct 22, 2023
257e0cc
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Oct 22, 2023
bdd0c33
final fixes + jax AD only works with CPU foe eigvals doesn't work on …
rahulgaur104 Oct 22, 2023
6fb7e9e
resolving merge conflicts + linting
rahulgaur104 Nov 15, 2023
eec1f88
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Nov 15, 2023
59b6528
adding eigvals custom jvp + fixing tests
rahulgaur104 Nov 15, 2023
55961ba
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Nov 17, 2023
5e05533
fixing tests 2
rahulgaur104 Nov 17, 2023
e620e91
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Nov 17, 2023
c80e2e2
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Nov 17, 2023
9d79a5d
updating objectives/_stability and desc/backend
rahulgaur104 Nov 17, 2023
b1a5e56
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Nov 18, 2023
5dd3700
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Nov 18, 2023
9b2cd5c
remove jitting from desc/compute/_stability.py
rahulgaur104 Nov 18, 2023
08bd696
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Nov 18, 2023
9344f9b
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Nov 27, 2023
4effacf
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Nov 28, 2023
1c9e66f
making compatible with recent commits + added two new ways of solving…
rahulgaur104 Nov 28, 2023
a07597e
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Nov 28, 2023
ae60141
simplified the solver to reduce memory requirements
rahulgaur104 Nov 28, 2023
7d4e0f1
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Dec 7, 2023
ae4eeb1
fixing merge conflicts with master2
rahulgaur104 Dec 7, 2023
2fbc375
merging rc/root, i.e., backward differentaibility through the DESC ro…
rahulgaur104 Dec 7, 2023
82d59a4
optimizing the code to increase GPU usage and number of fieldlines we…
rahulgaur104 Dec 9, 2023
baf5090
adding the Newcomb metric
rahulgaur104 Dec 9, 2023
7914aec
Newcomb metric working, tests failing
rahulgaur104 Dec 9, 2023
3ba1a95
Newcomb metric working, tests failing, merge errors fixed
rahulgaur104 Dec 18, 2023
8b3c728
merging master and resolving conflicts
rahulgaur104 Dec 18, 2023
a361212
Fixing the Newcomb metric, still getting nan optimality after 1 itera…
rahulgaur104 Dec 18, 2023
4d874a1
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Dec 27, 2023
b1a0dc4
merging dd/omnigenity into this PR. Is this enough to give us KBM sta…
rahulgaur104 Dec 27, 2023
212273c
several small changes: normalization, simpson's rule, Newcomb's metric
rahulgaur104 Jan 17, 2024
cc57585
merging master
rahulgaur104 Jan 17, 2024
47b3d5f
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Jan 17, 2024
695e9af
merging with master
rahulgaur104 Feb 9, 2024
c09e27d
merging with master 2
rahulgaur104 Feb 9, 2024
9c3227d
merging dd/omnigenity again 2
rahulgaur104 Feb 9, 2024
0e51f19
fixing black formatting
rahulgaur104 Feb 9, 2024
90610ff
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Feb 9, 2024
85ead1b
Adding FixCurveRotation
rahulgaur104 Feb 9, 2024
53c3f2c
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Feb 9, 2024
5cf43eb
small changes
rahulgaur104 Feb 9, 2024
e4ead7a
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Feb 9, 2024
4b2bcfd
fixing tests
rahulgaur104 Feb 9, 2024
223d4c0
fixing tests
rahulgaur104 Feb 9, 2024
f0f741e
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Feb 10, 2024
087562c
merging with dd/omnigenity 3
rahulgaur104 Feb 10, 2024
be9c4eb
merging with dd/omnigenity 5
rahulgaur104 Feb 10, 2024
6eba64d
merging master + dd/omnigenity should do that same 2
rahulgaur104 Feb 23, 2024
e031fa3
merging with master, omnigenity stale 2
rahulgaur104 Feb 27, 2024
b2189c3
merging dd/omnigenity
rahulgaur104 Feb 28, 2024
20a9d70
Merge branch 'dd/omnigenity' into rg/adjoint_ballooning
rahulgaur104 Feb 29, 2024
aadf5e0
merging master and resolving conflicts
rahulgaur104 Mar 27, 2024
c8cf520
fixing jax.backend line
rahulgaur104 Mar 27, 2024
ad05f95
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Mar 28, 2024
7a4f95b
resolving conflicts and merging with master
rahulgaur104 Apr 3, 2024
dd6b6e5
fixing normalization issue after comparing with VMEC+SIMSOPT ballooni…
rahulgaur104 Apr 3, 2024
743a22d
trying to fix test_data_index_deps
rahulgaur104 Apr 3, 2024
afb600d
trying to fix test_data_index_deps 2
rahulgaur104 Apr 3, 2024
b314872
trying to fix test_data_index_deps 3
rahulgaur104 Apr 3, 2024
1ffd93a
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Apr 4, 2024
b36cd90
merging master and resolving merge conflicsts
rahulgaur104 Jun 21, 2024
3a83ae6
Merge branch 'rg/adjoint_ballooning' of https://github.com/rahulgaur1…
rahulgaur104 Jun 21, 2024
30769fe
replacing ideal_ball_gamma4 with ballooning potential and removing id…
rahulgaur104 Jun 21, 2024
76338da
making changes suggested by Rory
rahulgaur104 Jun 21, 2024
88f56fe
adding ideal_ballooning_stability tutorial notebook
rahulgaur104 Jun 21, 2024
76319ef
replacing the ideal_ballooning tutorial with the version 1....
rahulgaur104 Jun 25, 2024
11e7311
merging master
rahulgaur104 Jun 26, 2024
3db0974
Merge branch 'PlasmaControl:master' into rg/adjoint_ballooning
rahulgaur104 Jun 26, 2024
5e4bb77
rg/adjoint_ballooning_solver + fieldline_compute
rahulgaur104 Jun 26, 2024
370168e
modifying the jupyter notebook... + linear constraints failing during…
rahulgaur104 Jun 26, 2024
ed7a6a9
Merge branch 'rg/adjoint_ballooning2' into rg/adjoint_ballooning
rahulgaur104 Jun 26, 2024
577fb30
updating the tutorial
rahulgaur104 Jun 26, 2024
25a9a11
making small changes to the tutorial
rahulgaur104 Jun 26, 2024
b4d0f36
merging fieldline_compute
rahulgaur104 Jul 8, 2024
23f6a7e
minor changes
rahulgaur104 Jul 8, 2024
d330d7c
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Jul 20, 2024
a2e6d0d
merging master and resolving cconflict in backend.py
rahulgaur104 Aug 6, 2024
09eb0e7
adding comparison test of marginal stability point with COBRAVMEC
rahulgaur104 Aug 7, 2024
59da394
adding a test for the BallooningStability objective
rahulgaur104 Aug 7, 2024
10444ac
fixing stability test
rahulgaur104 Aug 7, 2024
4ff760c
removing useless tests and compute functions
rahulgaur104 Aug 7, 2024
039e344
trying to fix tests 1
rahulgaur104 Aug 7, 2024
c40ad9b
trying to fix tests 2
rahulgaur104 Aug 7, 2024
d137dde
changing notebook environment to Python3
rahulgaur104 Aug 7, 2024
1907d12
fixing tests; correcting bad merge; adjusted to the new api
rahulgaur104 Aug 7, 2024
b5e2868
changing test_compute_everything agains so that tests pass
rahulgaur104 Aug 7, 2024
35acbcd
trying to pass more tests
rahulgaur104 Aug 7, 2024
28d0125
trying to pass more tests 2
rahulgaur104 Aug 8, 2024
e34e7cc
modifying setup.cfg; I don't know why codecov is failing
rahulgaur104 Aug 8, 2024
2fe95c0
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 8, 2024
3c4db48
modifying setup.cfg; I don't know why codecov is failing 2
rahulgaur104 Aug 8, 2024
ade5a83
trying to increase coverage
rahulgaur104 Aug 8, 2024
eaaed50
fixing tests; correcting bad merge
rahulgaur104 Aug 8, 2024
011bc9f
refixing tests!
rahulgaur104 Aug 8, 2024
cca8fec
refixing tests 2!
rahulgaur104 Aug 8, 2024
98bc1eb
trying to fix docs build
rahulgaur104 Aug 8, 2024
2ad71dc
merging master; resolving conflicts
rahulgaur104 Aug 8, 2024
f00c4c7
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Aug 8, 2024
354be45
Merge branch 'master' into rg/adjoint_ballooning
dpanici Aug 9, 2024
55e66fb
merging master and resolving conflicts
rahulgaur104 Aug 11, 2024
d0c0593
making changes suggested by @unalmis
rahulgaur104 Aug 11, 2024
6d526fe
making @fouriest suggestions to desc/backend.py
rahulgaur104 Aug 11, 2024
19a4abc
fixing deprecation warning in tests/test_examples.py
rahulgaur104 Aug 11, 2024
b509848
adding source_grid_requirements to registered stability functions
rahulgaur104 Aug 14, 2024
74f9be9
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 14, 2024
392bc6c
Revert "making @fouriest suggestions to desc/backend.py"
rahulgaur104 Aug 14, 2024
f2e18dd
atoning for other devs' sins!
rahulgaur104 Aug 14, 2024
8d21a37
fixing bad merge + making changes to test_axis_limits
rahulgaur104 Aug 14, 2024
98c8716
adding spacing to the Grid in desc/objectives/_stability
rahulgaur104 Aug 14, 2024
dfccd10
adding more changes suggested by devs
rahulgaur104 Aug 14, 2024
92b377a
adding alpha_tt and _zz to core and making more changes to _metric
rahulgaur104 Aug 14, 2024
62bbf48
fixing a small bug!
rahulgaur104 Aug 14, 2024
11850e6
small changes 2
rahulgaur104 Aug 14, 2024
c327a4b
adding changes suggested by @unalmis
rahulgaur104 Aug 14, 2024
b48cc54
fixing alpha dimension in desc/objectives/_stability
rahulgaur104 Aug 14, 2024
293ede3
removing randomness from alpha in the test alpha grid
rahulgaur104 Aug 14, 2024
a69ac70
merging master; test_compute_everything broken again!
rahulgaur104 Aug 14, 2024
d5b0d00
fixing test_compute_everything
rahulgaur104 Aug 14, 2024
faa51d8
trying vectorizing of compute. bad idea!
rahulgaur104 Aug 15, 2024
691b0d0
trying other ways of vectorizing over alpha
rahulgaur104 Aug 16, 2024
7e90f95
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 16, 2024
eaebf7a
Merge branch 'master' into rg/adjoint_ballooning
dpanici Aug 17, 2024
6a2268e
major refactoring... using grid_rtz to vectorize for arbitrary alpha …
rahulgaur104 Aug 18, 2024
9719c6a
fixing desc/objectives/_stability.py and compute/_stability.py
rahulgaur104 Aug 18, 2024
56d44b2
removing debugger; small change
rahulgaur104 Aug 18, 2024
b72c80e
copying tests from Gamma_c so that tests in this branch pass
rahulgaur104 Aug 18, 2024
636458e
small change to test_compute_everything
rahulgaur104 Aug 18, 2024
7e5aa73
small change to test_compute_everything 2
rahulgaur104 Aug 18, 2024
306880c
small changes here and there, addressing reviewers comments
rahulgaur104 Aug 18, 2024
8d58f5a
adding notebook; making jacobian calculation rev mode
rahulgaur104 Aug 18, 2024
0d4c7b6
reevrting back to dysfunctional equilibrium.py and coords.py code
rahulgaur104 Aug 18, 2024
90afb5b
reverting back to copies of coords and equilibrium from Gamma_c, modi…
rahulgaur104 Aug 18, 2024
6d3519b
merging ku/root_3d + correcting notebook
rahulgaur104 Aug 18, 2024
41f6718
including small correction by @kunalmis
rahulgaur104 Aug 18, 2024
8c98850
test_ATF_results still failing copying equilibrium.py and coords.py d…
rahulgaur104 Aug 19, 2024
42f0ffb
fixing coords.py and equilibrium.py again
rahulgaur104 Aug 19, 2024
7b1b704
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 19, 2024
d5eca40
small changes
rahulgaur104 Aug 19, 2024
a6f2061
Merge branch 'ku/root_3d' into rg/adjoint_ballooning
rahulgaur104 Aug 19, 2024
6c6135b
making a small fake change to restart the testing
rahulgaur104 Aug 19, 2024
3693330
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Aug 19, 2024
1d170d5
updating tests/test_equilibrium.py
rahulgaur104 Aug 19, 2024
6add32f
trying to pass more tests
rahulgaur104 Aug 19, 2024
56ffce3
ensuring that the resolution for calculating iota is not too small in…
rahulgaur104 Aug 19, 2024
b9e209e
updating notebook
rahulgaur104 Aug 19, 2024
f9efd3c
small fix
rahulgaur104 Aug 19, 2024
03eb7fd
changing notebook environment so it runs
rahulgaur104 Aug 19, 2024
c7e1d44
changing notebook environment so it runs
rahulgaur104 Aug 19, 2024
c7aad11
changing notebook environment so it runs
rahulgaur104 Aug 19, 2024
6beaad1
adding reference to Newcomb stability
rahulgaur104 Aug 19, 2024
8a3f77b
Merge branch 'master' into rg/adjoint_ballooning
dpanici Aug 20, 2024
39618ce
Merge branch 'master' into rg/adjoint_ballooning
unalmis Aug 20, 2024
74c8e07
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Aug 21, 2024
f818935
moving ideal ball gamma 1 to tests
rahulgaur104 Aug 21, 2024
569a587
changing the definition of cvdrift0
rahulgaur104 Aug 21, 2024
7ac7fb0
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 21, 2024
ead3060
updating master_compute_data_rpz.pkl because cvdrift0 was changed
rahulgaur104 Aug 21, 2024
45b19f5
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 22, 2024
ef465df
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 22, 2024
34087ea
changing desc/compute/_stability because of recent logic change in so…
rahulgaur104 Aug 22, 2024
f158b41
changing more code because the stability test is failing
rahulgaur104 Aug 22, 2024
b4a716d
testing things still
rahulgaur104 Aug 22, 2024
7fb4055
finally fixed it
rahulgaur104 Aug 22, 2024
67023f3
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 22, 2024
08a4481
fixing test
rahulgaur104 Aug 22, 2024
237c6c3
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 22, 2024
70f921f
fixing test 2
rahulgaur104 Aug 23, 2024
6326a4f
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 24, 2024
8807902
changing print format to be compatible with master
rahulgaur104 Aug 24, 2024
6f353f0
merging master manually; test compute everything fails again!
rahulgaur104 Aug 27, 2024
f156782
fixing bad merge
rahulgaur104 Aug 27, 2024
8d79b24
making change suggested by @unalmis
rahulgaur104 Aug 27, 2024
54cf2da
changing master_compute_data_rpz.pkl
rahulgaur104 Aug 27, 2024
5d3a8fe
fixing bad merge
rahulgaur104 Aug 27, 2024
015e6a9
merging master manually
rahulgaur104 Aug 28, 2024
fd2a9f6
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 28, 2024
b118f58
Allow zeta0 to be specified for ballooning compute
f0uriest Aug 28, 2024
53d50b2
Clean up formatting, docstrings, notation
f0uriest Aug 28, 2024
db178ff
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 29, 2024
0b74fc9
Add missing variables to objective docstring, rename some
f0uriest Aug 28, 2024
99a8bdd
Fix newcomb metric
f0uriest Aug 29, 2024
99f52e9
Clean up and document tests, remove unneeded backend stuff
f0uriest Aug 29, 2024
ebd3375
Clean up notebook formatting
f0uriest Aug 29, 2024
2e14e9d
Merge branch 'rg/adjoint_ballooning' of github.com:PlasmaControl/DESC…
f0uriest Aug 29, 2024
21ec0c9
Fix regression test
f0uriest Aug 29, 2024
f688fb7
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Aug 30, 2024
1992af7
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 2, 2024
e256f6a
making some changes from reviews and reverting back to lambda
rahulgaur104 Sep 3, 2024
efcc036
generalizing towards multiple rho values
rahulgaur104 Sep 3, 2024
31772cb
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Sep 3, 2024
c4be9e3
remaining suggestions during review
rahulgaur104 Sep 3, 2024
9b5f29b
update master_compute_data.pkl
rahulgaur104 Sep 3, 2024
8df58a9
merging master
rahulgaur104 Sep 3, 2024
5b8e090
fixing tests
rahulgaur104 Sep 3, 2024
abe2a70
can't find the source of coverage loss
rahulgaur104 Sep 3, 2024
8f7511d
test
rahulgaur104 Sep 3, 2024
d4b7884
reverting test
rahulgaur104 Sep 3, 2024
2e6ac7c
making the rest of the changes suggested during review
rahulgaur104 Sep 3, 2024
09dc8b0
I don't know why coverage fails randomly sometimes
rahulgaur104 Sep 3, 2024
ef33b98
Changing symbols in the notebook
rahulgaur104 Sep 3, 2024
78d696b
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 4, 2024
99f9675
changing ideal ball gamma2 to ideal ball lambda
rahulgaur104 Sep 5, 2024
961cc47
changing rest of the instances of ideal ball gamma2 to ideal ball lambda
rahulgaur104 Sep 5, 2024
c437acd
updating notebook and CHANGELOG.md
rahulgaur104 Sep 5, 2024
ce2ebfa
more changes
rahulgaur104 Sep 5, 2024
7c53d73
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 5, 2024
d77a61a
fixing merge conflicts from PR#1241
rahulgaur104 Sep 5, 2024
2bc57f4
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Sep 5, 2024
d0f5975
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 10, 2024
f183ddd
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 18, 2024
4e433e6
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 18, 2024
0a69fd6
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 21, 2024
dae097e
making changes suggested by @ddudt
rahulgaur104 Sep 24, 2024
da9e9cc
changing the notebook
rahulgaur104 Sep 24, 2024
fe36a35
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 24, 2024
6fe8f07
merging master manually and changing master_compute_data_rpz.pkl file
rahulgaur104 Sep 25, 2024
c921e09
changing master_compute_data_rpz.pkl again
rahulgaur104 Sep 25, 2024
1e74ea7
making tests suggested during the dev meeting
rahulgaur104 Sep 25, 2024
c316eb0
minor changes
rahulgaur104 Sep 25, 2024
694fb1a
minor change 2
rahulgaur104 Sep 25, 2024
cdfb7f4
adding changes suggested by @dpanici
rahulgaur104 Sep 25, 2024
0ab6afb
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Sep 25, 2024
fdf3cac
final changes suggested by @dpanici
rahulgaur104 Sep 26, 2024
e90ce6d
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 26, 2024
b0693fa
Merge branch 'master' into rg/adjoint_ballooning
rahulgaur104 Sep 26, 2024
fd439f0
final changes 2
rahulgaur104 Sep 26, 2024
a5c7673
Merge branch 'rg/adjoint_ballooning' of https://github.com/PlasmaCont…
rahulgaur104 Sep 26, 2024
ff85459
final changes 3
rahulgaur104 Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ tests/benchmarks/.benchmarks/
*.output
*.pdf
*.pyc
*.swp
dpanici marked this conversation as resolved.
Show resolved Hide resolved
*.swo
.pymon
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ New Features
- Changes ``ToroidalFlux`` objective to default using a 1D loop integral of the vector potential
to compute the toroidal flux when possible, as opposed to a 2D surface integral of the magnetic field dotted with ``n_zeta``.
- Allow specification of Nyquist spectrum maximum modenumbers when using ``VMECIO.save`` to save a DESC .h5 file as a VMEC-format wout file
- Added and tested infinite-n ideal-ballooning stability solver implemented as a part of the BallooningStability Objective. DESC can use reverse-mode AD to now optimize equilibria against infinite-n ideal ballooning modes.
- Add ``jac_chunk_size`` to ``ObjectiveFunction`` and ``_Objective`` to control the above chunk size for the ``fwd`` mode Jacobian calculation
- if ``None``, the chunk size is equal to ``dim_x``, so no chunking is done
- if an ``int``, this is the chunk size to be used.
- if ``"auto"`` for the ``ObjectiveFunction``, will use a heuristic for the maximum ``jac_chunk_size`` needed to fit the jacobian calculation on the available device memory, according to the formula: ``max_jac_chunk_size = (desc_config.get("avail_mem") / estimated_memory_usage - 0.22) / 0.85 * self.dim_x`` with ``estimated_memory_usage = 2.4e-7 * self.dim_f * self.dim_x + 1``
- the ``ObjectiveFunction`` ``jac_chunk_size`` is used if ``deriv_mode="batched"``, and the ``_Objective`` ``jac_chunk_size`` will be used if ``deriv_mode="blocked"``


Bug Fixes

- Fixes bugs that occur when saving asymmetric equilibria as wout files
Expand Down
50 changes: 25 additions & 25 deletions desc/compute/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1547,24 +1547,6 @@ def _alpha_t(params, transforms, profiles, data, **kwargs):
return data


@register_compute_fun(
name="alpha_tt",
label="\\partial_{\\theta \\theta} \\alpha",
units="~",
units_long="None",
description="Field line label, second derivative wrt poloidal coordinate",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["theta_PEST_tt", "phi_tt", "iota"],
)
def _alpha_tt(params, transforms, profiles, data, **kwargs):
data["alpha_tt"] = data["theta_PEST_tt"] - data["iota"] * data["phi_tt"]
return data


@register_compute_fun(
name="alpha_tz",
label="\\partial_{\\theta \\zeta} \\alpha",
Expand Down Expand Up @@ -1601,12 +1583,30 @@ def _alpha_z(params, transforms, profiles, data, **kwargs):
return data


@register_compute_fun(
name="alpha_tt",
label="\\partial_{\\theta \\theta} \\alpha",
units="~",
units_long="None",
description="Field line label, second-order derivative wrt poloidal coordinate",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["phi_tt", "iota", "theta_PEST_tt"],
)
def _alpha_tt(params, transforms, profiles, data, **kwargs):
data["alpha_tt"] = data["theta_PEST_tt"] - data["iota"] * data["phi_tt"]
return data


@register_compute_fun(
name="alpha_zz",
label="\\partial_{\\zeta \\zeta} \\alpha",
units="~",
units_long="None",
description="Field line label, second derivative wrt toroidal coordinate",
description="Field line label, second-order derivative wrt toroidal coordinate",
dim=1,
params=[],
transforms={},
Expand Down Expand Up @@ -3105,8 +3105,8 @@ def _theta_PEST_r(params, transforms, profiles, data, **kwargs):
label="\\partial_{\\rho \\theta} \\vartheta",
units="rad",
units_long="radians",
description="PEST straight field line poloidal angular coordinate, derivative wrt "
"radial and DESC poloidal coordinate",
description="PEST straight field line poloidal angular coordinate,"
"derivative wrt poloidal and radial coordinate",
dim=1,
params=[],
transforms={},
Expand Down Expand Up @@ -3201,8 +3201,8 @@ def _theta_PEST_t(params, transforms, profiles, data, **kwargs):
label="\\partial_{\\theta \\theta} \\vartheta",
units="rad",
units_long="radians",
description="PEST straight field line poloidal angular coordinate, second "
"derivative wrt poloidal coordinate",
description="PEST straight field line poloidal angular coordinate,"
"second derivative wrt poloidal coordinate",
dim=1,
params=[],
transforms={},
Expand Down Expand Up @@ -3277,8 +3277,8 @@ def _theta_PEST_tzz(params, transforms, profiles, data, **kwargs):
label="\\partial_{\\zeta} \\vartheta",
units="rad",
units_long="radians",
description="PEST straight field line poloidal angular coordinate, derivative wrt "
"toroidal coordinate",
description="PEST straight field line poloidal angular coordinate,"
" derivative wrt toroidal coordinate",
dim=1,
params=[],
transforms={},
Expand Down
125 changes: 82 additions & 43 deletions desc/compute/_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _sqrtg_clebsch(params, transforms, profiles, data, **kwargs):

@register_compute_fun(
name="|e_theta x e_zeta|",
label="|\\mathbf{e}_{\\theta} \\times \\mathbf{e}_{\\zeta}|",
label="| \\mathbf{e}_{\\theta} \\times \\mathbf{e}_{\\zeta} |",
units="m^{2}",
units_long="square meters",
description="2D Jacobian determinant for constant rho surface",
Expand Down Expand Up @@ -141,7 +141,7 @@ def _e_theta_x_e_zeta_r(params, transforms, profiles, data, **kwargs):

@register_compute_fun(
name="|e_theta x e_zeta|_rr",
label="\\partial_{\\rho\\rho} |\\mathbf{e}_{\\theta} \\times \\mathbf{e}_{\\zeta}|",
label="\\partial_{\\rho\\rho}|\\mathbf{e}_{\\theta}\\times\\mathbf{e}_{\\zeta}|",
units="m^{2}",
units_long="square meters",
description="2D Jacobian determinant for constant rho surface"
Expand Down Expand Up @@ -180,7 +180,7 @@ def _e_theta_x_e_zeta_rr(params, transforms, profiles, data, **kwargs):

@register_compute_fun(
name="|e_theta x e_zeta|_z",
label="\\partial_{\\zeta}|e_{\\theta} \\times e_{\\zeta}|",
label="\\partial_{\\zeta}|\\mathbf{e}_{\\theta} \\times \\mathbf{e}_{\\zeta}|",
units="m^{2}",
units_long="square meters",
description="2D Jacobian determinant for constant rho surface,"
Expand Down Expand Up @@ -1443,6 +1443,44 @@ def _g_sup_rr_r(params, transforms, profiles, data, **kwargs):
return data


@register_compute_fun(
name="g^rr_t",
label="\\partial_{\\theta} g^{\\rho \\rho}",
units="m^-2",
units_long="inverse square meters",
description="Radial/Radial element of contravariant metric tensor, "
+ "first poloidal derivative",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^rho_t"],
)
def _g_sup_rr_t(params, transforms, profiles, data, **kwargs):
data["g^rr_t"] = 2 * dot(data["e^rho_t"], data["e^rho"])
return data


@register_compute_fun(
name="g^rr_z",
label="\\partial_{\\zeta} g^{\\rho \\rho}",
units="m^-2",
units_long="inverse square meters",
description="Radial/Radial element of contravariant metric tensor, "
+ "first toroidal derivative",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^rho_z"],
)
def _g_sup_rr_z(params, transforms, profiles, data, **kwargs):
data["g^rr_z"] = 2 * dot(data["e^rho_z"], data["e^rho"])
return data


@register_compute_fun(
name="g^rt_r",
label="\\partial_{\\rho} g^{\\rho \\theta}",
Expand Down Expand Up @@ -1544,25 +1582,6 @@ def _g_sup_zz_r(params, transforms, profiles, data, **kwargs):
return data


@register_compute_fun(
name="g^rr_t",
label="\\partial_{\\theta} g^{\\rho \\rho}",
units="m^-2",
units_long="inverse square meters",
description="Radial/Radial element of contravariant metric tensor, "
+ "first poloidal derivative",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^rho_t"],
)
def _g_sup_rr_t(params, transforms, profiles, data, **kwargs):
data["g^rr_t"] = 2 * dot(data["e^rho_t"], data["e^rho"])
return data


@register_compute_fun(
name="g^rt_t",
label="\\partial_{\\theta} g^{\\rho \\theta}",
Expand Down Expand Up @@ -1664,25 +1683,6 @@ def _g_sup_zz_t(params, transforms, profiles, data, **kwargs):
return data


@register_compute_fun(
name="g^rr_z",
label="\\partial_{\\zeta} g^{\\rho \\rho}",
units="m^-2",
units_long="inverse square meters",
description="Radial/Radial element of contravariant metric tensor, "
+ "first toroidal derivative",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^rho_z"],
)
def _g_sup_rr_z(params, transforms, profiles, data, **kwargs):
data["g^rr_z"] = 2 * dot(data["e^rho_z"], data["e^rho"])
return data


@register_compute_fun(
name="g^rt_z",
label="\\partial_{\\zeta} g^{\\rho \\theta}",
Expand Down Expand Up @@ -1900,6 +1900,42 @@ def _gradzeta(params, transforms, profiles, data, **kwargs):
return data


@register_compute_fun(
name="g^aa",
label="g^{\\alpha \\alpha}",
units="m^{-2}",
units_long="inverse square meters",
description="Contravariant metric tensor grad alpha dot grad alpha",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["grad(alpha)"],
)
def _g_sup_aa(params, transforms, profiles, data, **kwargs):
data["g^aa"] = dot(data["grad(alpha)"], data["grad(alpha)"])
return data


@register_compute_fun(
name="g^ra",
label="g^{\\rho \\alpha}",
units="m^{-2}",
units_long="inverse square meters",
description="Contravariant metric tensor grad rho dot grad alpha",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["grad(alpha)", "e^rho"],
)
def _g_sup_ra(params, transforms, profiles, data, **kwargs):
data["g^ra"] = dot(data["grad(alpha)"], data["e^rho"])
unalmis marked this conversation as resolved.
Show resolved Hide resolved
return data


@register_compute_fun(
name="gbdrift",
# Exact definition of the magnetic drifts taken from
Expand Down Expand Up @@ -1967,10 +2003,13 @@ def _cvdrift(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "e^rho", "grad(|B|)"],
data=["rho", "|B|^2", "b", "e^rho", "grad(|B|)"],
)
def _cvdrift0(params, transforms, profiles, data, **kwargs):
data["cvdrift0"] = (
1 / data["|B|^2"] * (dot(data["b"], cross(data["grad(|B|)"], data["e^rho"])))
2
* data["rho"]
/ data["|B|^2"]
* (dot(data["b"], cross(data["grad(|B|)"], data["e^rho"])))
)
return data
Loading