-
Notifications
You must be signed in to change notification settings - Fork 30
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
Vacuum solver without assuming nested flux surfaces #1360
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1360 +/- ##
==========================================
- Coverage 95.71% 95.71% -0.01%
==========================================
Files 101 102 +1
Lines 26356 26462 +106
==========================================
+ Hits 25227 25328 +101
- Misses 1129 1134 +5
|
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
-test_build_transform_fft_lowres | +12.64 +/- 3.39 | +7.59e-02 +/- 2.04e-02 | 6.77e-01 +/- 1.9e-02 | 6.01e-01 +/- 7.9e-03 |
test_equilibrium_init_medres | +13.47 +/- 14.73 | +5.62e-01 +/- 6.14e-01 | 4.73e+00 +/- 6.1e-01 | 4.17e+00 +/- 3.2e-02 |
test_equilibrium_init_highres | -5.43 +/- 5.41 | -2.99e-01 +/- 2.98e-01 | 5.21e+00 +/- 2.5e-02 | 5.51e+00 +/- 3.0e-01 |
test_objective_compile_dshape_current | -2.06 +/- 5.38 | -8.74e-02 +/- 2.29e-01 | 4.16e+00 +/- 1.3e-01 | 4.25e+00 +/- 1.9e-01 |
test_objective_compute_dshape_current | -0.35 +/- 1.84 | -1.92e-05 +/- 1.00e-04 | 5.41e-03 +/- 6.3e-05 | 5.43e-03 +/- 7.8e-05 |
test_objective_jac_dshape_current | +0.14 +/- 7.26 | +5.90e-05 +/- 3.09e-03 | 4.27e-02 +/- 2.0e-03 | 4.26e-02 +/- 2.3e-03 |
test_perturb_2 | -2.18 +/- 1.77 | -4.53e-01 +/- 3.68e-01 | 2.03e+01 +/- 3.0e-01 | 2.07e+01 +/- 2.1e-01 |
test_proximal_jac_atf_with_eq_update | -1.02 +/- 0.85 | -1.76e-01 +/- 1.47e-01 | 1.71e+01 +/- 1.2e-01 | 1.72e+01 +/- 8.8e-02 |
test_proximal_freeb_jac | +0.46 +/- 1.08 | +2.27e-02 +/- 5.35e-02 | 4.99e+00 +/- 2.6e-02 | 4.97e+00 +/- 4.7e-02 |
test_solve_fixed_iter_compiled | +2.28 +/- 0.95 | +4.76e-01 +/- 1.98e-01 | 2.14e+01 +/- 1.6e-01 | 2.09e+01 +/- 1.2e-01 |
test_LinearConstraintProjection_build | -1.20 +/- 4.19 | -1.35e-01 +/- 4.71e-01 | 1.11e+01 +/- 3.4e-01 | 1.12e+01 +/- 3.2e-01 |
test_objective_compute_ripple_spline | +0.14 +/- 2.50 | +4.89e-04 +/- 8.62e-03 | 3.46e-01 +/- 3.0e-03 | 3.45e-01 +/- 8.1e-03 |
test_objective_grad_ripple_spline | -1.63 +/- 2.16 | -2.32e-02 +/- 3.08e-02 | 1.41e+00 +/- 2.3e-02 | 1.43e+00 +/- 2.1e-02 |
test_build_transform_fft_midres | +4.30 +/- 6.44 | +2.78e-02 +/- 4.16e-02 | 6.73e-01 +/- 3.4e-02 | 6.45e-01 +/- 2.4e-02 |
test_build_transform_fft_highres | +1.25 +/- 6.92 | +1.18e-02 +/- 6.51e-02 | 9.53e-01 +/- 4.9e-02 | 9.41e-01 +/- 4.3e-02 |
test_equilibrium_init_lowres | +0.10 +/- 2.34 | +3.85e-03 +/- 9.25e-02 | 3.95e+00 +/- 7.4e-02 | 3.95e+00 +/- 5.6e-02 |
test_objective_compile_atf | +1.25 +/- 4.62 | +1.03e-01 +/- 3.84e-01 | 8.40e+00 +/- 2.5e-01 | 8.29e+00 +/- 2.9e-01 |
test_objective_compute_atf | +1.24 +/- 4.55 | +2.02e-04 +/- 7.40e-04 | 1.65e-02 +/- 6.9e-04 | 1.63e-02 +/- 2.6e-04 |
test_objective_jac_atf | +2.29 +/- 2.27 | +4.43e-02 +/- 4.38e-02 | 1.98e+00 +/- 3.6e-02 | 1.93e+00 +/- 2.4e-02 |
test_perturb_1 | +0.63 +/- 3.82 | +9.50e-02 +/- 5.73e-01 | 1.51e+01 +/- 1.6e-01 | 1.50e+01 +/- 5.5e-01 |
test_proximal_jac_atf | +1.17 +/- 1.69 | +9.34e-02 +/- 1.35e-01 | 8.08e+00 +/- 1.1e-01 | 7.99e+00 +/- 8.2e-02 |
test_proximal_freeb_compute | +1.29 +/- 1.24 | +2.43e-03 +/- 2.34e-03 | 1.91e-01 +/- 1.8e-03 | 1.88e-01 +/- 1.5e-03 |
test_solve_fixed_iter | +0.85 +/- 1.79 | +2.77e-01 +/- 5.79e-01 | 3.27e+01 +/- 2.4e-01 | 3.24e+01 +/- 5.3e-01 |
test_objective_compute_ripple | +1.00 +/- 2.00 | +6.88e-03 +/- 1.38e-02 | 6.96e-01 +/- 1.1e-02 | 6.90e-01 +/- 8.9e-03 |
test_objective_grad_ripple | +0.19 +/- 0.85 | +4.94e-03 +/- 2.23e-02 | 2.64e+00 +/- 1.1e-02 | 2.63e+00 +/- 1.9e-02 | |
I'll push the simpler method we talked about. Regardless it is not expected for the current method to not satisfy the lcfs condition. Am I missing something in the implementation? If you are available, but would like to be caught up on the code or math let me know. |
desc/integrals/_laplace.py
Outdated
Returns | ||
------- | ||
data : dict | ||
Vacuum field ∇Φ stored in ``data["evl"]["grad(Phi)"]``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you prefer some other api let me know. i was taking care to make these functions pure (recall that is a technical term) so that they play nice with jax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally each method would be a registered compute function, but before I did that we should decide on API. Recall there are 3 grids here.
@@ -97,7 +97,7 @@ Contribute | |||
- `Contributing guidelines <https://github.com/PlasmaControl/DESC/blob/master/CONTRIBUTING.rst>`_ | |||
- `Issue Tracker <https://github.com/PlasmaControl/DESC/issues>`_ | |||
- `Source Code <https://github.com/PlasmaControl/DESC/>`_ | |||
- `Documentation <https://desc-docs.readthedocs.io/>`_ | |||
- `Documentation <https://desc-docs.readthedocs.io/en/latest/>`_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer this to be stable as then it is consistent with our pip package
@@ -805,12 +806,15 @@ def _kernel_1_over_r(eval_data, source_data, diag=False): | |||
def _kernel_nr_over_r3(eval_data, source_data, diag=False): | |||
"""Returns n ⋅ −∇G(x,x') = n ⋅ (x−x')|x−x'|⁻³.""" | |||
dx = _dx(eval_data, source_data, diag) | |||
n = rpz2xyz_vec(source_data["n_rho"], phi=source_data["phi"]) | |||
# Need to use e^rho*sqrt(g) to pass Green's ID test. | |||
# Fourier spectrum is much more concentrated than n_rho for some reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise the w7x one fails, which is interesting because there's many nodes and no truncation.
High order accurate method to find unique vacuum potential such that Bdotn = 0 on last closed flux surface given a field that captures the current distribution. Does not assume nested flux surfaces.