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 flag to PlasmaVesselDistance to avoid recomputing surface coordinates when the surface is fixed during optimization #746

Merged
merged 6 commits into from
Nov 15, 2023

Conversation

dpanici
Copy link
Collaborator

@dpanici dpanici commented Nov 13, 2023

  • Adds new keyword surface_fixed to PlasmaVesselDistance which says whether or not the surface comparing the distance from the plasma to is fixed or not. If True, then the surface coordinates can be precomputed, saving on computation during optimization. Set to False by default.

Copy link
Contributor

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +0.94 +/- 3.37     | +1.45e-04 +/- 5.21e-04 |  1.56e-02 +/- 4.2e-04  |  1.55e-02 +/- 3.1e-04  |
 test_build_transform_fft_midres         |     +1.28 +/- 0.98     | +1.22e-03 +/- 9.31e-04 |  9.63e-02 +/- 6.6e-04  |  9.50e-02 +/- 6.6e-04  |
 test_build_transform_fft_highres        |     +0.28 +/- 1.00     | +1.32e-03 +/- 4.64e-03 |  4.66e-01 +/- 3.7e-03  |  4.65e-01 +/- 2.9e-03  |
 test_equilibrium_init_lowres            |     +0.90 +/- 1.15     | +5.91e-03 +/- 7.57e-03 |  6.64e-01 +/- 6.3e-03  |  6.58e-01 +/- 4.2e-03  |
 test_equilibrium_init_medres            |     +0.63 +/- 1.16     | +6.33e-03 +/- 1.17e-02 |  1.01e+00 +/- 7.1e-03  |  1.01e+00 +/- 9.2e-03  |
 test_equilibrium_init_highres           |     -0.48 +/- 0.71     | -1.24e-02 +/- 1.83e-02 |  2.56e+00 +/- 1.3e-02  |  2.58e+00 +/- 1.3e-02  |
 test_objective_compile_dshape_current   |     -1.28 +/- 5.22     | -5.47e-02 +/- 2.23e-01 |  4.21e+00 +/- 1.9e-01  |  4.26e+00 +/- 1.2e-01  |
 test_objective_compile_atf              |     -1.76 +/- 5.68     | -1.67e-01 +/- 5.38e-01 |  9.30e+00 +/- 5.0e-01  |  9.46e+00 +/- 2.1e-01  |
 test_objective_compute_dshape_current   |     -2.05 +/- 4.42     | -4.56e-05 +/- 9.83e-05 |  2.18e-03 +/- 3.3e-05  |  2.23e-03 +/- 9.3e-05  |
 test_objective_compute_atf              |     +1.16 +/- 3.29     | +8.97e-05 +/- 2.55e-04 |  7.85e-03 +/- 1.3e-04  |  7.76e-03 +/- 2.2e-04  |
 test_objective_jac_dshape_current       |     -5.65 +/- 14.76    | -2.72e-03 +/- 7.12e-03 |  4.55e-02 +/- 2.8e-03  |  4.82e-02 +/- 6.5e-03  |
 test_objective_jac_atf                  |     +1.99 +/- 5.80     | +4.43e-02 +/- 1.29e-01 |  2.27e+00 +/- 8.2e-02  |  2.23e+00 +/- 1.0e-01  |
 test_perturb_1                          |     -0.21 +/- 13.71    | -1.85e-02 +/- 1.20e+00 |  8.74e+00 +/- 8.6e-01  |  8.76e+00 +/- 8.4e-01  |
 test_perturb_2                          |     +0.87 +/- 3.59     | +1.27e-01 +/- 5.21e-01 |  1.46e+01 +/- 3.8e-01  |  1.45e+01 +/- 3.5e-01  |

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #746 (3c88fd4) into master (1eaea86) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #746   +/-   ##
=======================================
  Coverage   94.94%   94.94%           
=======================================
  Files          80       80           
  Lines       19399    19405    +6     
=======================================
+ Hits        18418    18424    +6     
  Misses        981      981           
Files Coverage Δ
desc/objectives/_geometry.py 97.78% <100.00%> (+0.04%) ⬆️

@f0uriest
Copy link
Member

I think it would be safer to assume the surface isn't fixed, this is also in line with the rest of the objective stuff which assumes things are free unless explicitly constrained

