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

Update Toroidal Flux Objective for Finite Beta Equilibria #1159

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dpanici
Copy link
Collaborator

@dpanici dpanici commented Aug 1, 2024

Removes the warnings when a finite beta equilibrium is passed into ToroidalFlux objective, and accounts for the plasma currents as well.

In relation to comment in #1158

With finite beta stage 2 optimization, no objective on toroidal flux or coil curents is needed for the coils to make the correct toroidal flux and field magnitude, assuming that normal field error is zero. With finite normal field error, the coils may not create the necessary fluxes or have the requisite net poloidal linking current for the given equilbrium.

Copy link
Contributor

github-actions bot commented Aug 1, 2024

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +0.60 +/- 6.24     | +3.04e-03 +/- 3.18e-02 |  5.13e-01 +/- 3.1e-02  |  5.10e-01 +/- 8.1e-03  |
 test_build_transform_fft_midres         |     +0.47 +/- 0.95     | +2.78e-03 +/- 5.60e-03 |  5.93e-01 +/- 3.7e-03  |  5.90e-01 +/- 4.2e-03  |
 test_build_transform_fft_highres        |     +0.13 +/- 1.46     | +1.23e-03 +/- 1.43e-02 |  9.81e-01 +/- 1.3e-02  |  9.80e-01 +/- 6.0e-03  |
 test_equilibrium_init_lowres            |     +0.09 +/- 0.23     | +3.33e-03 +/- 8.62e-03 |  3.72e+00 +/- 7.1e-03  |  3.71e+00 +/- 4.9e-03  |
 test_equilibrium_init_medres            |     +0.16 +/- 0.47     | +6.31e-03 +/- 1.88e-02 |  4.03e+00 +/- 1.5e-02  |  4.02e+00 +/- 1.1e-02  |
 test_equilibrium_init_highres           |     +0.23 +/- 0.57     | +1.23e-02 +/- 3.07e-02 |  5.37e+00 +/- 2.3e-02  |  5.36e+00 +/- 2.1e-02  |
 test_objective_compile_dshape_current   |     +0.16 +/- 1.36     | +6.05e-03 +/- 5.15e-02 |  3.78e+00 +/- 4.4e-02  |  3.78e+00 +/- 2.7e-02  |
 test_objective_compile_atf              |     -0.13 +/- 2.07     | -9.86e-03 +/- 1.61e-01 |  7.77e+00 +/- 8.6e-02  |  7.78e+00 +/- 1.4e-01  |
 test_objective_compute_dshape_current   |     +0.31 +/- 1.86     | +1.06e-05 +/- 6.39e-05 |  3.45e-03 +/- 2.5e-05  |  3.44e-03 +/- 5.9e-05  |
 test_objective_compute_atf              |     -0.93 +/- 1.86     | -9.49e-05 +/- 1.90e-04 |  1.01e-02 +/- 8.9e-05  |  1.02e-02 +/- 1.7e-04  |
 test_objective_jac_dshape_current       |     -3.24 +/- 6.90     | -1.30e-03 +/- 2.78e-03 |  3.90e-02 +/- 2.7e-03  |  4.03e-02 +/- 7.9e-04  |
 test_objective_jac_atf                  |     -1.21 +/- 3.18     | -2.34e-02 +/- 6.14e-02 |  1.91e+00 +/- 4.2e-02  |  1.93e+00 +/- 4.5e-02  |
 test_perturb_1                          |     +0.11 +/- 0.74     | +1.27e-02 +/- 8.96e-02 |  1.21e+01 +/- 5.8e-02  |  1.21e+01 +/- 6.9e-02  |
 test_perturb_2                          |     +0.33 +/- 1.08     | +5.59e-02 +/- 1.83e-01 |  1.70e+01 +/- 1.7e-01  |  1.70e+01 +/- 6.6e-02  |
 test_proximal_jac_atf                   |     -0.25 +/- 0.81     | -2.05e-02 +/- 6.62e-02 |  8.16e+00 +/- 4.1e-02  |  8.18e+00 +/- 5.2e-02  |
 test_proximal_freeb_compute             |     +0.95 +/- 0.58     | +1.72e-03 +/- 1.06e-03 |  1.83e-01 +/- 7.9e-04  |  1.81e-01 +/- 7.0e-04  |
 test_proximal_freeb_jac                 |     -0.19 +/- 1.09     | -1.46e-02 +/- 8.17e-02 |  7.48e+00 +/- 5.6e-02  |  7.50e+00 +/- 5.9e-02  |
 test_solve_fixed_iter                   |     +0.11 +/- 61.10    | +5.57e-03 +/- 3.07e+00 |  5.03e+00 +/- 2.2e+00  |  5.03e+00 +/- 2.1e+00  |

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.33%. Comparing base (301a894) to head (5adb036).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1159      +/-   ##
==========================================
- Coverage   95.33%   95.33%   -0.01%     
==========================================
  Files          90       90              
  Lines       22700    22696       -4     
