Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added optional `tilelons` and `tilelats` to create a simple locstream
- Add `MAPL_SUPPORT_MAPL3` CMake option to reduce MAPL2 to a support library for use alongside MAPL3. When `ON`, the generic layer, gridcomps, Apps, benchmarks, docs, Python bridge, and top-level Tests are disabled; all CMake targets are renamed with a `MAPL2.*` prefix controlled by the `MAPL_TARGET_PREFIX` variable. Default is `OFF` (no change in behavior).
- When `MAPL_SUPPORT_MAPL3=ON`, the umbrella module in `MAPL/MAPL.F90` is renamed from `module MAPL` to `module MAPL2` (and the alias from `MAPL_Mod` to `MAPL2_Mod`); `use MAPL` in hybrid mode is intentionally undefined. `use ESMF_CFIOMod` is now unconditional in both modes.
- Add `.mlc.toml` file to configure `mlc` link checker
- Added a new feature: create a halo based on local displacement members, local-displacement-ensemble (LDE), requested some time ago by Arlindo da Silva
- CDash nightly workflow configured to build and test `release/MAPL-v3` from the `main` branch
- CTest dashboard configuration files (`CTestDashboard.cmake`, `CTestConfig.cmake`, `CTestCustom.cmake`) ported from `release/MAPL-v3` to support nightly CI/CD testing


### Changed

- Skip expensive CI on draft PRs to match CircleCI behavior
Expand Down
27 changes: 21 additions & 6 deletions base/MAPL_LocStreamMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2922,11 +2922,13 @@ end subroutine MAPL_GridCoordAdjust

!A special subroutine for Nx1 Grid in river-routing grid comp
!Some information in the locstream is not filled
subroutine MAPL_LocstreamCreateSimple(Locstream, grid, local_id, rc)
subroutine MAPL_LocstreamCreateSimple(Locstream, grid, local_id, tilelons, tilelats, rc)
type(MAPL_LocStream), intent(OUT) :: LocStream
type(ESMF_Grid), intent(inout) :: grid
integer, optional, intent(in) :: local_id(:)
integer, optional, intent(out) :: rc
type(ESMF_Grid), intent(inout) :: grid
integer, optional, intent(in) :: local_id(:)
real, optional, intent(in) :: tilelons(:)
real, optional, intent(in) :: tilelats(:)
integer, optional, intent(out) :: rc
integer :: status, i, i1, i2, j1, j2, nt_local
type(MAPL_LocStreamType), pointer :: STREAM
integer :: globalCount(3)
Expand All @@ -2939,14 +2941,27 @@ subroutine MAPL_LocstreamCreateSimple(Locstream, grid, local_id, rc)
stream%grid = grid
call MAPL_grid_interior(grid, i1, i2, j1, j2)
_ASSERT( j1 == 1 .and. j2 ==1, "This simple Locstream is for Nx1 grid")
nt_local = i2 - i1 + 1

nt_local = i2 - i1 + 1
stream%nt_local = nt_local

if (present(local_id)) then
_ASSERT(size(local_id) == nt_local, 'local size should match the 1d grid')
allocate(stream%local_id, source = local_id)
else
allocate(stream%local_id, source = [(i, i = i1, i2)])
endif
stream%nt_local = nt_local

if (present(tilelons)) then
allocate(stream%Local_GeoLocation(nt_local))
stream%Local_GeoLocation(:)%x = tilelons
endif

if (present(tilelats)) then
if (.not. associated(stream%Local_GeoLocation)) allocate(stream%Local_GeoLocation(nt_local))
stream%Local_GeoLocation(:)%y = tilelats
endif

