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

ice_grid: do call 'gridbox_verts' for rectangular grids #749

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

phil-blain
Copy link
Member

PR checklist

  • Short (1 sentence) summary of your PR:
    title
  • Developer(s):
    me
  • Suggest PR reviewers from list in the column to the right.
  • Please copy the PR test results link or provide a summary of testing completed below.
    base suite is bfb with CICE6.4.0, as expected:
349 measured results of 349 total results
349 of 349 tests PASSED
0 of 349 tests PENDING
0 of 349 tests MISSING data
0 of 349 tests FAILED

I also set up a case on a rectangular grid (gbox80) and compiled with -init=snan,arrays and verified that the code does not crash as it did before (see "Problems in ice_grid.F90" in #599 (comment)).

  • How much do the PR code changes differ from the unmodified code?
    • bit for bit
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on Icepack or any other models?
    • Yes
    • No
  • Does this PR add any new test cases?
    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)
    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please provide any additional information or relevant details below:

At the end of subroutine ice_grid::gridbox_corners, the arrays
'lont_bounds' and 'lonu_bounds', which contain the longitude of the
corners of each grid cell on the T and U grids, are converted to to the
[0, 360] range.

In the case of rectangular grids ('grid_type = rectangular'), at the
point where 'gridbox_corners' is called in 'init_grid2', 'lont_bounds'
is not initialized, causing the code to abort if compiling with NaN
initialization. This is due to the fact that 'gridbox_verts', which
initializes 'lont_bounds' and 'latt_bounds', is not called in
'rectgrid', whereas it is called in 'popgrid[_nc]'.

Do call 'gridbox_verts' in 'rectgrid', so that 'lont_bounds' and
'latt_bounds' are correctly initalized in that case also.

Note that these calls are also missing in 'latlongrid' and 'cpomgrid',
but since these two subroutines are not used in standalone
configuration, let's not bother for now.

At the end of subroutine ice_grid::gridbox_corners, the arrays
'lont_bounds' and 'lonu_bounds', which contain the longitude of the
corners of each grid cell on the T and U grids, are converted to to the
[0, 360] range.

In the case of rectangular grids ('grid_type = rectangular'), at the
point where 'gridbox_corners' is called in 'init_grid2', 'lont_bounds'
is not initialized, causing the code to abort if compiling with NaN
initialization. This is due to the fact that 'gridbox_verts', which
initializes 'lont_bounds' and 'latt_bounds', is not called in
'rectgrid', whereas it is called in 'popgrid[_nc]'.

Do call 'gridbox_verts' in 'rectgrid', so that 'lont_bounds' and
'latt_bounds' are correctly initalized in that case also.

Note that these calls are also missing in 'latlongrid' and 'cpomgrid',
but since these two subroutines are not used in standalone
configuration, let's not bother for now.
@phil-blain
Copy link
Member Author

Maybe @dabail10 you would like to comment on the fact that these are also missing in latlongrid ? I can update that subroutine also if you wish.

Or, we could refactor a little bit more, and have gridbox_verts be called in init_grid2, instead of by each individual grid reading routine (thinking about it, that would be cleaner). But I don't know if it's mandatory for gridbox_verts to be called before the call to ice_HaloExtrapolate... If it does not matter then it would be safe to move the call to gridbox_verts to init_grid2, I would think.

@dabail10
Copy link
Contributor

Not sure what to say here. This subroutine latlongrid was created for the atmosphere grids and prescribed ice mode. I thought we were reading in all the information instead of computing it. However, since dynamics is off in this configuration, a lot of the B-grid velocity information is not needed. We have actually moved away from using latlongrid now. We talked about removing it, but I think some groups still use it?

Maybe @dabail10 you would like to comment on the fact that these are also missing in latlongrid ? I can update that subroutine also if you wish.

Or, we could refactor a little bit more, and have gridbox_verts be called in init_grid2, instead of by each individual grid reading routine (thinking about it, that would be cleaner). But I don't know if it's mandatory for gridbox_verts to be called before the call to ice_HaloExtrapolate... If it does not matter then it would be safe to move the call to gridbox_verts to init_grid2, I would think.

@phil-blain
Copy link
Member Author

phil-blain commented Aug 11, 2022

OK, thanks. I pinged you because it's in between ifdef CESMCOUPLED. If the latlongrid subroutine is not used or in the process of being removed, we can just let it be, I would say.

@apcraig apcraig merged commit 08c6b33 into CICE-Consortium:main Aug 12, 2022
@phil-blain
Copy link
Member Author

I would have preferred that someone comment on my suggestion to move the call to gridbox_verts to init_grid2 before merging, I think this would have been cleaner... but anyway let's keep what we have for now. Thanks!

@phil-blain phil-blain deleted the gridbox-verts-rectgrid branch August 17, 2022 15:11
dabail10 pushed a commit to ESCOMP/CICE that referenced this pull request Oct 4, 2022
…ium#749)

At the end of subroutine ice_grid::gridbox_corners, the arrays
'lont_bounds' and 'lonu_bounds', which contain the longitude of the
corners of each grid cell on the T and U grids, are converted to to the
[0, 360] range.

In the case of rectangular grids ('grid_type = rectangular'), at the
point where 'gridbox_corners' is called in 'init_grid2', 'lont_bounds'
is not initialized, causing the code to abort if compiling with NaN
initialization. This is due to the fact that 'gridbox_verts', which
initializes 'lont_bounds' and 'latt_bounds', is not called in
'rectgrid', whereas it is called in 'popgrid[_nc]'.

Do call 'gridbox_verts' in 'rectgrid', so that 'lont_bounds' and
'latt_bounds' are correctly initalized in that case also.

Note that these calls are also missing in 'latlongrid' and 'cpomgrid',
but since these two subroutines are not used in standalone
configuration, let's not bother for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants