Skip to content

Support 3D models with generated vertical grids - #22

Open
rafa-guedes wants to merge 1 commit into
mainfrom
fix/vgrid-3d
Open

rafa-guedes wants to merge 1 commit into
mainfrom
fix/vgrid-3d

Conversation

@rafa-guedes

Copy link
Copy Markdown
Contributor

A 3D model could only use a vgrid.in file. With a generated vertical grid (VGrid or VgridGenerator), SCHISMGrid.is_3d was False and SCHISMGrid.pylibs_vgrid raised, so the 3D boundary files and hotstart.nc were built as 2D.

Changes

  • SCHISMGrid.pylibs_vgrid works for generated grids. It writes the grid once to a temporary directory and reads it back.
  • is_3d and nvrt come from the vertical grid itself. A 2D vgrid.in file was taken as 3D. A 2D grid now has nvrt = 2 (one layer) instead of None.
  • LSC² is rejected when configured. pylib's create_schism_vgrid cannot build LSC² (ivcor=1 option not available yet), because it comes from the mesh depths through SCHISM's gen_vqs. VGrid and VgridGenerator now say so when they are created, and ask for vgrid.in as a file. Before, it failed only at generation.
  • VGrid() defaults to SZ. Its LSC² default always failed.
  • VgridGenerator.vgrid_type is a Literal["2d", "sz", "lsc2"]. Unknown values fell back to LSC², which then failed.

Checks

  • A new test covers is_3d, nvrt and pylibs_vgrid for generated SZ and 2D grids.
  • Three existing tests asserted the old behaviour: a 2D nvrt of None, LSC² failing at generation, and an LSC² VGrid instance. They now check the new behaviour. The full suite passes.
  • A 3D run with a generated 10-level SZ grid completed in SCHISM v5.13.0 and wrote the 3D velocity and zCoordinates files.

SCHISMGrid only read vgrid.in files: with VGrid or VgridGenerator,
is_3d was False and pylibs_vgrid failed, so 3D boundary files and
hotstart were written as 2D. Generated grids are now read from a copy
written once to a temporary directory, and is_3d and nvrt come from the
vertical grid itself (a 2D vgrid.in file is no longer taken as 3D).

LSC2 grids cannot be generated with pylib (they need SCHISM's gen_vqs),
so VGrid and VgridGenerator reject them when configured, with a message
to give vgrid.in as a file. VGrid now defaults to SZ, since its LSC2
default always failed.

This branch has not been deployed

No deployments
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.

1 participant