==========================================
- Hits        21641    21637       -4     
  Misses       1059     1059              
Files with missing lines Coverage Δ
desc/objectives/_coils.py 99.13% <ø> (-0.01%) ⬇️

... and 2 files with indirect coverage changes

Copy link
Member

@f0uriest f0uriest left a comment

Choose a reason for hiding this comment

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

Actually, at finite plasma current I think we need to change the compute function to account for the contribution to the flux from the plasma field?

@dpanici
Copy link
Collaborator Author

dpanici commented Aug 1, 2024

Actually, at finite plasma current I think we need to change the compute function to account for the contribution to the flux from the plasma field?

Ah I think you are right, I can add that.

@dpanici dpanici changed the title Remove Warnings in Toroidal Flux Objective Update Toroidal Flux Objective for Finite Beta Equilibria Aug 1, 2024
@f0uriest
Copy link
Member

f0uriest commented Aug 1, 2024

actually im now doubting myself. Can plasma current produce toroidal flux? i thought that wasn't possible (or maybe it just cant produce "enough" flux?)

@dpanici
Copy link
Collaborator Author

dpanici commented Aug 1, 2024

actually im now doubting myself. Can plasma current produce toroidal flux? i thought that wasn't possible (or maybe it just cant produce "enough" flux?)

Any poloidally circulating current in the plasma would produce a toroidal flux right? so I think you're right in that for finite beta this is something that should be taken into account for this objective.

I am imagining simplest case of a theta-pinch, the currents flow in the theta direction and the toroidal (Z-directed at least) flux enclosed by the bdry certainly has a contribution from those poloidal currents

@dpanici
Copy link
Collaborator Author

dpanici commented Aug 1, 2024

Actually the poloidal currents wouuld be the diamagnetic currents right? so if anything they would reduce the toroidal flux... this is something I have not thought about the subtleties of, nor have I seen it in any papers on finite beta coil stuff

@dpanici
Copy link
Collaborator Author

dpanici commented Aug 1, 2024

This is actually a a bit trickier to include this contribution since the singular integration stuff assumes you want quantities on the surface over theta and zeta, but in this objective we only need B at a single zeta plane... I was wrong here, but A is still better to use IMO so I will implement that way

I think we should use the A computation instead from the eq as then at least we only do the wasteful calc once at the surface and then we can do the loop integral.

Not completely sure how to implement, need to think if A_fixed_bdry/2 needs to be added at the surface like with the B calc in virtual casing, and if so how to get the A equivalent of the fixed bdry B is not obvious to me

@dpanici dpanici marked this pull request as draft August 7, 2024 19:34
@dpanici
Copy link
Collaborator Author

dpanici commented Aug 14, 2024

@dpanici check Helander 2014 for this

@dpanici dpanici added the low priority Nice to have, but not needed right away label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority Nice to have, but not needed right away
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants