Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
063b6b1
placeholder issm gridcomp, directory, cmakelists
Sep 16, 2025
99c9be8
filling out basic gridcomp structure
Sep 16, 2025
9bef4de
add call to child in landice
Sep 16, 2025
3aa9eea
update issm cmakelists, add comments
Sep 17, 2025
ebacece
more comments
Sep 17, 2025
6d53c14
comments
Sep 17, 2025
a676596
comment out alot to try hello-world child
Sep 17, 2025
8416bf3
edit cmakelists
Sep 17, 2025
6bcbae7
trying to fix cmakelists
Sep 17, 2025
022be8b
shuffling cmakelists commands
Sep 17, 2025
0c6e441
comments
Sep 17, 2025
fa5981a
trying to rename issm gridcomp
Sep 17, 2025
d5b52bf
correct gridcomp name
Sep 17, 2025
3bd7776
add mapl metacomp pointers
Sep 17, 2025
ba5ec9a
debugging child run call
Sep 17, 2025
0763c6a
comment
Sep 18, 2025
5fe0310
uncomment actual issm calls
Sep 18, 2025
c9ec4f8
comment fix
Sep 18, 2025
23b95cb
remove redundancy
Sep 18, 2025
4ae646f
comment out just the run issm call
Sep 18, 2025
1a03c79
also comment out issm finalize just in case
Sep 18, 2025
0eebfbe
try printing vm info
Sep 18, 2025
bf083eb
trying to call issm initialize again
Sep 18, 2025
ae2b379
shuffles calls around
Sep 18, 2025
0ef069d
call get vm
Sep 19, 2025
70688d9
call issm finalize
Sep 19, 2025
2cb4389
try gridcompcreate with issm mesh
Sep 19, 2025
85a1318
comment a comment...
Sep 19, 2025
6f72205
try gridcompset for issm mesh...
Sep 19, 2025
847ef41
try to call issm run
Sep 19, 2025
2b67056
see if adding vmbarrier fixes petsc error
Sep 19, 2025
b613d5b
try buffering number of elements
Sep 19, 2025
960ea2a
revert number of elements, remove sdim
Sep 19, 2025
b3c8666
trying to run from initialize just to see...
Sep 19, 2025
6c999a0
revert to correct run/initialize structure
Sep 19, 2025
2e8ada2
trying calling mapl_genericinitialize before issm
Sep 19, 2025
f117650
print smb inputs, never give up
Sep 19, 2025
bd4fcf5
smb all zeros is good, print sizes to make sure...
Sep 19, 2025
e608ffa
try running again
Sep 19, 2025
651392b
fix issm rootdir
Sep 21, 2025
b076005
fix directory argv trunction
Sep 21, 2025
2d3f151
minor comments
Sep 22, 2025
ed312fe
remove vm print info
Sep 22, 2025
59dd3de
duplicate vm comm for issm use
Sep 23, 2025
f562b8d
child call according to run alarm
Sep 24, 2025
9138e80
add barriers and deallocates
Sep 26, 2025
466366a
try mpi barrier
Sep 26, 2025
babce7c
don't forget allocations
Sep 26, 2025
9d804ff
add suffix just in case
Sep 26, 2025
b815972
add intrinsics and comments
Oct 1, 2025
b0f7b07
point to petsc debug version
Oct 1, 2025
09d2dee
remove intrinsics, threw syntax error
Oct 1, 2025
c8b848d
remove some comments
Oct 6, 2025
6d9522f
add ISSM alarm test
Oct 6, 2025
5fb8a79
declare alarm
Oct 6, 2025
b58a751
remove some printing and alarm_off call
Oct 7, 2025
323e11f
change mesh coordsys to lat-lon, mv runchild call
Oct 7, 2025
6319060
minor comments
Oct 9, 2025
751463b
comment about lat/long
Oct 9, 2025
1df4220
add mesh-to-agrid regridding
agstub Nov 4, 2025
3648359
add locstream transform
Nov 5, 2025
1e0ea27
replace mktile
Nov 5, 2025
677278b
fix typo
Nov 5, 2025
69b3a50
various comments and renaming
Nov 5, 2025
b081fed
fix type error
Nov 5, 2025
ba28650
fix type error
Nov 5, 2025
ec50d30
fix several types
Nov 5, 2025
3a08816
fix fieldfill
Nov 5, 2025
9c9bafd
add grid-to-mesh routehandle
Nov 6, 2025
d9c9c51
fix assignment
Nov 6, 2025
0dbc28c
add import states
Nov 6, 2025
e61d17d
format consistency
Nov 6, 2025
9c5e7e3
formatting consistency
Nov 6, 2025
04f127d
some comments
Nov 6, 2025
bcc108d
add some smb variables
Nov 6, 2025
eb27956
fix deallocate
Nov 6, 2025
12f5fe9
add regrid for smb
Nov 6, 2025
bda5182
allocate grid field
Nov 7, 2025
fb87304
fix meshloc
Nov 7, 2025
414fddd
fixed allocation issue-mostly working
agstub Nov 7, 2025
cc2bff0
update locstream transforms-working
agstub Nov 12, 2025
578b77e
add do_issm flag
Nov 18, 2025
0426593
specify issm expdir/input in rc file
Nov 18, 2025
79728a9
add average,refresh intervals to smb import
agstub Nov 19, 2025
dc0d67e
add mesh save option
agstub Nov 21, 2025
50add94
Merge branch 'develop' into feature/agstub/issm-gridcomp
Feb 5, 2026
04a6376
set initialize method to be consistent w/o issm
Feb 5, 2026
d3ab7ff
v11: Build ISSM based on detection of ISSM
mathomp4 Feb 6, 2026
d3af239
Merge pull request #1206 from GEOS-ESM/feature/issm-optional
agstub Feb 9, 2026
1faf388
set issm surface resource parameters, fix comment
Feb 11, 2026
ccb0f3f
add element IDs to mesh save
agstub Feb 11, 2026
e796a23
init changes
weiyuan-jiang Feb 11, 2026
52f80e5
Merge branch 'feature/agstub/issm-gridcomp' into feature/agstub/issm-…
weiyuan-jiang Feb 11, 2026
0660d34
hide locstream and grid in internal state
weiyuan-jiang Feb 12, 2026
dbfbadb
create mesh_grid for output
weiyuan-jiang Feb 12, 2026
021fc34
Merge pull request #1209 from GEOS-ESM/feature/jiang/issm-gridcomp
agstub Feb 13, 2026
47cb3ed
add new issm expots to gridcomp
Feb 16, 2026
0ea9f88
fix variable name typo
Feb 16, 2026
981e4da
fix fielddestroy calls
Feb 16, 2026
f965e23
initialize issm outputs to zero
Feb 16, 2026
6af64bd
rm whitespace
Feb 16, 2026
877ac87
edit formatting
Feb 16, 2026
c41c4dc
rename mesh file
Feb 16, 2026
7318859
Merge pull request #1210 from GEOS-ESM/feature/agstub/issm-outputs
agstub Feb 16, 2026
645987b
name mesh file according to issm coniguration name
Feb 18, 2026
15ba70f
Merge branch 'feature/agstub/issm-gridcomp' into feature/agstub/issm-…
agstub Feb 18, 2026
2e46e29
Merge pull request #1211 from GEOS-ESM/feature/agstub/issm-outputs
agstub Feb 18, 2026
d25e139
initial changes
Feb 23, 2026
1f6c2e9
fix interface arg
agstub Feb 24, 2026
95ca554
Merge pull request #1216 from GEOS-ESM/feature/agstub/issm-multiglac
agstub Feb 24, 2026
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
esma_set_this ()

