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

Add qfm surface functionality #1264

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Add qfm surface functionality #1264

wants to merge 12 commits into from

Conversation

dpanici
Copy link
Collaborator

@dpanici dpanici commented Sep 24, 2024

Resolve #1162

  • add tutorial for this
  • allow ToroidalFlux to accept FourierRZToroidalSurface so that we can specify the toroidal flux through the QFM (we can do the vector potential method on the surface just fine so this should be easy, and there is no plasma current to consider either)

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.44%. Comparing base (1e4147d) to head (4268ec2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1264      +/-   ##
==========================================
- Coverage   95.44%   95.44%   -0.01%     
==========================================
  Files          95       95              
  Lines       23423    23437      +14     
==========================================
+ Hits        22357    22369      +12     
- Misses       1066     1068       +2     
Files with missing lines Coverage Δ
desc/objectives/_coils.py 99.20% <100.00%> (+0.03%) ⬆️

... and 2 files with indirect coverage changes

Copy link
Contributor

github-actions bot commented Sep 24, 2024

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_midres         |     -9.93 +/- 4.36     | -6.57e-02 +/- 2.88e-02 |  5.96e-01 +/- 2.7e-02  |  6.62e-01 +/- 1.1e-02  |
 test_build_transform_fft_highres        |     -3.26 +/- 4.25     | -3.42e-02 +/- 4.45e-02 |  1.01e+00 +/- 3.7e-02  |  1.05e+00 +/- 2.5e-02  |
 test_equilibrium_init_lowres            |     +4.35 +/- 6.40     | +1.64e-01 +/- 2.41e-01 |  3.94e+00 +/- 1.7e-01  |  3.77e+00 +/- 1.7e-01  |
 test_objective_compile_atf              |     -1.05 +/- 4.01     | -8.10e-02 +/- 3.11e-01 |  7.66e+00 +/- 2.4e-01  |  7.74e+00 +/- 2.0e-01  |
 test_objective_compute_atf              |     -0.24 +/- 2.41     | -2.53e-05 +/- 2.55e-04 |  1.05e-02 +/- 1.5e-04  |  1.06e-02 +/- 2.0e-04  |
 test_objective_jac_atf                  |     +3.98 +/- 3.39     | +7.39e-02 +/- 6.30e-02 |  1.93e+00 +/- 4.2e-02  |  1.86e+00 +/- 4.7e-02  |
 test_perturb_1                          |     +4.93 +/- 2.98     | +6.06e-01 +/- 3.67e-01 |  1.29e+01 +/- 3.0e-01  |  1.23e+01 +/- 2.2e-01  |
 test_proximal_jac_atf                   |     +1.62 +/- 1.12     | +1.31e-01 +/- 9.08e-02 |  8.23e+00 +/- 7.2e-02  |  8.10e+00 +/- 5.5e-02  |
-test_proximal_freeb_compute             |     +3.79 +/- 1.09     | +6.90e-03 +/- 1.97e-03 |  1.89e-01 +/- 1.1e-03  |  1.82e-01 +/- 1.6e-03  |
 test_build_transform_fft_lowres         |     +0.26 +/- 6.85     | +1.43e-03 +/- 3.78e-02 |  5.53e-01 +/- 2.9e-02  |  5.52e-01 +/- 2.4e-02  |
 test_equilibrium_init_medres            |     +0.44 +/- 2.72     | +1.92e-02 +/- 1.17e-01 |  4.33e+00 +/- 8.2e-02  |  4.31e+00 +/- 8.4e-02  |
 test_equilibrium_init_highres           |     +0.20 +/- 1.49     | +1.10e-02 +/- 8.42e-02 |  5.66e+00 +/- 6.2e-02  |  5.65e+00 +/- 5.6e-02  |
 test_objective_compile_dshape_current   |     +0.39 +/- 1.22     | +1.53e-02 +/- 4.80e-02 |  3.93e+00 +/- 4.0e-02  |  3.92e+00 +/- 2.6e-02  |
 test_objective_compute_dshape_current   |     +0.29 +/- 2.08     | +1.05e-05 +/- 7.53e-05 |  3.63e-03 +/- 5.5e-05  |  3.62e-03 +/- 5.1e-05  |
 test_objective_jac_dshape_current       |     +2.13 +/- 6.81     | +8.69e-04 +/- 2.77e-03 |  4.16e-02 +/- 1.4e-03  |  4.07e-02 +/- 2.4e-03  |
 test_perturb_2                          |     -0.30 +/- 1.39     | -5.38e-02 +/- 2.53e-01 |  1.82e+01 +/- 1.9e-01  |  1.82e+01 +/- 1.7e-01  |
 test_proximal_freeb_jac                 |     +1.18 +/- 1.89     | +8.89e-02 +/- 1.42e-01 |  7.62e+00 +/- 1.2e-01  |  7.53e+00 +/- 7.9e-02  |
 test_solve_fixed_iter                   |     -1.44 +/- 59.07    | -7.41e-02 +/- 3.03e+00 |  5.06e+00 +/- 2.1e+00  |  5.13e+00 +/- 2.2e+00  |

Equilibrium upon whose surface the normal field error will be minimized.
The equilibrium is kept fixed during the optimization with this objective.
eq : Equilibrium or FourierRZToroidalSurface
Equilibrium (or QFM surface) upon whose surface the normal field error
Copy link
Member

Choose a reason for hiding this comment

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

should maybe add a note to use BoundaryError or VacuumBoundaryError for free boundary / single stage optimization

self._vacuum = vacuum or qfm_surface
self._qfm_surface = qfm_surface
errorif(
qfm_surface and hasattr(eq, "L_lmn"),
Copy link
Member

Choose a reason for hiding this comment

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

would prefer an actual instance check here instead of relying on attributes to be/not be there

desc/objectives/_coils.py Outdated Show resolved Hide resolved
desc/objectives/_coils.py Outdated Show resolved Hide resolved
desc/objectives/_coils.py Outdated Show resolved Hide resolved
desc/objectives/_coils.py Outdated Show resolved Hide resolved
@dpanici
Copy link
Collaborator Author

dpanici commented Sep 25, 2024

make a new objective for this specifically

@dpanici
Copy link
Collaborator Author

dpanici commented Oct 16, 2024

update if #1205 is merged first

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.

Quadratic flux minimizing surfaces
2 participants