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

Add files_for_e3sm steps for ocean and sea-ice meshes #570

Merged
merged 4 commits into from
Mar 27, 2023

Conversation

xylar
Copy link
Collaborator

@xylar xylar commented Mar 20, 2023

These also need to be added to inputdata in shared/meshes/mpas

This merge also makes public some functions from the compass.ocean.vertical module that are used to add cellMask and zMid variables to the MPAS-Ocean mesh.

Checklist

  • User's Guide has been updated
  • Developer's Guide has been updated
  • API documentation in the Developer's Guide (api.rst) has any new or modified class, method and/or functions listed
  • Documentation has been built locally and changes look as expected
  • Document (in a comment titled Testing in this PR) any testing that was used to verify the changes

closes #569

@xylar xylar added enhancement New feature or request ocean in progress This PR is not ready for review or merging labels Mar 20, 2023
@xylar xylar self-assigned this Mar 20, 2023
@xylar xylar changed the title Add meshes to files for e3sm output Add files_for_e3sm steps for ocean and sea-ice meshes Mar 20, 2023
@xylar xylar force-pushed the add_meshes_to_files_for_e3sm_output branch 10 times, most recently from 7d4382c to bd4a58c Compare March 21, 2023 14:01
@xylar
Copy link
Collaborator Author

xylar commented Mar 21, 2023

Testing

I tested this on the following 6 meshes:

  • EC30to60E2r2
  • EC30to60E2r3
  • ECwISC30to60E2r1
  • SOwISC12to60E2r4
  • WC14to60E2r3
  • WC14to60E2r5

which I have created and placed in:

/lcrc/group/e3sm/public_html/inputdata/share/meshes/mpas

@xylar xylar force-pushed the add_meshes_to_files_for_e3sm_output branch from bd4a58c to 2f4de52 Compare March 21, 2023 18:03
@xylar
Copy link
Collaborator Author

xylar commented Mar 21, 2023

Based off of #563, so in draft mode until that gets merged.

@xylar
Copy link
Collaborator Author

xylar commented Mar 21, 2023

Can't build docs locally until I fix #567

@xylar xylar force-pushed the add_meshes_to_files_for_e3sm_output branch from 2f4de52 to 4053000 Compare March 22, 2023 11:57
@xylar xylar requested a review from mark-petersen March 22, 2023 11:59
@xylar
Copy link
Collaborator Author

xylar commented Mar 22, 2023

@mark-petersen, I could use your review on this. I'll point out specific things I'd appreciate your feedback on.

Comment on lines +96 to +105
self.mesh_vars = [
'areaCell', 'cellsOnCell', 'edgesOnCell', 'indexToCellID',
'latCell', 'lonCell', 'meshDensity', 'nEdgesOnCell',
'verticesOnCell', 'xCell', 'yCell', 'zCell', 'angleEdge',
'cellsOnEdge', 'dcEdge', 'dvEdge', 'edgesOnEdge',
'indexToEdgeID', 'latEdge', 'lonEdge', 'nEdgesOnCell',
'nEdgesOnEdge', 'verticesOnEdge', 'weightsOnEdge', 'xEdge',
'yEdge', 'zEdge', 'areaTriangle', 'cellsOnVertex', 'edgesOnVertex',
'indexToVertexID', 'kiteAreasOnVertex', 'latVertex',
'lonVertex', 'xVertex', 'yVertex', 'zVertex']
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mark-petersen, could you sanity check that I didn't miss any variables that are necessary for defining the horizontal mesh?

Copy link
Collaborator

Choose a reason for hiding this comment

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

For reference, these are my notes on how to add a mesh for a paraview visualiztion from a netcdf file without a mesh:

set GridVars=latCell,lonCell,maxLevelCell,nEdgesOnCell,xCell,yCell,zCell,dcEdge,dvEdge,indexToEdgeID,latEdge,lonEdge,nEdgesOnEdge,xEdge,yEdge,zEdge,areaTriangle,indexToVertexID,latVertex,lonVertex,xVertex,yVertex,zVertex,edgesOnVertex,cellsOnVertex,indexToCellID,indexToEdgeID,indexToVertexID,cellsOnEdge,edgesOnCell,edgesOnEdge,cellsOnCell,refBottomDepth,verticesOnCell
ncks -d Time,0 -v ${GridVars},temperature file1.nc file2.nc

Yes, your list includes all the horizontal variables from my notes. I agree that you have them all.