# First set alldirs to empty
set(alldirs)
# ... and srcs to the LandIceGridComp
set (srcs GEOS_LandIceGridComp.F90)

# Then try to find ISSM
find_package (ISSM QUIET COMPONENTS Core)

if(ISSM_FOUND)
# If ISSM is found, append the directory to alldirs
message(STATUS "ISSM found, building gridded component")
list (APPEND alldirs GEOSissm_GridComp)
else()
# If ISSM is not found, append the stub component to srcs
message(STATUS "ISSM not found, using stub component")
# For esma_create_stub_component, we need the name of the *module*
# that the landice gc is expecting, minus the mod. Also we
# have to use the variable srcs but not the ${srcs} because
# esma_create_stub_component is expecting the list itself, not the
# contents of the list.
esma_create_stub_component(srcs GEOS_IssmGridComp)
endif()

# We have to do the above way because what esma_create_stub_component
# does is to append the stub component it creates in the build tree to a
# list of sources srcs. So if ISSM is found, we go into the subdir and
# build the real component, and if ISSM is not found, we create the stub
# component and append it to srcs.

esma_add_library (${this}
SRCS GEOS_LandIceGridComp.F90
DEPENDENCIES MAPL GEOS_Shared GEOS_SurfaceShared ESMF::ESMF NetCDF::NetCDF_Fortran
)
SRCS ${srcs}
SUBCOMPONENTS ${alldirs}
DEPENDENCIES MAPL GEOS_Shared GEOS_SurfaceShared ESMF::ESMF NetCDF::NetCDF_Fortran)
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module GEOS_LandiceGridCompMod
use MAPL
use GEOS_UtilsMod
use DragCoefficientsMod
use GEOS_IssmGridCompMod, only : IssmSetServices => SetServices

