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

Fixes zoidberg #3054

Merged
merged 9 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Jinja2~=3.1.4
numpy~=2.0.0
scipy>=1.11.0
netcdf4~=1.7.1
Jinja2>=3.1.4
numpy>=2.0.0
scipy>=1.14.1
netcdf4>=1.7.1
matplotlib>=3.7.0
Cython~=3.0.0
boututils~=0.2.1
boutdata~=0.2.1
Cython>=3.0.0
boututils>=0.2.1
boutdata>=0.2.1
zoidberg>=0.2.2
14 changes: 12 additions & 2 deletions tests/MMS/spatial/fci/runtest
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ for nslice in nslices:
# Note that the Bz and Bzprime parameters here must be the same as in mms.py
field = zb.field.Slab(Bz=0.05, Bzprime=0.1)
# Create rectangular poloidal grids
poloidal_grid = zb.poloidal_grid.RectangularPoloidalGrid(nx, n, 0.1, 1.0)
poloidal_grid = zb.poloidal_grid.RectangularPoloidalGrid(nx, n, 0.1, 1.0, MXG=1)
# Set the ylength and y locations
ylength = 10.0

Expand All @@ -74,7 +74,17 @@ for nslice in nslices:
# Create the grid
grid = zb.grid.Grid(poloidal_grid, ycoords, ylength, yperiodic=yperiodic)
# Make and write maps
maps = zb.make_maps(grid, field, nslice=nslice, quiet=True)
from scipy.interpolate import RectBivariateSpline as RBS

def myRBS(a, b, c):
mx, my = c.shape
kx = max(mx - 1, 1)
kx = min(kx, 3)
print(c.shape, kx)
Copy link
Member

Choose a reason for hiding this comment

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

Left-in debugging?

return RBS(a, b, c, kx=kx)

zb.poloidal_grid.RectBivariateSpline = myRBS
maps = zb.make_maps(grid, field, nslice=nslice, quiet=True, MXG=1)
zb.write_maps(
grid, field, maps, new_names=False, metric2d=conf.isMetric2D(), quiet=True
)
Expand Down
16 changes: 10 additions & 6 deletions tests/integrated/test-fci-boundary/runtest
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ mthread = 2
directory = "data"

with DataFile("grid.fci.nc") as grid:
xfwd = grid.read("forward_xt_prime")[1:-1]
xbwd = grid.read("backward_xt_prime")[1:-1]
try:
MXG = grid.read("MXG")
except:
Copy link
Member

Choose a reason for hiding this comment

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

Should have explicit exception to catch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review - all fixed!

MXG = 1
xfwd = grid.read("forward_xt_prime")[MXG:-MXG]
xbwd = grid.read("backward_xt_prime")[MXG:-MXG]

nx = xfwd.shape[0]

regions = {
"xin_fwd": xfwd < 1,
"xout_fwd": xfwd > nx,
"xin_bwd": xbwd < 1,
"xout_bwd": xbwd > nx,
"xin_fwd": xfwd < MXG,
"xout_fwd": xfwd > nx + MXG - 1,
"xin_bwd": xbwd < MXG,
"xout_bwd": xbwd > nx + MXG - 1,
}
regions = {k: v.astype(int) for k, v in regions.items()}

Expand Down
Loading