-
Notifications
You must be signed in to change notification settings - Fork 53
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
Enable open upper limits for the grids in interpolation code #440
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -862,10 +862,14 @@ def __init__(self, field, degree, rrange, phirange, zrange, extrapolate=True, nf | |
Args: | ||
field: the underlying :mod:`simsopt.field.magneticfield.MagneticField` to be interpolated. | ||
degree: the degree of the piecewise polynomial interpolant. | ||
rrange: a 3-tuple of the form ``(rmin, rmax, nr)``. This mean that the interval :math:`[rmin, rmax]` is | ||
split into ``nr`` many subintervals. | ||
phirange: a 3-tuple of the form ``(phimin, phimax, nphi)``. | ||
zrange: a 3-tuple of the form ``(zmin, zmax, nz)``. | ||
rrange: a 3-tuple of the form ``(rmin, rmax, nr)`` or a 4-tuple of the form ``(rmin, rmax, nr, include_endpoint)``. | ||
The default for `include_endpoint` is True. This mean that the interval :math:`[rmin, rmax]` is | ||
split into ``nr`` many subintervals. When `include_endpoint` is False, interval :math:`[rmin, rmax)` is | ||
split into ``nr`` many subintervals. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does it mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To concretize this, lets suppose you want 5 points between 0 and 1. If you include the end point, the mesh would [0, 0.25, 0.5, 0.75, 1]. If you don't want to include the end point, the mesh generated would be [0, 0.2, 0.4, 0.6, 0.8]. So the mesh would be quite different. Unfortunately, BMW generates phi grid with end point not included. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But then what happens on the small subinterval (2pi/nfp - h, 2pi/nfp)? I guess the behavior would be dictated by the Since the BMW field is nfp-periodic, you can just rotate the B-field values from B(R, phi=0, Z) to B(R, phi=2pi/nfp, Z) and obtain the endpoint value. |
||
phirange: a 3-tuple of the form ``(phimin, phimax, nphi)`` or a 4-tuple of the form | ||
``(phimin, phimax, nphi, include_endpoint)``. | ||
zrange: a 3-tuple of the form ``(zmin, zmax, nz)`` or a 4-tuple of the form | ||
``(zmin, zmax, nz, include_endpoint)``. | ||
extrapolate: whether to extrapolate the field when evaluate outside | ||
the integration domain or to throw an error. | ||
nfp: Whether to exploit rotational symmetry. In this case any angle | ||
|
@@ -900,7 +904,7 @@ def skip(xs, ys, zs): | |
return [False for _ in xs] | ||
|
||
sopp.InterpolatedField.__init__(self, field, degree, rrange, phirange, zrange, extrapolate, nfp, stellsym, skip) | ||
self.__field = field | ||
self._field = field | ||
|
||
def to_vtk(self, filename): | ||
"""Export the field evaluated on a regular grid for visualisation with e.g. Paraview.""" | ||
|
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.
typo, this
means