implicit none
private
Expand Down Expand Up @@ -100,6 +101,8 @@ module GEOS_LandiceGridCompMod

public SetServices

integer :: ISSM

! !DESCRIPTION:
!
! {\tt GEOS\_Landice} is a light-weight gridded component that updates
Expand Down Expand Up @@ -149,6 +152,7 @@ subroutine SetServices ( GC, RC )

type(MAPL_MetaComp), pointer :: MAPL

integer :: DO_ISSM ! ISSM flag

! Begin...

Expand All @@ -159,20 +163,29 @@ subroutine SetServices ( GC, RC )
VERIFY_(STATUS)
Iam = trim(COMP_NAME) // 'SetServices'

! Get my internal MAPL_Generic state
!-----------------------------------

call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS)
VERIFY_(STATUS)

! Set the Run entry point
! -----------------------
!add initialize method for child (ISSM)
call MAPL_GetResource (MAPL, DO_ISSM, label='DO_ISSM:', DEFAULT=0, __RC__ )

call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run1, RC=STATUS )
VERIFY_(STATUS)
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run2, RC=STATUS )
VERIFY_(STATUS)

call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE, Initialize, RC=STATUS )
VERIFY_(STATUS)

! Get my internal MAPL_Generic state
!-----------------------------------

call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS)
VERIFY_(STATUS)
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run1, RC=STATUS )
VERIFY_(STATUS)
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run2, RC=STATUS )
VERIFY_(STATUS)

! Get resource parameters
! -----------------------
call MAPL_GetResource (MAPL, SURFRC, label = 'SURFRC:', default = 'GEOS_SurfaceGridComp.rc', RC=STATUS) ; VERIFY_(STATUS)
SCF = ESMF_ConfigCreate(rc=status) ; VERIFY_(STATUS)
call ESMF_ConfigLoadFile(SCF,SURFRC,rc=status) ; VERIFY_(STATUS)
Expand All @@ -188,6 +201,15 @@ subroutine SetServices ( GC, RC )

! !Export state:

call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'ICESMB', &
LONG_NAME = 'ice_surface_mass_balance', &
UNITS = 'kg m-2 s-1', &
DIMS = MAPL_DimsTileOnly, &
VLOCATION = MAPL_VLocationNone, &
RC=STATUS )
VERIFY_(STATUS)

