Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion test/mms/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: parallel laplace delp
all: parallel

radial: do_radial

Expand Down
7 changes: 7 additions & 0 deletions test/mms/delp_grid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import zoidberg as zb
import numpy as np
import xarray as xr
Expand Down Expand Up @@ -44,6 +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,
)
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)
Expand Down
4 changes: 2 additions & 2 deletions test/mms/mms/BOUT.inp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions test/mms/parallel_grid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import zoidberg as zb
import numpy as np
import xarray as xr
Expand Down Expand Up @@ -47,12 +49,19 @@ 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, :]
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)


Expand Down
11 changes: 9 additions & 2 deletions test/mms/poloidal_grid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import zoidberg as zb
import numpy as np
import xarray as xr
Expand Down Expand Up @@ -53,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)

Expand All @@ -65,6 +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,
)
with xr.open_dataset("tmp.nc") as ds:
dims = ds.dz.dims
ds["r_minor"] = dims, one * r[:, None, :]
Expand All @@ -84,7 +91,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():
Expand Down
7 changes: 7 additions & 0 deletions test/mms/radial_grid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import zoidberg as zb
import numpy as np
import xarray as xr
Expand Down Expand Up @@ -38,6 +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,
)
with xr.open_dataset("tmp.nc") as ds:
dims = ds.dz.dims
ds["r_minor"] = dims, one * r[:, None, :]
Expand Down