call MAPL_GridGet(grid,globalCellCountPerDim=globalCount,rc=status)
_VERIFY(STATUS)
stream%nt_global = globalCount(1)
Expand Down
28 changes: 17 additions & 11 deletions griddedio/TileGridIO.F90
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ subroutine CreateFileMetaData(this,items,bundle,timeInfo,vdata,ogrid,global_attr
call v%add_attribute('long_name','latitude')
call this%metadata%add_variable('lat',v,rc=status)
_VERIFY(status)
endif
if (allocated(this%i_index)) then
v = Variable(type=PFIO_INT32,dimensions='tile')
call v%add_attribute('units','1')
call v%add_attribute('long_name','i_index')
Expand All @@ -186,7 +188,6 @@ subroutine CreateFileMetaData(this,items,bundle,timeInfo,vdata,ogrid,global_attr
_VERIFY(status)
endif


if (this%itemOrderAlphabetical) then
call this%alphabatize_variables(metadataVarsSize,rc=status)
_VERIFY(status)
Expand Down Expand Up @@ -470,7 +471,8 @@ subroutine stage2DLatLon(this, fileName, oClients, rc)
ref = ArrayReference(this%tilelats)
call oClients%collective_stage_data(this%write_collection_id,trim(filename),'lat', &
ref,start=localStart, global_start=GlobalStart, global_count=GlobalCount)

endif
if (allocated(this%i_index)) then
ref = ArrayReference(this%i_index)
call oClients%collective_stage_data(this%write_collection_id,trim(filename),'IG', &
ref,start=localStart, global_start=GlobalStart, global_count=GlobalCount)
Expand Down Expand Up @@ -770,16 +772,11 @@ subroutine InitRedistHandle(this, rc)
call ESMF_FieldRedistStore(srcField= this%field_in, dstField=this%field_out, &
routehandle=this%routehandle, _RC)

! reordered lat-lon, II, and JJ
if (associated(tilelons) .and. associated(tilelats) .and. associated(local_i) .and. associated(local_j)) then
call MAPL_FieldGetPointer(this%field_in, ptr1d,rc=status)
call MAPL_FieldGetPointer(this%field_out,outptr1d,rc=status)
! reordered lat-lon
if (associated(tilelons) .and. associated(tilelats) ) then
allocate(this%tilelons(arbIndexCount), this%tilelats(arbIndexCount))
allocate(this%i_index(arbIndexCount), this%j_index(arbIndexCount))
call MAPL_FieldGetPointer(this%field_in, ptr1d,rc=status)
call MAPL_FieldGetPointer(this%field_out,outptr1d,rc=status)

call MAPL_LocStreamGet(locstream, attachedgrid=attachedgrid, _RC)
call MAPL_grid_interior(attachedgrid, i1, i2, j1, j2)
call ESMF_GridGet(attachedgrid, name=gname, _RC)

ptr1d(:) = tilelons(:)
call ESMF_FieldRedist(this%field_in, this%field_out, this%routeHandle, rc=status)
Expand All @@ -788,6 +785,14 @@ subroutine InitRedistHandle(this, rc)
ptr1d(:) = tilelats(:)
call ESMF_FieldRedist(this%field_in, this%field_out, this%routeHandle, rc=status)
this%tilelats = outptr1d*MAPL_RADIANS_TO_DEGREES
endif
! reordered II, and JJ
if ( associated(local_i) .and. associated(local_j)) then
allocate(this%i_index(arbIndexCount), this%j_index(arbIndexCount))

call MAPL_LocStreamGet(locstream, attachedgrid=attachedgrid, _RC)
call MAPL_grid_interior(attachedgrid, i1, i2, j1, j2)
call ESMF_GridGet(attachedgrid, name=gname, _RC)

ptr1d(:) = local_i(:) + i1 -1
if (index(gname, 'EASE') /=0) ptr1d = ptr1d - 1
Expand All @@ -799,6 +804,7 @@ subroutine InitRedistHandle(this, rc)
call ESMF_FieldRedist(this%field_in, this%field_out, this%routeHandle, rc=status)
this%j_index = nint(outptr1d)
endif

_RETURN(_SUCCESS)

end subroutine
Expand Down
Loading