call MAPL_AddExportSpec(GC, &
SHORT_NAME = 'EMIS', &
LONG_NAME = 'surface_emissivity', &
Expand Down Expand Up @@ -1618,6 +1640,16 @@ subroutine SetServices ( GC, RC )
VERIFY_(STATUS)

!EOS

if (DO_ISSM==1) then
! Add ISSM child gridcomp
ISSM = MAPL_AddChild(GC, NAME='ISSM', SS=IssmSetServices, RC=STATUS)
VERIFY_(STATUS)

! ISSM imports will be satisfied by landice
call MAPL_TerminateImport(GC, CHILD = ISSM, RC=STATUS)
VERIFY_(STATUS)
end if

! Set the Profiling timers
! ------------------------
Expand All @@ -1641,6 +1673,88 @@ end subroutine SetServices

!BOP


subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
! this is for ISSM to have access to to the tile locstream

! !ARGUMENTS:

type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
type(ESMF_State), intent(inout) :: IMPORT ! Import state
type(ESMF_State), intent(inout) :: EXPORT ! Export state
type(ESMF_Clock), intent(inout) :: CLOCK ! The clock
integer, optional, intent( out) :: RC ! Error code

! !DESCRIPTION: The Initialize method of the Landice Gridded Component.

!EOP

! ErrLog Variables

character(len=ESMF_MAXSTR) :: IAm
integer :: STATUS
character(len=ESMF_MAXSTR) :: COMP_NAME

! Local derived type aliases

type (MAPL_MetaComp ), pointer :: MAPL
type (MAPL_MetaComp ), pointer :: CHILD_MAPL
type (MAPL_LocStream ) :: LOCSTREAM
type (ESMF_Config ) :: CF
type (ESMF_GridComp ), pointer :: GCS(:)

integer :: I

!=============================================================================

! Begin...

! Get the target components name and set-up traceback handle.
! -----------------------------------------------------------

call ESMF_GridCompGet ( GC, name=COMP_NAME, RC=STATUS )
VERIFY_(STATUS)
Iam = trim(COMP_NAME) // "Initialize"

! Get my internal MAPL_Generic state
!-----------------------------------

call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS)
VERIFY_(STATUS)

call MAPL_TimerOn(MAPL,"INITIALIZE", RC=STATUS ); VERIFY_(STATUS)
call MAPL_TimerOn(MAPL,"TOTAL", RC=STATUS ); VERIFY_(STATUS)

! Get the landice tilegrid and the child components
!-----------------------------------------------

call MAPL_Get (MAPL, LOCSTREAM=LOCSTREAM, GCS=GCS, RC=STATUS )
VERIFY_(STATUS)

! Place the land tilegrid in the generic state of each child component
!---------------------------------------------------------------------

do I = 1, SIZE(GCS)
call MAPL_GetObjectFromGC( GCS(I), CHILD_MAPL, RC=STATUS )
VERIFY_(STATUS)
call MAPL_Set (CHILD_MAPL, LOCSTREAM=LOCSTREAM, RC=STATUS )
VERIFY_(STATUS)
end do

call MAPL_TimerOff(MAPL,"TOTAL", RC=STATUS ); VERIFY_(STATUS)

! Call Initialize for every Child
!--------------------------------

call MAPL_GenericInitialize ( GC, IMPORT, EXPORT, CLOCK, RC=STATUS)
VERIFY_(STATUS)

call MAPL_TimerOff(MAPL,"INITIALIZE", RC=STATUS ); VERIFY_(STATUS)

RETURN_(ESMF_SUCCESS)
end subroutine Initialize


! !IROUTINE: RUN1 -- First Run stage for the LandIce component

!INTERFACE:
Expand Down Expand Up @@ -2135,6 +2249,8 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )

!EOP

type (ESMF_State), pointer :: GIM(:) ! Import state ISSM


! ErrLog Variables

Expand All @@ -2155,6 +2271,7 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
type(MAPL_SunOrbit) :: ORBIT

integer :: LANDICE_OFFLINE
integer :: DO_ISSM ! ISSM flag
!=============================================================================

! Begin...
Expand All @@ -2172,6 +2289,13 @@ subroutine RUN2 ( GC, IMPORT, EXPORT, CLOCK, RC )
call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS)
VERIFY_(STATUS)

