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

Proxies for neoclassical transport of energetic ions #1229

Draft
wants to merge 38 commits into
base: Gamma_c
Choose a base branch
from

Conversation

gretahibbard
Copy link
Collaborator

@gretahibbard gretahibbard commented Aug 28, 2024

Adding proxies for neoclassical transport from Velasco's "A model for the fast evaluation of prompt losses of
energetic ions in stellarators" https://doi.org/10.1088/1741-4326/ac2994

  • Gamma_c [ eq. 16 ]
  • Gamma_delta [ eq. 19 ]
  • and Gamma_alpha [ eq. 25 ]

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@rahulgaur104 rahulgaur104 marked this pull request as draft August 28, 2024 14:04
@YigitElma
Copy link
Collaborator

YigitElma commented Aug 28, 2024

I know this is still a draft and you will probably make many changes but I want to make some kind suggestions,

  • You can install pre-commit for automatic checks when you commit such that you don't get comments from github-actions https://github.com/PlasmaControl/DESC/blob/master/CONTRIBUTING.rst#python-styleguide
  • On VS Code, there is black formatter plugin which will automatically format a file when you save it, I find this very usefull
  • to exclude the files (you use for testing and debugging purposes) from git version control, you can update your .git/info/exclude file which is a local .gitignore file (because we don't want to add a bunch of files to the main .gitignore)
  • if you run a jupyter notebook on tutorials folder, even if you don't make actual code changes, some device info part of the file will change which cause git to track those changes. I recommend don't commit those changes (in VS Code you can revert those files to the original format 'before committing') because in future it may cause merge conflicts which is very cumbersome to resolve for notebooks. If you already committed the changes, you can copy/paste the files from master branch

These are general suggestions for devs

@rahulgaur104 rahulgaur104 changed the title Gh/gamma c Proxies for neoclassical transport of energetic ions Aug 28, 2024
@unalmis unalmis mentioned this pull request Aug 29, 2024
3 tasks
unalmis added a commit that referenced this pull request Sep 3, 2024
This PR adds functionality to compute bounce averages in DESC

- [x] Differentiable algorithm to compute bounce points and integrals.
- [x] Works with any numerical quadrature
- [x] Fixed bugs with numpy compatibility.

Related
- #1003 
- #1042 
- #1229 
- #1196
"bool : Whether to adaptively integrate over the velocity coordinate. "
"If true, then num_pitch specifies an upper bound on the maximum number "
"of function evaluations."
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add thresh (or I'd prefer the full name threshold actually) as a keyword arg here, that way when this is computed it can be specified by the user. see for example helicity kwarg in the QS quantities (

helicity="tuple: Type of quasisymmetry, (M,N). Default (1,0)",
)

@dpanici
Copy link
Collaborator

dpanici commented Sep 25, 2024

benchmark with KNOSOS

@rahulgaur104 rahulgaur104 changed the base branch from Gamma_c to master September 28, 2024 16:33
Copy link
Contributor

github-actions bot commented Sep 28, 2024

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +0.05 +/- 5.77     | +2.70e-04 +/- 3.04e-02 |  5.27e-01 +/- 3.0e-02  |  5.27e-01 +/- 6.4e-03  |
 test_equilibrium_init_medres            |     -0.64 +/- 0.99     | -2.64e-02 +/- 4.10e-02 |  4.10e+00 +/- 3.8e-02  |  4.13e+00 +/- 1.5e-02  |
 test_equilibrium_init_highres           |     +0.10 +/- 0.52     | +5.40e-03 +/- 2.83e-02 |  5.47e+00 +/- 2.3e-02  |  5.47e+00 +/- 1.7e-02  |
 test_objective_compile_dshape_current   |     +0.29 +/- 1.09     | +1.13e-02 +/- 4.24e-02 |  3.88e+00 +/- 3.9e-02  |  3.87e+00 +/- 1.6e-02  |
 test_objective_compute_dshape_current   |     +0.95 +/- 1.35     | +3.43e-05 +/- 4.88e-05 |  3.64e-03 +/- 3.3e-05  |  3.60e-03 +/- 3.6e-05  |
 test_objective_jac_dshape_current       |     +0.62 +/- 7.68     | +2.52e-04 +/- 3.10e-03 |  4.06e-02 +/- 2.3e-03  |  4.04e-02 +/- 2.1e-03  |
 test_perturb_2                          |     -0.01 +/- 1.43     | -1.85e-03 +/- 2.49e-01 |  1.74e+01 +/- 1.8e-01  |  1.74e+01 +/- 1.7e-01  |
 test_proximal_freeb_jac                 |     +0.19 +/- 1.49     | +1.39e-02 +/- 1.11e-01 |  7.48e+00 +/- 7.8e-02  |  7.46e+00 +/- 7.9e-02  |
 test_solve_fixed_iter                   |     -0.51 +/- 59.41    | -2.53e-02 +/- 2.97e+00 |  4.98e+00 +/- 2.1e+00  |  5.01e+00 +/- 2.1e+00  |
 test_build_transform_fft_midres         |     +0.30 +/- 6.99     | +1.82e-03 +/- 4.26e-02 |  6.11e-01 +/- 2.9e-02  |  6.09e-01 +/- 3.1e-02  |
 test_build_transform_fft_highres        |     +1.07 +/- 2.71     | +1.07e-02 +/- 2.69e-02 |  1.00e+00 +/- 2.2e-02  |  9.94e-01 +/- 1.6e-02  |
 test_equilibrium_init_lowres            |     +0.73 +/- 2.19     | +2.75e-02 +/- 8.25e-02 |  3.80e+00 +/- 7.9e-02  |  3.77e+00 +/- 2.4e-02  |
 test_objective_compile_atf              |     +0.64 +/- 1.84     | +5.07e-02 +/- 1.45e-01 |  7.93e+00 +/- 6.0e-02  |  7.88e+00 +/- 1.3e-01  |
 test_objective_compute_atf              |     +1.46 +/- 1.80     | +1.53e-04 +/- 1.88e-04 |  1.06e-02 +/- 1.5e-04  |  1.05e-02 +/- 1.2e-04  |
 test_objective_jac_atf                  |     -0.12 +/- 2.20     | -2.41e-03 +/- 4.28e-02 |  1.95e+00 +/- 3.9e-02  |  1.95e+00 +/- 1.7e-02  |
 test_perturb_1                          |     +2.83 +/- 3.66     | +3.44e-01 +/- 4.45e-01 |  1.25e+01 +/- 4.0e-01  |  1.22e+01 +/- 2.0e-01  |
 test_proximal_jac_atf                   |     -0.10 +/- 0.85     | -7.86e-03 +/- 6.88e-02 |  8.10e+00 +/- 4.7e-02  |  8.11e+00 +/- 5.0e-02  |
 test_proximal_freeb_compute             |     +0.48 +/- 0.72     | +8.68e-04 +/- 1.31e-03 |  1.83e-01 +/- 7.3e-04  |  1.82e-01 +/- 1.1e-03  |

Copy link

codecov bot commented Sep 28, 2024

Codecov Report

Attention: Patch coverage is 88.33333% with 35 lines in your changes missing coverage. Please review.

Project coverage is 95.39%. Comparing base (86376c4) to head (310157a).

Files with missing lines Patch % Lines
desc/compute/_neoclassical.py 80.98% 27 Missing ⚠️
desc/objectives/_neoclassical.py 92.13% 7 Missing ⚠️
desc/plotting.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1229      +/-   ##
==========================================
- Coverage   95.46%   95.39%   -0.08%     
==========================================
  Files          96       98       +2     
  Lines       23733    23983     +250     
==========================================
+ Hits        22657    22878     +221     
- Misses       1076     1105      +29     
Files with missing lines Coverage Δ
desc/compute/__init__.py 100.00% <ø> (ø)
desc/compute/_basis_vectors.py 100.00% <100.00%> (ø)
desc/compute/_core.py 100.00% <100.00%> (ø)
desc/compute/_equil.py 100.00% <ø> (ø)
desc/compute/_field.py 100.00% <100.00%> (ø)
desc/compute/_metric.py 100.00% <ø> (ø)
desc/compute/_omnigenity.py 99.37% <ø> (-0.63%) ⬇️
desc/compute/_profiles.py 99.19% <100.00%> (ø)
desc/compute/_stability.py 100.00% <ø> (ø)
desc/equilibrium/coords.py 88.38% <ø> (ø)
... and 18 more

... and 1 file with indirect coverage changes

@dpanici dpanici changed the base branch from master to Gamma_c October 28, 2024 13:44
name="Gamma_d Velasco",
label=(
# Γ_c = π/(8√2) ∫dλ 〈 ∑ⱼ [v τ γ_c²]ⱼ 〉
"\\Gamma_c = \\frac{\\pi}{8 \\sqrt{2}} "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update math label

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.

4 participants