Skip to content

Comments

ion density profile#2090

Draft
ddudt wants to merge 6 commits intomasterfrom
dd/ion_density
Draft

ion density profile#2090
ddudt wants to merge 6 commits intomasterfrom
dd/ion_density

Conversation

@ddudt
Copy link
Collaborator

@ddudt ddudt commented Feb 17, 2026

Resolves #2069 by adding an optional ion_density profile to the Equilibrium class. If the profile is not supplied, it defaults to the previous assumption of $n_i = n_e / Z_{eff}$ for backwards compatibility.

@ddudt ddudt self-assigned this Feb 17, 2026
@ddudt ddudt added interface New feature or request to make the code more usable or compatibility with another code enhancement General label for enhancement. Please also tag with "Speed", "Interface", "Functionality", etc easy Short and simple to code or review labels Feb 17, 2026
@ddudt
Copy link
Collaborator Author

ddudt commented Feb 17, 2026

I ran a test case comparing the old assumption to using the "correct" profiles. The difference is small, but I still think this PR is beneficial to give users more flexibility in prescribing accurate profiles.

Details:
I have profile data for each ion and impurity species (which obeys quasi-neutrality). In the old code, I had to assume $Z_{eff}\approx1$ to get the correct ion density. In the new code, I can set the ion density directly and use the correct atomic number profile of $Z_{eff}\approx1.2$. The only difference between the two cases is the Zeff profile. This plot shows the final bootstrap current profile, after optimizing for self-consistency. The differences in other equilibrium quantities are also negligible.
image

* elementary_charge
* (ne * Te + ni * Ti)
* L31
* (d_ne_d_s / ne)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm confused why there is no d_ni_d_s term related to $\partial_\rho n_i$ in our bootstrap computations. When comparing this dnds_term to equation A1 from Landreman et al., it looks like we are assuming that $\frac{d \ln n_e}{d \psi_t} = \frac{d \ln n_i}{d \psi_t}$?

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Memory benchmark result

|               Test Name                |      %Δ      |    Master (MB)     |      PR (MB)       |    Δ (MB)    |    Time PR (s)     |  Time Master (s)   |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
  test_objective_jac_w7x                 |    2.97 %    |     3.822e+03      |     3.935e+03      |    113.34    |       40.36        |       37.04        |
  test_proximal_jac_w7x_with_eq_update   |   -0.82 %    |     6.511e+03      |     6.458e+03      |    -53.13    |       164.94       |       164.64       |
  test_proximal_freeb_jac                |    0.25 %    |     1.321e+04      |     1.324e+04      |    33.61     |       88.85        |       85.72        |
  test_proximal_freeb_jac_blocked        |    0.66 %    |     7.492e+03      |     7.541e+03      |    49.25     |       75.39        |       74.79        |
  test_proximal_freeb_jac_batched        |   -0.38 %    |     7.531e+03      |     7.502e+03      |    -28.49    |       74.79        |       74.70        |
  test_proximal_jac_ripple               |   -3.73 %    |     3.592e+03      |     3.458e+03      |   -133.83    |       66.58        |       66.88        |
  test_proximal_jac_ripple_bounce1d      |   -0.06 %    |     3.566e+03      |     3.564e+03      |    -2.02     |       77.63        |       78.53        |
  test_eq_solve                          |   -5.52 %    |     2.059e+03      |     1.945e+03      |   -113.76    |       95.33        |       95.34        |

For the memory plots, go to the summary of Memory Benchmarks workflow and download the artifact.

@ddudt
Copy link
Collaborator Author

ddudt commented Feb 19, 2026

Remember to update this PR with the changes from #2046

@dpanici
Copy link
Collaborator

dpanici commented Feb 20, 2026

I ran a test case comparing the old assumption to using the "correct" profiles. The difference is small, but I still think this PR is beneficial to give users more flexibility in prescribing accurate profiles.

Details: I have profile data for each ion and impurity species (which obeys quasi-neutrality). In the old code, I had to assume Z e f f ≈ 1 to get the correct ion density. In the new code, I can set the ion density directly and use the correct atomic number profile of Z e f f ≈ 1.2 . The only difference between the two cases is the Zeff profile. This plot shows the final bootstrap current profile, after optimizing for self-consistency. The differences in other equilibrium quantities are also negligible. image

How would these compare to say SFINCS for the "correct" profiles?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

easy Short and simple to code or review enhancement General label for enhancement. Please also tag with "Speed", "Interface", "Functionality", etc interface New feature or request to make the code more usable or compatibility with another code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

atomic number vs ion density

3 participants