call MAPL_GetResource (MAPL, DO_ISSM, label='DO_ISSM:', DEFAULT=0, __RC__ )

! Get import state of child (ISSM)
if (DO_ISSM == 1) then
call MAPL_Get(MAPL, GIM=GIM, RC=STATUS )
VERIFY_(STATUS)
end if
! Start Total timer
!------------------

Expand Down Expand Up @@ -2227,8 +2351,13 @@ subroutine LANDICECORE(RC)
character(len=ESMF_MAXSTR) :: IAm
integer :: STATUS

! pointers to export

! pointer to child import (ISSM)
real, pointer, dimension(: ) :: ICESMB_ISSM


! pointers to export
real, pointer, dimension(: ) :: ICESMB
real, pointer, dimension(: ) :: EMISS
real, pointer, dimension(: ) :: ALBVF
real, pointer, dimension(: ) :: ALBVR
Expand Down Expand Up @@ -2460,7 +2589,6 @@ subroutine LANDICECORE(RC)
real, parameter :: LANDICEDEPTH_ = 0.07 ! water equiv depth of top layer
real, parameter :: LANDICECOND_ = 1.2 ! ice conductivity divided by depth of bottom layer
real, parameter :: LANDICETDEEP_ = 230. ! deep ice temperature

! Begin...
!----------

Expand Down Expand Up @@ -2542,7 +2670,7 @@ subroutine LANDICECORE(RC)

! Pointers to outputs
!--------------------

call MAPL_GetPointer(EXPORT,ICESMB , 'ICESMB' ,alloc=.true., RC=STATUS); VERIFY_(STATUS)
call MAPL_GetPointer(EXPORT,EMISS , 'EMIS' , RC=STATUS); VERIFY_(STATUS)
call MAPL_GetPointer(EXPORT,ALBVF , 'ALBVF' , RC=STATUS); VERIFY_(STATUS)
call MAPL_GetPointer(EXPORT,ALBVR , 'ALBVR' , RC=STATUS); VERIFY_(STATUS)
Expand Down Expand Up @@ -3241,8 +3369,20 @@ subroutine LANDICECORE(RC)
if(associated(ASNOW)) ASNOW = FR(:,SNOW)
if(associated(SMELT )) SMELT = PERC
if(associated(RAINRFZ )) RAINRFZ = FR(:,ICE) * RAINRF

if(associated(MELTWTR )) MELTWTR = MELTWTR + MLT


! Calculate surface mass balance (SMB) for ISSM
if(associated(ICESMB)) ICESMB = ACCUM - RUNOFF

! Set child (ISSM) SMB import pointer to landice export values
if (DO_ISSM == 1) then
call MAPL_GetPointer(GIM(ISSM), ICESMB_ISSM, 'ICESMB' , RC=STATUS)
end if

if(associated(ICESMB_ISSM)) ICESMB_ISSM(:) = ICESMB(:)

! Update snow and landice albedos to anticipate
! next radiation calculation
!-----------------------------------------------
Expand Down Expand Up @@ -3376,6 +3516,12 @@ subroutine LANDICECORE(RC)
WEBOT = WESNBOT / DT
end if

! Run ISSM (checks if ISSM_ALARM is ringing)
if (DO_ISSM==1) then
call MAPL_GenericRunChildren(GC, IMPORT, EXPORT, CLOCK, RC=STATUS)
VERIFY_(STATUS)
end if

if(allocated (MLT)) deallocate(MLT , STAT=STATUS); VERIFY_(STATUS)
if(allocated (DTS)) deallocate(DTS , STAT=STATUS); VERIFY_(STATUS)
if(allocated (DQS)) deallocate(DQS , STAT=STATUS); VERIFY_(STATUS)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
find_package (ISSM REQUIRED COMPONENTS Core)

esma_set_this ()

esma_add_library (${this}
SRCS GEOS_ISSMGridComp.F90
DEPENDENCIES MAPL GEOS_Shared GEOS_SurfaceShared ESMF::ESMF NetCDF::NetCDF_Fortran ISSM::Core
)

Loading
Loading