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

part of cam6_4_033: Wrap MPAS longitude values to [0,2pi) range #1095

Merged
merged 7 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
64 changes: 64 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
===============================================================

Tag name:
Originator(s): gdicker
Date: Jul 18, 2024
One-line Summary: Address run failures due to MPAS-A longitudes
Github PR URL: https://github.com/ESCOMP/CAM/pull/1095

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
- Wrap MPAS-A longitudes to [0,2pi) range: https://github.com/ESCOMP/CAM/issues/1094

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by:

List all files eliminated: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
M src/dynamics/mpas/driver/cam_mpas_subdriver.F90
- Modifies cam_mpas_read_static to ensure lonCell values are in [0,2pi) range

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:

izumi/nag/aux_cam:

izumi/gnu/aux_cam:

CAM tag used for the baseline comparison tests if different than previous
tag:

Summarize any changes to answers, i.e.,
- what code configurations:
- what platforms/compilers:
- nature of change (roundoff; larger than roundoff but same climate; new
climate):

If bitwise differences were observed, how did you show they were no worse
than roundoff?

If this tag changes climate describe the run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced, i.e.,
- source tag (all code used must be in the repository):
- platform/compilers:
- configure commandline:
- build-namelist command (or complete namelist):
- MSS location of output:

MSS location of control simulations used to validate new climate:

URL for AMWG diagnostics output used to validate new climate:

===============================================================

Tag name: cam6_3_148
Originator(s): brianpm, courtneyp, eaton
Date: Wed 21 Feb 2024
Expand Down
16 changes: 14 additions & 2 deletions src/dynamics/mpas/driver/cam_mpas_subdriver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -884,15 +884,16 @@ subroutine cam_mpas_read_static(fh_ini, endrun)

use pio, only : file_desc_t

use mpas_kind_types, only : StrKIND
use mpas_kind_types, only : StrKIND, RKIND
use mpas_io_streams, only : MPAS_createStream, MPAS_closeStream, MPAS_streamAddField, MPAS_readStream
use mpas_derived_types, only : MPAS_IO_READ, MPAS_IO_NETCDF, MPAS_Stream_type, MPAS_pool_type, &
field0DReal, field1DReal, field2DReal, field3DReal, field1DInteger, field2DInteger, &
MPAS_STREAM_NOERR
use mpas_pool_routines, only : MPAS_pool_get_subpool, MPAS_pool_get_field, MPAS_pool_create_pool, MPAS_pool_destroy_pool, &
MPAS_pool_add_config
MPAS_pool_add_config, MPAS_pool_get_dimension, MPAS_pool_get_array
use mpas_dmpar, only : MPAS_dmpar_exch_halo_field
use mpas_stream_manager, only : postread_reindex
use mpas_constants, only : pii

! Arguments
type (file_desc_t), pointer :: fh_ini
Expand Down Expand Up @@ -929,8 +930,13 @@ subroutine cam_mpas_read_static(fh_ini, endrun)

type (MPAS_Stream_type) :: mesh_stream

integer, pointer :: nCells
real(kind=RKIND), dimension(:), pointer :: lonCell_arr

nullify(cell_gradient_coef_x)
nullify(cell_gradient_coef_y)
nullify(nCells)
nullify(lonCell_arr)

call MPAS_createStream(mesh_stream, domain_ptr % ioContext, 'not_used', MPAS_IO_NETCDF, MPAS_IO_READ, &
pio_file_desc=fh_ini, ierr=ierr)
Expand Down Expand Up @@ -1171,6 +1177,12 @@ subroutine cam_mpas_read_static(fh_ini, endrun)
call endrun(subname//': FATAL: Failed to close static input stream.')
end if

call mpas_pool_get_dimension(meshPool, 'nCells', nCells)
mgduda marked this conversation as resolved.
Show resolved Hide resolved
call mpas_pool_get_array(meshPool, 'lonCell', lonCell_arr)

! Ensure longitudes w/i [0, 2*pi) range
mgduda marked this conversation as resolved.
Show resolved Hide resolved
lonCell_arr(:) = lonCell_arr(:) - (2.*pii) * floor(lonCell_arr(:) / (2.*pii))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
lonCell_arr(:) = lonCell_arr(:) - (2.*pii) * floor(lonCell_arr(:) / (2.*pii))
lonCell_arr(:) = lonCell_arr(:) - (2._RKIND*pii) * floor(lonCell_arr(:) / (2._RKIND*pii))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the reminder! Addressed by 288f3ed


!
! Perform halo updates for all decomposed fields (i.e., fields with
! an outermost dimension of nCells, nVertices, or nEdges)
Expand Down