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 4 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 +/- 7.72     | -3.22e-03 +/- 4.14e-02 |  5.32e-01 +/- 3.3e-02  |  5.36e-01 +/- 2.5e-02  |
 test_build_transform_fft_midres         |     -1.17 +/- 5.38     | -7.28e-03 +/- 3.36e-02 |  6.18e-01 +/- 2.2e-02  |  6.25e-01 +/- 2.5e-02  |
 test_build_transform_fft_highres        |     +0.51 +/- 5.00     | +5.16e-03 +/- 5.09e-02 |  1.02e+00 +/- 3.2e-02  |  1.02e+00 +/- 3.9e-02  |
 test_equilibrium_init_lowres            |     +0.10 +/- 5.95     | +4.08e-03 +/- 2.32e-01 |  3.90e+00 +/- 1.4e-01  |  3.89e+00 +/- 1.8e-01  |
 test_equilibrium_init_medres            |     +1.27 +/- 6.64     | +5.68e-02 +/- 2.96e-01 |  4.52e+00 +/- 2.3e-01  |  4.46e+00 +/- 1.8e-01  |
 test_equilibrium_init_highres           |     -0.68 +/- 4.88     | -3.95e-02 +/- 2.82e-01 |  5.73e+00 +/- 1.3e-01  |  5.77e+00 +/- 2.5e-01  |
 test_objective_compile_dshape_current   |     -0.95 +/- 1.75     | -3.72e-02 +/- 6.85e-02 |  3.87e+00 +/- 5.4e-02  |  3.91e+00 +/- 4.2e-02  |
 test_objective_compile_atf              |     -0.93 +/- 1.63     | -7.82e-02 +/- 1.37e-01 |  8.34e+00 +/- 7.0e-02  |  8.42e+00 +/- 1.2e-01  |
 test_objective_compute_dshape_current   |     +1.38 +/- 3.61     | +1.75e-05 +/- 4.56e-05 |  1.28e-03 +/- 3.4e-05  |  1.26e-03 +/- 3.1e-05  |
 test_objective_compute_atf              |     -3.18 +/- 6.50     | -1.43e-04 +/- 2.92e-04 |  4.36e-03 +/- 1.4e-04  |  4.50e-03 +/- 2.6e-04  |
 test_objective_jac_dshape_current       |     -5.40 +/- 9.55     | -2.07e-03 +/- 3.66e-03 |  3.62e-02 +/- 2.3e-03  |  3.83e-02 +/- 2.8e-03  |
 test_objective_jac_atf                  |     -0.60 +/- 3.81     | -1.16e-02 +/- 7.33e-02 |  1.91e+00 +/- 3.8e-02  |  1.92e+00 +/- 6.3e-02  |
 test_perturb_1                          |     +1.99 +/- 3.37     | +2.78e-01 +/- 4.71e-01 |  1.43e+01 +/- 1.3e-01  |  1.40e+01 +/- 4.5e-01  |
 test_perturb_2                          |     +0.62 +/- 5.03     | +1.18e-01 +/- 9.58e-01 |  1.92e+01 +/- 8.8e-01  |  1.90e+01 +/- 3.8e-01  |
 test_proximal_jac_atf                   |     -0.39 +/- 0.78     | -3.14e-02 +/- 6.28e-02 |  8.07e+00 +/- 6.0e-02  |  8.10e+00 +/- 2.0e-02  |
 test_proximal_freeb_compute             |     -0.57 +/- 0.86     | -1.03e-03 +/- 1.55e-03 |  1.79e-01 +/- 1.1e-03  |  1.80e-01 +/- 1.1e-03  |
 test_proximal_freeb_jac                 |     -0.16 +/- 1.45     | -1.21e-02 +/- 1.07e-01 |  7.37e+00 +/- 9.5e-02  |  7.38e+00 +/- 5.0e-02  |
 test_solve_fixed_iter                   |     -0.18 +/- 12.42    | -3.30e-02 +/- 2.27e+00 |  1.82e+01 +/- 1.6e+00  |  1.83e+01 +/- 1.6e+00  |

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.43%. Comparing base (13108f6) to head (cd20168).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1159      +/-   ##
==========================================
- Coverage   95.43%   95.43%   -0.01%     
==========================================
  Files          87       87              
  Lines       22313    22309       -4     
==========================================
- Hits        21294    21290       -4     
  Misses       1019     1019              
Files Coverage Δ
desc/objectives/_coils.py 99.13% <ø> (-0.01%) ⬇️

... and 1 file 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.

None yet

2 participants