Copy link
Contributor

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +1.66 +/- 3.62     | +2.59e-04 +/- 5.66e-04 |  1.59e-02 +/- 5.4e-04  |  1.56e-02 +/- 1.7e-04  |
 test_build_transform_fft_midres         |     +1.27 +/- 1.12     | +1.20e-03 +/- 1.06e-03 |  9.58e-02 +/- 6.6e-04  |  9.46e-02 +/- 8.3e-04  |
 test_build_transform_fft_highres        |     +0.47 +/- 0.91     | +2.21e-03 +/- 4.27e-03 |  4.69e-01 +/- 3.6e-03  |  4.67e-01 +/- 2.3e-03  |
 test_equilibrium_init_lowres            |     +2.64 +/- 2.54     | +1.76e-02 +/- 1.69e-02 |  6.81e-01 +/- 1.3e-02  |  6.64e-01 +/- 1.1e-02  |
 test_equilibrium_init_medres            |     +0.26 +/- 1.13     | +2.60e-03 +/- 1.14e-02 |  1.01e+00 +/- 8.3e-03  |  1.01e+00 +/- 7.8e-03  |
 test_equilibrium_init_highres           |     +0.28 +/- 0.93     | +7.11e-03 +/- 2.39e-02 |  2.59e+00 +/- 1.7e-02  |  2.58e+00 +/- 1.7e-02  |
 test_objective_compile_dshape_current   |     +1.50 +/- 7.19     | +6.28e-02 +/- 3.00e-01 |  4.23e+00 +/- 2.0e-01  |  4.17e+00 +/- 2.3e-01  |
 test_objective_compile_atf              |     +1.15 +/- 5.13     | +1.07e-01 +/- 4.77e-01 |  9.41e+00 +/- 3.9e-01  |  9.30e+00 +/- 2.8e-01  |
 test_objective_compute_dshape_current   |     +2.72 +/- 3.37     | +5.97e-05 +/- 7.38e-05 |  2.25e-03 +/- 5.9e-05  |  2.19e-03 +/- 4.4e-05  |
 test_objective_compute_atf              |     -4.82 +/- 3.96     | -3.98e-04 +/- 3.27e-04 |  7.86e-03 +/- 2.0e-04  |  8.26e-03 +/- 2.6e-04  |
 test_objective_jac_dshape_current       |     -2.27 +/- 8.34     | -1.07e-03 +/- 3.91e-03 |  4.58e-02 +/- 2.4e-03  |  4.68e-02 +/- 3.1e-03  |
 test_objective_jac_atf                  |     -1.11 +/- 6.63     | -2.56e-02 +/- 1.53e-01 |  2.27e+00 +/- 6.3e-02  |  2.30e+00 +/- 1.4e-01  |
 test_perturb_1                          |     +0.89 +/- 14.01    | +7.75e-02 +/- 1.21e+00 |  8.75e+00 +/- 8.7e-01  |  8.67e+00 +/- 8.5e-01  |
 test_perturb_2                          |     +1.41 +/- 6.29     | +2.04e-01 +/- 9.06e-01 |  1.46e+01 +/- 6.4e-01  |  1.44e+01 +/- 6.4e-01  |

@dpanici dpanici requested review from f0uriest and removed request for f0uriest and daniel-dudt November 14, 2023 20:57
Copy link
Contributor

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +0.49 +/- 2.04     | +8.85e-05 +/- 3.71e-04 |  1.83e-02 +/- 3.1e-04  |  1.82e-02 +/- 2.0e-04  |
 test_build_transform_fft_midres         |     -0.02 +/- 0.77     | -2.11e-05 +/- 8.66e-04 |  1.12e-01 +/- 4.9e-04  |  1.12e-01 +/- 7.2e-04  |
 test_build_transform_fft_highres        |     +1.39 +/- 0.72     | +7.29e-03 +/- 3.80e-03 |  5.33e-01 +/- 3.4e-03  |  5.26e-01 +/- 1.6e-03  |
 test_equilibrium_init_lowres            |     -0.78 +/- 1.11     | -7.42e-03 +/- 1.05e-02 |  9.42e-01 +/- 7.6e-03  |  9.49e-01 +/- 7.3e-03  |
 test_equilibrium_init_medres            |     -0.44 +/- 0.91     | -7.40e-03 +/- 1.54e-02 |  1.68e+00 +/- 9.8e-03  |  1.69e+00 +/- 1.2e-02  |
 test_equilibrium_init_highres           |     -0.04 +/- 0.93     | -1.74e-03 +/- 4.59e-02 |  4.93e+00 +/- 3.7e-02  |  4.93e+00 +/- 2.8e-02  |
 test_objective_compile_dshape_current   |     -0.49 +/- 5.88     | -2.48e-02 +/- 2.95e-01 |  5.00e+00 +/- 2.0e-01  |  5.02e+00 +/- 2.1e-01  |
 test_objective_compile_atf              |     +2.12 +/- 3.44     | +2.99e-01 +/- 4.86e-01 |  1.44e+01 +/- 2.6e-01  |  1.41e+01 +/- 4.1e-01  |
 test_objective_compute_dshape_current   |     -1.70 +/- 2.02     | -5.35e-05 +/- 6.36e-05 |  3.10e-03 +/- 4.7e-05  |  3.15e-03 +/- 4.3e-05  |
 test_objective_compute_atf              |     +0.44 +/- 1.73     | +4.80e-05 +/- 1.88e-04 |  1.09e-02 +/- 3.1e-05  |  1.09e-02 +/- 1.9e-04  |
 test_objective_jac_dshape_current       |     -1.25 +/- 6.85     | -1.68e-03 +/- 9.25e-03 |  1.33e-01 +/- 6.5e-03  |  1.35e-01 +/- 6.6e-03  |
 test_objective_jac_atf                  |     +0.43 +/- 3.03     | +2.56e-02 +/- 1.82e-01 |  6.02e+00 +/- 1.5e-01  |  6.00e+00 +/- 1.0e-01  |
 test_perturb_1                          |     +0.83 +/- 10.83    | +8.42e-02 +/- 1.10e+00 |  1.03e+01 +/- 7.0e-01  |  1.02e+01 +/- 8.5e-01  |
 test_perturb_2                          |     +0.05 +/- 3.57     | +8.30e-03 +/- 6.22e-01 |  1.74e+01 +/- 2.7e-01  |  1.74e+01 +/- 5.6e-01  |

@dpanici dpanici merged commit 7eb4e44 into master Nov 15, 2023
17 checks passed
@dpanici dpanici deleted the dp/plasma-vessel-distance-fixed-surface branch November 15, 2023 17:03
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.

2 participants