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

Improvements to RegularGridInterpolant3D and C++ documentation #103 #227

Merged
merged 19 commits into from
May 24, 2022

Conversation

florianwechsung
Copy link
Contributor

@florianwechsung florianwechsung commented Apr 28, 2022

  • Introduces some general remarks regarding the C++ part of SIMSOPT in docs/source/cpp.rst
  • Adds the ability to skip some cells in the mesh to the RegularGridInterpolant3D class
  • some clean up of the C++ and some more docs of RegularGridInterpolant3D

This will close #103

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #227 (ee3af97) into master (f90d8f5) will increase coverage by 0.72%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #227      +/-   ##
==========================================
+ Coverage   90.83%   91.55%   +0.72%     
==========================================
  Files          59       62       +3     
  Lines        7733     8577     +844     
==========================================
+ Hits         7024     7853     +829     
- Misses        709      724      +15     
Flag Coverage Δ
unittests 91.55% <100.00%> (+0.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/simsopt/field/magneticfieldclasses.py 97.97% <100.00%> (+0.02%) ⬆️
src/simsopt/geo/surface.py 91.07% <100.00%> (+2.45%) ⬆️
src/simsopt/mhd/vmec.py 92.30% <0.00%> (-0.62%) ⬇️
src/simsopt/util/zoo.py 100.00% <0.00%> (ø)
src/simsopt/mhd/virtual_casing.py 98.80% <0.00%> (ø)
src/simsopt/geo/finitebuild.py 99.34% <0.00%> (ø)
src/simsopt/util/fourier_interpolation.py 100.00% <0.00%> (ø)
src/simsopt/mhd/vmec_diagnostics.py 99.35% <0.00%> (+0.14%) ⬆️
src/simsopt/field/coil.py 99.01% <0.00%> (+1.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f90d8f5...ee3af97. Read the comment docs.

@florianwechsung
Copy link
Contributor Author

florianwechsung commented May 2, 2022

To illustrate the skip function: we previously would have to pick the bounds of the interpolation domain so that the entire domain of interest is contained. This meant that potentially we were querying the field in regions that we're not going to be interested in after all, see e.g. here

image

(note that the field here satisfies stellarator symmetry and 3-fold rotational symmetry).

With the new capability, we can reduce this and skip many cells, as shown here:

image

The effect is particularly large for strongly shaped plasmas.

Note that the strategy employed here is not perfect. Since we only check the skip function at the corners of the mesh, some cells may be skipped that still have some of the relevant domain in it, as is the case in this example for the red cell. (The blue cells are those that not skipped)

image

This can be avoided by defining a skip function that is somewhat pessimistic in which cells are allowed to be skipped. For example, when the skip function is defined by a signed distance function to a surface, then the threshold shouldn't be set at 0, but at some slightly larger/smaller number roughly of size ~meshsize.

@florianwechsung florianwechsung marked this pull request as ready for review May 2, 2022 15:06
@florianwechsung florianwechsung changed the title Improvements to RegularGridInterpolant3D and C++ documentation Improvements to RegularGridInterpolant3D and C++ documentation #103 May 2, 2022
examples/1_Simple/tracing_fieldline.py Outdated Show resolved Hide resolved
src/simsopt/field/magneticfieldclasses.py Show resolved Hide resolved
examples/1_Simple/tracing_fieldline.py Outdated Show resolved Hide resolved
examples/1_Simple/tracing_fieldline.py Show resolved Hide resolved
@florianwechsung
Copy link
Contributor Author

Thank you for your comments @landreman , I addressed them in the latest commit.

@florianwechsung florianwechsung merged commit 5a8c8b4 into master May 24, 2022
@florianwechsung florianwechsung deleted the fw/interpolantv2 branch June 3, 2022 21:50
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.

More granular testing and documentation of RegularGridInterpolant
2 participants