-
Notifications
You must be signed in to change notification settings - Fork 388
Remove single-cell pits when initializing global bathymetry #450
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
Remove single-cell pits when initializing global bathymetry #450
Conversation
|
Testing now... |
|
I was wondering what the logic was in having these values previously. Could you rename the config option following my work in #436 as well? |
vanroekel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code needs iterations. I looked at a 60to30 mesh using this initialization and ~700 cells that need alteration of max level cell.
|
No I think these need to be separate PRs. I don't want any additional confusion about what we mean by "smoothing" and if we start modifying filling holes in a PR about smoothing, that would do exactly that in my view. |
0769284 to
105fdef
Compare
|
rebased. testing now. |
105fdef to
2707bcf
Compare
| ! Alter cells for partial bottom cells before filling in bathymetry | ||
| ! holes. | ||
| do iCell = 1, nCells | ||
| call ocn_alter_bottomDepth_for_pbcs(bottomDepth(iCell), refBottomDepth, maxLevelCell(iCell), iErr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xylar this is now complete. The critical change was the line above. The bathymetry holes would be filled, and then in a later call the cells were altered. Specifically, if the bottom bathymetry is within 5% of the layer thickness to the top of the cell, we round it up and change maxLevelCell to one less.
My solution here is to call the PBC routine before filling the bathymetry. I left the original call to
ocn_alter_bottomDepth_for_pbcs
because it is later in the sequence, and it is within your iterations for SSH for land ice. I thought there was no harm done leaving the later one in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I think this is safe to do. I believe I had ocn_alter_bottomDepth_for_pbcs in ocn_init_vertical_grid because it currently only gets called if you are not constraining the vertical grid base don the Haney number, which handles partial bottom cells after making substantial alternations to the grid. This earlier call might slightly modify the outcome of the later stage but not in a way that I expect to be important (just probably not bit-for-bit).
|
I tested this with the EC60to30 in COMPASS, and this little script: The other changes in this PR are just a little clean-up, and moving init flags to the init_mode Registry.xml file. |
|
@xylar and @vanroekel if either of you want to make comments or test, please do. |
| call mpas_allocate_scratch_field(smoothedLevelsField, .true.) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree that the temporary field isn't needed but want to talk it through. If a cell is deeper than its neighbors, it will get filled in. By definition, it is now at the same maxLevelCell as its deepest neighbor. Therefore, no neighbor can be deeper than this cell if it was altered and no neighbors will be filled. So it should be safe to update maxLevelCell as we go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I went through the same logic, and came to the same conclusion.
|
I'd like to do some testing tomorrow. |
xylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to a halo update, I think a similar approach to hole-filling is needed for cases with ice-shelf cavities. I will push two more commits to this branch as soon as I have tested them.
| maxLevelCell(nCells+1) = -1 | ||
| smoothedLevelsField % array = maxLevelCell | ||
|
|
||
| do iCell = 1, nCellsSolve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark-petersen, this computation is done over nCellsSolve but I can't find any indication that there is a halo update of bottomDepth, which seems like a potential problem.
|
@mark-petersen and @vanroekel, I tested including my 2 commits with I tested I used the following script to check that #!/usr/bin/env python
import xarray
import argparse
import numpy
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--infile", dest='infile', required=True,
help="MPAS file with maxLevelCell to check")
args = parser.parse_args()
ds = xarray.open_dataset(args.infile)
cellsOnCell = ds.cellsOnCell.values - 1
maxLevelCell = ds.maxLevelCell.values - 1
maxLevelNeighbor = numpy.zeros(maxLevelCell.shape, int)
for index in range(ds.sizes['maxEdges']):
coc = cellsOnCell[:, index]
mask = coc >= 0
maxLevelNeighbor[mask] = numpy.maximum(maxLevelNeighbor[mask],
maxLevelCell[coc[mask]])
mask = maxLevelCell >= 0
assert(numpy.all(maxLevelCell[mask] <= maxLevelNeighbor[mask])) |
xylar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this, now that pits are addressed in the case with ice-shelf cavities, too.
|
I suspect that the changes related to reverting Redi d3667cc might have also reverted some changes to the EC60to30 setups that made it possible to spin them up (and aren't related directly to Redi). |
vanroekel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ran current head of commit for 60to30 initialization and it works, producing no single cell pits.
|
@xylar I ran the these, with the following results:
I think the EC60to30wISC spin-up can work by adjusting Rayleigh damping and time step. I would rather make those adjustments when we have everything in place (64 levels, new mesh, etc), rather than get it to work for this one PR. If you agree, I'll merge it - perhaps after #495 |
That's strange, it didn't work for me. Did you change anything?
Our agreement was that we were not going to change to 64 vertical levels for EC60to30wISC for now. So we need to set this up as is, and get spin-up working. This is quite a high priority, since we have to start burning through our time on NERSC before June 30th. |
|
I will keep working on spin-up today, so we can hopefully get this IC in place before #495 |
|
I think this is not working (anymore). |
|
It's probably the changes I made to try to fill pits in the Haney-number constrained initialization. I'm going to try again with the commit before that one and see if things look normal. |
|
This is definitely something I introduced. It occurred without ISC as well. I'm debugging now, but have calls interspersed this morning. |
0c0d5a7 to
a5513d1
Compare
|
@xylar I'm sorry I wasted your time on this. Bug fix is in. I had deleted a print statement and deleted the exit on the next line by mistake. You can proceed with your ISC testing. |
|
Okay, great! Thanks for finding that. Then we all need to re-test because all our "tests" passed trivially with a flat bottom... @vanroekel, can you run a quick test when you have time? |
|
I'm going to start again with my EC60to30wISC spin-up starting with this branch and modifying the stages of spin-up if needed. |
|
sure, I should be able to do that today. Would it be enough to run init again? Or would you like me to run the spin up as well? |
|
I'm running EC60to30 init and spinup now. I'll post some plots. |
Just running the test you did before should be enough, given the spin-ups @mark-petersen and I are doing. |
|
okay, happy to do that. I'll let you know what I find. |
|
@mark-petersen, something is not working right with Haney-number constrained initialization at the moment but it's a problem with |
|
I just retested and the result is good, no single cell pits. |
|
@mark-petersen, I somehow missed linking in (and using) the land-ice mask from cell culling in the EC60to30wISC initial_state step. This is now fixed in #499. After cherry-picking #499 onto this branch, I was able to create an EC60to30wISC mesh that doesn't have any pits and looks sensible in paraview. I'm working on spinning it up now. |
|
The EC60to30wISC spin-up was also successful, so we should be good to go (for the maint-1.2 run) as soon as this, #499 and #495 get merged. I don't want to create the initial condition from my current branch because I would like to be able to point to a specific commit on |
Remove single-cell pits from ocean bathymetry Add PBC call just before filling bathymetry holes Move init flags into mode_init
a5513d1 to
b0969b0
Compare
|
rebased. retesting now. |
|
Passed nightly regression with debug, and also QU240wISC. |
|
@xylar ocean/develop is ready to go. I am running the EC60to30wISC right now here: remember to use the directory |
…evelop Before this, single-cell pits were allowed to be one layer deeper than all surrounding cells. These cells can collect tracer extrema and are not able to use horizontal diffusion or advection to clear them out. This PR reduces pits to make them level with the next deepest neighbor cell.
Before this, single-cell pits were allowed to be one layer deeper than all surrounding cells. These cells can collect tracer extrema and are not able to use horizontal diffusion or advection to clear them out. This PR reduces pits to make them level with the next deepest neighbor cell.