Comment on lines +50 to +53
'refBottomDepth', 'vertCoordMovementWeights',
'bottomDepth', 'maxLevelCell',
'layerThickness', 'restingThickness'
]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mark-petersen, in addition to the horizontal mesh variables, these seem to be the minimum set available for defining the vertical grid. Does that seem right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree.

Comment on lines +74 to +110
if 'minLevelCell' not in ds:
ds['minLevelCell'] = xr.ones_like(ds.maxLevelCell)
ds.minLevelCell.attrs['long_name'] = \
'Index to the first active ocean cell in each column.'

ds['refTopDepth'] = ('nVertLevels', interfaces[0:-1])
ds.refTopDepth.attrs['units'] = 'm'
ds.refTopDepth.attrs['long_name'] = \
"Reference depth of ocean for each vertical level. Used in " \
"'z-level' type runs."
ds['refZMid'] = ('nVertLevels',
-0.5 * (interfaces[1:] + interfaces[0:-1]))
ds.refZMid.attrs['units'] = 'm'
ds.refZMid.attrs['long_name'] = \
'Reference mid z-coordinate of ocean for each vertical ' \
'level. This has a negative value.'
ds['refLayerThickness'] = ('nVertLevels',
interfaces[1:] - interfaces[0:-1])
ds.refLayerThickness.attrs['units'] = 'm'
ds.refLayerThickness.attrs['long_name'] = \
'Reference layer thickness of ocean for each vertical level.'

ds['cellMask'] = compute_cell_mask(
ds.minLevelCell - 1, ds.maxLevelCell - 1,
ds.sizes['nVertLevels'])
ds.cellMask.attrs['long_name'] = \
'Mask on cells that determines if computations should be ' \
'done on cells.'
ds['ssh'] = compute_ssh_from_layer_thickness(
ds.layerThickness, ds.bottomDepth, ds.cellMask)
ds.ssh.attrs['units'] = 'm'
ds.ssh.attrs['long_name'] = 'sea surface height'
ds['zMid'] = compute_zmid_from_layer_thickness(
ds.layerThickness, ds.ssh, ds.cellMask)
ds.zMid.attrs['units'] = 'm'
ds.zMid.attrs['long_name'] = \
'z-coordinate of the mid-depth of the layer'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mark-petersen, in addition to the "required" vertical grid variables above, I'm also adding these (using the layerThickness variable from the initial condition):

  • minLevelCell
  • refTopDepth
  • refZMid
  • refLayerThickness
  • cellMask
  • ssh
  • zMid

Anything in that list seem out of place? Anything important I'm missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that looks good. The variables edgeMask and vertexMask would match your cellMask, but we probably don't need them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about that, too. I don't currently have compass routines for computing those (and I needed cellMask for computing ssh and zMid) so I decided to let them be.

Thanks for taking a look!

@xylar xylar force-pushed the add_meshes_to_files_for_e3sm_output branch from 4053000 to 213f44c Compare March 22, 2023 16:32
@xylar xylar removed the in progress This PR is not ready for review or merging label Mar 23, 2023
@xylar xylar marked this pull request as ready for review March 23, 2023 16:49
@xylar
Copy link
Collaborator Author

xylar commented Mar 23, 2023

@mark-petersen, this has been rebased. You are also welcome to look at the meshes it generated:

/lcrc/group/e3sm/public_html/inputdata/share/meshes/mpas/ocean
/lcrc/group/e3sm/public_html/inputdata/share/meshes/mpas/sea-ice

Here are the QU240 tests as well, to show it within compass:

/lcrc/group/e3sm/ac.xylar/compass_1.2/chrysalis/test_20230321/qu240_mesh_for_e3sm/ocean/global_ocean/QU240/PHC/files_for_e3sm/

In particular, look at:

assembled_files/inputdata/shared/meshes/mpas/ocean
assembled_files/inputdata/shared/meshes/mpas/seaice

@xylar
Copy link
Collaborator Author

xylar commented Mar 24, 2023

@mark-petersen, could you let me know if you want to take some more time to look at the results from this PR? If not, could you approve so I can merge?

Copy link
Collaborator

@mark-petersen mark-petersen left a comment

Choose a reason for hiding this comment

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

Yes, please merge. Looks good, thank you!

@xylar xylar merged commit 8bd3691 into MPAS-Dev:main Mar 27, 2023
@xylar xylar deleted the add_meshes_to_files_for_e3sm_output branch March 27, 2023 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ocean
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ocean and sea-ice meshes (without initial conditions) to files_for_e3sm
2 participants