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

VMEC wout fixes #925

Merged
merged 13 commits into from
Mar 8, 2024
Merged

VMEC wout fixes #925

merged 13 commits into from
Mar 8, 2024

Conversation

ddudt
Copy link
Collaborator

@ddudt ddudt commented Mar 6, 2024

  1. Resolves Sign difference in buco when writing a vmec input file vs writing a vmec wout file #915 by flipping the sign of buco
  2. Also flips the sign of jcuru (same issue as above)
  3. Adds the quantity vp, which is dV/ds / 4pi^2 as documented here
  4. Adds the quantity nextcur for the number of coils, which is hard-coded to 0 for fixed-boundary solutions
  5. Refactors some of the scalar computations to make it more efficient and save compute time

VMECIO.save assumes the equilibrium was a fixed-boundary solution (we hard-code some outputs to their fixed-boundary values). But now that we have free-boundary working we could think about accommodating those free-boundary values (in a future PR). I think we would need to pass in the MagneticField that was used in addition to the Equilibrium.

@ddudt ddudt added the EZ-review label Mar 6, 2024
Copy link

codecov bot commented Mar 6, 2024

Codecov Report

Attention: Patch coverage is 99.17355% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.95%. Comparing base (0d72aa0) to head (af35c49).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #925      +/-   ##
==========================================
- Coverage   94.96%   94.95%   -0.01%     
==========================================
  Files          83       83              
  Lines       21005    21006       +1     
==========================================
  Hits        19947    19947              
- Misses       1058     1059       +1     
Files Coverage Δ
desc/magnetic_fields.py 96.91% <100.00%> (ø)
desc/vmec.py 92.21% <99.16%> (-0.10%) ⬇️

Copy link
Contributor

github-actions bot commented Mar 6, 2024

|             benchmark_name             |         dt(%)          |         dt(s)          |        t_new(s)        |        t_old(s)        | 
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
 test_build_transform_fft_lowres         |     +2.36 +/- 13.09    | +2.17e-04 +/- 1.21e-03 |  9.44e-03 +/- 1.2e-03  |  9.22e-03 +/- 6.3e-05  |
 test_build_transform_fft_midres         |     -1.86 +/- 1.82     | -1.67e-03 +/- 1.64e-03 |  8.84e-02 +/- 1.1e-03  |  9.01e-02 +/- 1.2e-03  |
 test_build_transform_fft_highres        |     -0.62 +/- 1.08     | -2.88e-03 +/- 5.04e-03 |  4.62e-01 +/- 3.5e-03  |  4.65e-01 +/- 3.6e-03  |
 test_equilibrium_init_lowres            |     -0.08 +/- 2.71     | -2.23e-04 +/- 7.35e-03 |  2.71e-01 +/- 4.7e-03  |  2.72e-01 +/- 5.6e-03  |
 test_equilibrium_init_medres            |     -2.50 +/- 1.98     | -1.59e-02 +/- 1.25e-02 |  6.18e-01 +/- 7.7e-03  |  6.34e-01 +/- 9.9e-03  |
 test_equilibrium_init_highres           |     -0.63 +/- 1.76     | -1.41e-02 +/- 3.97e-02 |  2.24e+00 +/- 2.7e-02  |  2.25e+00 +/- 2.9e-02  |
 test_objective_compile_dshape_current   |     -1.44 +/- 9.73     | -5.93e-02 +/- 4.00e-01 |  4.05e+00 +/- 2.7e-01  |  4.11e+00 +/- 2.9e-01  |
 test_objective_compile_atf              |     +0.41 +/- 6.07     | +3.41e-02 +/- 5.00e-01 |  8.27e+00 +/- 3.1e-01  |  8.24e+00 +/- 3.9e-01  |
 test_objective_compute_dshape_current   |     -1.18 +/- 4.00     | -6.32e-05 +/- 2.15e-04 |  5.31e-03 +/- 1.4e-04  |  5.38e-03 +/- 1.6e-04  |
 test_objective_compute_atf              |     -0.23 +/- 6.29     | -2.85e-05 +/- 7.65e-04 |  1.21e-02 +/- 5.2e-04  |  1.22e-02 +/- 5.6e-04  |
 test_objective_jac_dshape_current       |     +3.10 +/- 8.33     | +1.46e-03 +/- 3.92e-03 |  4.86e-02 +/- 2.8e-03  |  4.71e-02 +/- 2.8e-03  |
 test_objective_jac_atf                  |     -0.39 +/- 4.59     | -9.28e-03 +/- 1.11e-01 |  2.40e+00 +/- 7.7e-02  |  2.41e+00 +/- 8.0e-02  |
 test_perturb_1                          |     +3.72 +/- 4.29     | +5.87e-01 +/- 6.76e-01 |  1.64e+01 +/- 4.8e-01  |  1.58e+01 +/- 4.8e-01  |
 test_perturb_2                          |     +1.92 +/- 4.30     | +4.12e-01 +/- 9.24e-01 |  2.19e+01 +/- 3.0e-01  |  2.15e+01 +/- 8.7e-01  |
 test_proximal_jac_atf                   |     +0.71 +/- 1.98     | +5.34e-02 +/- 1.49e-01 |  7.62e+00 +/- 1.3e-01  |  7.57e+00 +/- 7.3e-02  |
 test_proximal_freeb_compute             |     +0.08 +/- 1.27     | +1.09e-04 +/- 1.63e-03 |  1.28e-01 +/- 1.2e-03  |  1.28e-01 +/- 1.1e-03  |
 test_proximal_freeb_jac                 |     -2.26 +/- 1.02     | -1.70e-01 +/- 7.68e-02 |  7.34e+00 +/- 5.1e-02  |  7.51e+00 +/- 5.7e-02  |

@ddudt ddudt marked this pull request as ready for review March 6, 2024 18:31
@ddudt ddudt requested review from f0uriest and dpanici March 6, 2024 18:31
dpanici
dpanici previously approved these changes Mar 6, 2024
desc/vmec.py Outdated Show resolved Hide resolved
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.

See comment about combining duplicate calculations on half/full grid

@ddudt ddudt requested review from f0uriest and dpanici March 7, 2024 00:12
f0uriest
f0uriest previously approved these changes Mar 7, 2024
desc/vmec.py Outdated
if verbose > 0:
print("Computing data")

# desc throws NaN for r == 0, so we use something small to approximate it
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought that we have axis limits implemented for most things?

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 think this was left over from before we implemented the axis limits. Updated now, thanks.

@f0uriest f0uriest merged commit baafa60 into master Mar 8, 2024
17 checks passed
@f0uriest f0uriest deleted the dd/vmec branch March 8, 2024 03:07
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.

Sign difference in buco when writing a vmec input file vs writing a vmec wout file
4 participants