From 2b4c45c6184d343d1788968e14c15cd774ca0c95 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 10:21:43 +0200 Subject: [PATCH 1/8] Use generated grid --- test/mms/mms/BOUT.inp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mms/mms/BOUT.inp b/test/mms/mms/BOUT.inp index fa6b0c5..52e57f1 100644 --- a/test/mms/mms/BOUT.inp +++ b/test/mms/mms/BOUT.inp @@ -1,10 +1,10 @@ MXG=0 MYG=1 + [mesh] MXG=0 MYG=1 -#file = "rotating-ellipse.4x4x4.fci.fix.nc" -file = "poloidal_const_4_2_4_1.fci.nc" +file = "parallel_const_8_16_4_1.fci.nc" extrapolate_y = false extrapolate_x = false From 4811551ae6a92e88e4f48e793b4c9473341e6330 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 10:21:58 +0200 Subject: [PATCH 2/8] Avoid some warnings --- test/mms/poloidal_grid.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/mms/poloidal_grid.py b/test/mms/poloidal_grid.py index 0e4fbe7..295c579 100644 --- a/test/mms/poloidal_grid.py +++ b/test/mms/poloidal_grid.py @@ -1,3 +1,5 @@ +import warnings + import zoidberg as zb import numpy as np import xarray as xr @@ -65,6 +67,7 @@ def gen_grid(*args): "tmp.nc", metric2d=False, ) + warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) with xr.open_dataset("tmp.nc") as ds: dims = ds.dz.dims ds["r_minor"] = dims, one * r[:, None, :] From 72d6ae162226e8afdf1d38dbaacc87f23d8ceb73 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 10:24:59 +0200 Subject: [PATCH 3/8] Ignore warning --- test/mms/delp_grid.py | 3 +++ test/mms/parallel_grid.py | 3 +++ test/mms/radial_grid.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/test/mms/delp_grid.py b/test/mms/delp_grid.py index fe588ff..bdd3497 100644 --- a/test/mms/delp_grid.py +++ b/test/mms/delp_grid.py @@ -1,3 +1,5 @@ +import warnings + import zoidberg as zb import numpy as np import xarray as xr @@ -44,6 +46,7 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): "tmp.nc", metric2d=False, ) + warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) with xr.open_dataset("tmp.nc") as ds: for k in "g11,g33,g_11,g_33,nx,ny,nz".split(","): assert np.all(ds[k] > 0) diff --git a/test/mms/parallel_grid.py b/test/mms/parallel_grid.py index e3785e3..2af36c5 100644 --- a/test/mms/parallel_grid.py +++ b/test/mms/parallel_grid.py @@ -1,3 +1,5 @@ +import warnings + import zoidberg as zb import numpy as np import xarray as xr @@ -47,6 +49,7 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): "tmp.nc", metric2d=False, ) + warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) with xr.open_dataset("tmp.nc") as ds: dims = ds.dz.dims ds["r_minor"] = dims, one * r[:, None, :] diff --git a/test/mms/radial_grid.py b/test/mms/radial_grid.py index 593dfa6..498a5fa 100644 --- a/test/mms/radial_grid.py +++ b/test/mms/radial_grid.py @@ -1,3 +1,5 @@ +import warnings + import zoidberg as zb import numpy as np import xarray as xr @@ -38,6 +40,7 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): "tmp.nc", metric2d=False, ) + warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) with xr.open_dataset("tmp.nc") as ds: dims = ds.dz.dims ds["r_minor"] = dims, one * r[:, None, :] From d90297e76d84a04ad1dbc77394a172eb4e986cea Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 10:26:53 +0200 Subject: [PATCH 4/8] Fix grid length --- test/mms/poloidal_grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mms/poloidal_grid.py b/test/mms/poloidal_grid.py index 295c579..996c518 100644 --- a/test/mms/poloidal_grid.py +++ b/test/mms/poloidal_grid.py @@ -55,7 +55,7 @@ def gen_grid(*args): pol_grid = zb.poloidal_grid.StructuredPoloidalGrid(R, Z) field = zb.field.CurvedSlab(Bz=0, Bzprime=0, Rmaj=R0) - grid = zb.grid.Grid(pol_grid, phi, 5, yperiodic=True) + grid = zb.grid.Grid(pol_grid, phi, np.pi/2.5, yperiodic=True) fn = gen_name(*args) From 584f7b229f9ce2f799cd48a362e55eaeabc834c0 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 10:27:04 +0200 Subject: [PATCH 5/8] Ensure grid is big enough --- test/mms/poloidal_grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mms/poloidal_grid.py b/test/mms/poloidal_grid.py index 996c518..ae1bd18 100644 --- a/test/mms/poloidal_grid.py +++ b/test/mms/poloidal_grid.py @@ -87,7 +87,7 @@ def _togen(*args): grids = {} for mode in range(5): - grids[modes[mode][0]] = [_togen(4, 2, nz, 1, 0.1, 0.5, mode) + (nz,) for nz in lst] + grids[modes[mode][0]] = [_togen(6, 2, nz, 1, 0.1, 0.5, mode) + (nz,) for nz in lst] if __name__ == "__main__": for todos in grids.values(): From a1baa27441bc74922d8e98497d58b14be1de05e1 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 10:35:23 +0200 Subject: [PATCH 6/8] Fix formatting --- test/mms/delp_grid.py | 6 +++++- test/mms/parallel_grid.py | 6 +++++- test/mms/poloidal_grid.py | 8 ++++++-- test/mms/radial_grid.py | 6 +++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/test/mms/delp_grid.py b/test/mms/delp_grid.py index bdd3497..072492f 100644 --- a/test/mms/delp_grid.py +++ b/test/mms/delp_grid.py @@ -46,7 +46,11 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): "tmp.nc", metric2d=False, ) - warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) + warnings.filterwarnings( + "ignore", + message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", + category=UserWarning, + ) with xr.open_dataset("tmp.nc") as ds: for k in "g11,g33,g_11,g_33,nx,ny,nz".split(","): assert np.all(ds[k] > 0) diff --git a/test/mms/parallel_grid.py b/test/mms/parallel_grid.py index 2af36c5..a37f320 100644 --- a/test/mms/parallel_grid.py +++ b/test/mms/parallel_grid.py @@ -49,7 +49,11 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): "tmp.nc", metric2d=False, ) - warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) + warnings.filterwarnings( + "ignore", + message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", + category=UserWarning, + ) with xr.open_dataset("tmp.nc") as ds: dims = ds.dz.dims ds["r_minor"] = dims, one * r[:, None, :] diff --git a/test/mms/poloidal_grid.py b/test/mms/poloidal_grid.py index ae1bd18..7236a0e 100644 --- a/test/mms/poloidal_grid.py +++ b/test/mms/poloidal_grid.py @@ -55,7 +55,7 @@ def gen_grid(*args): pol_grid = zb.poloidal_grid.StructuredPoloidalGrid(R, Z) field = zb.field.CurvedSlab(Bz=0, Bzprime=0, Rmaj=R0) - grid = zb.grid.Grid(pol_grid, phi, np.pi/2.5, yperiodic=True) + grid = zb.grid.Grid(pol_grid, phi, np.pi / 2.5, yperiodic=True) fn = gen_name(*args) @@ -67,7 +67,11 @@ def gen_grid(*args): "tmp.nc", metric2d=False, ) - warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) + warnings.filterwarnings( + "ignore", + message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", + category=UserWarning, + ) with xr.open_dataset("tmp.nc") as ds: dims = ds.dz.dims ds["r_minor"] = dims, one * r[:, None, :] diff --git a/test/mms/radial_grid.py b/test/mms/radial_grid.py index 498a5fa..497e224 100644 --- a/test/mms/radial_grid.py +++ b/test/mms/radial_grid.py @@ -40,7 +40,11 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): "tmp.nc", metric2d=False, ) - warnings.filterwarnings("ignore", message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", category=UserWarning) + warnings.filterwarnings( + "ignore", + message="Duplicate dimension names present: dimensions {.*} appear more than once in dims=(.*). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xa", + category=UserWarning, + ) with xr.open_dataset("tmp.nc") as ds: dims = ds.dz.dims ds["r_minor"] = dims, one * r[:, None, :] From b6d96df034aa4b3a0248fe9559576629022c8a6e Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 12:51:22 +0200 Subject: [PATCH 7/8] Laplace is currently not implemented for FCI --- test/mms/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mms/Makefile b/test/mms/Makefile index 57fff7e..d42f333 100644 --- a/test/mms/Makefile +++ b/test/mms/Makefile @@ -1,4 +1,4 @@ -all: parallel laplace delp +all: parallel radial: do_radial From ec1d772229754b4ca104a828a72af06710eea657 Mon Sep 17 00:00:00 2001 From: David Bold Date: Tue, 23 Jun 2026 12:52:08 +0200 Subject: [PATCH 8/8] Fixup parallel indices --- test/mms/parallel_grid.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/mms/parallel_grid.py b/test/mms/parallel_grid.py index a37f320..bb49b4a 100644 --- a/test/mms/parallel_grid.py +++ b/test/mms/parallel_grid.py @@ -60,6 +60,8 @@ def gen_grid(nx, ny, nz, R0, r0, r1, mode=0): ds["phi"] = "y", phi ds["theta"] = dims, one * theta[:, None, :] ds["one"] = dims, one + for pre in "for", "back": + ds[f"{pre}ward_xt_prime"] = dims, one * np.arange(nx)[:, None, None] ds.to_netcdf(fn)