Skip to content

Commit 19bd9b1

Browse files
authored
Merge pull request #246 from GEOS-ESM/develop
GitFlow: Merge Develop into Main for release
2 parents bc9f2c1 + 7d31e39 commit 19bd9b1

21 files changed

+327
-236
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2.1
22

33
# Anchors to prevent forgetting to update a version
4-
baselibs_version: &baselibs_version v7.7.0
5-
bcs_version: &bcs_version v10.25.0
4+
baselibs_version: &baselibs_version v7.13.0
5+
bcs_version: &bcs_version v11.00.0
66

77

88
orbs:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ if (CRAY_POINTER)
151151
set_target_properties (${this} PROPERTIES COMPILE_FLAGS ${CRAY_POINTER})
152152
endif()
153153

154-
add_definitions (-DSPMD -DMAPL_MODE)
154+
add_definitions (-DSPMD -DMAPL_MODE -DFVREGRID_MAPL_MODE)
155155

156156
foreach(flag ${tmp})
157157
target_compile_options (${this} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:${flag}>)

FV_StateMod.F90

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module FV_StateMod
4141
#ifdef RUN_GTFV3
4242
use ieee_exceptions, only: ieee_get_halting_mode, ieee_set_halting_mode, ieee_all
4343
use geos_gtfv3_interface_mod, only: geos_gtfv3_interface_f
44+
use geos_gtfv3_interface_mod, only: geos_gtfv3_interface_f_init, geos_gtfv3_interface_f_finalize
4445
#endif
4546

4647
implicit none
@@ -819,6 +820,11 @@ subroutine FV_InitState (STATE, CLOCK, INTERNAL, IMPORT, GC, RC)
819820
integer :: tile_in
820821
integer :: gid, masterproc
821822

823+
#ifdef RUN_GTFV3
824+
logical :: halting_mode(5)
825+
integer :: comm
826+
#endif
827+
822828
! BEGIN
823829

824830
! Retrieve the pointer to the state
@@ -1143,6 +1149,22 @@ subroutine FV_InitState (STATE, CLOCK, INTERNAL, IMPORT, GC, RC)
11431149
call MAPL_MemUtilsWrite(VM, 'FV_StateMod: FV Initialize', RC=STATUS )
11441150
VERIFY_(STATUS)
11451151

1152+
#ifdef RUN_GTFV3
1153+
if (run_gtfv3 /= 0) then
1154+
! call ESMF_VMGetCurrent(VM, _RC)
1155+
call ESMF_VMGet(VM, mpiCommunicator=comm, _RC)
1156+
! A workaround to the issue of SIGFPE abort during importing of numpy, is to
1157+
! disable trapping of FPEs temporarily, call the Python interface and resume trapping
1158+
call ieee_get_halting_mode(ieee_all, halting_mode)
1159+
call ieee_set_halting_mode(ieee_all, .false.)
1160+
call geos_gtfv3_interface_f_init( &
1161+
comm, &
1162+
FV_Atm(1)%npx, FV_Atm(1)%npy, FV_Atm(1)%npz, FV_Atm(1)%flagstruct%ntiles, &
1163+
IS, IE, JS, JE, ISD, IED, JSD, JED, real(STATE%DT), 7)
1164+
call ieee_set_halting_mode(ieee_all, halting_mode)
1165+
end if
1166+
#endif
1167+
11461168
RETURN_(ESMF_SUCCESS)
11471169

11481170
end subroutine FV_InitState
@@ -1238,15 +1260,13 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
12381260
#ifdef RUN_GTFV3
12391261
type(ESMF_VM) :: vm
12401262
integer :: comm, rank, mpierr
1241-
logical :: halting_mode(5)
12421263
real :: start, finish
12431264
#endif
12441265

12451266
! Begin
12461267

12471268
#ifdef RUN_GTFV3
1248-
! MPI communicator
1249-
call ESMF_VMGetCurrent(vm, rc=status)
1269+
call ESMF_VMGetCurrent(vm, rc=status) ! pchakrab: replace with ESMF_GridCompGet(gc, VM=VM, _RC)
12501270
call ESMF_VMGet(vm, mpiCommunicator=comm)
12511271
call MPI_Comm_rank(comm, rank, mpierr)
12521272
#endif
@@ -1992,11 +2012,6 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
19922012
call cpu_time(finish)
19932013
if (rank == 0) print *, '0: fv_dynamics: time taken = ', finish - start, 's'
19942014
else
1995-
! A workaround to the issue of SIGFPE abort during importing of numpy, is to
1996-
! disable trapping of floating point exceptions temporarily, call the interface
1997-
! to the Python function and resume trapping
1998-
call ieee_get_halting_mode(ieee_all, halting_mode)
1999-
call ieee_set_halting_mode(ieee_all, .false.)
20002015
call cpu_time(start)
20012016
call geos_gtfv3_interface_f( &
20022017
comm, &
@@ -2016,7 +2031,6 @@ subroutine FV_Run (STATE, EXPORT, CLOCK, GC, RC)
20162031
! input/output
20172032
FV_Atm(1)%mfx, FV_Atm(1)%mfy, FV_Atm(1)%cx, FV_Atm(1)%cy, FV_Atm(1)%diss_est)
20182033
call cpu_time(finish)
2019-
call ieee_set_halting_mode(ieee_all, halting_mode)
20202034
print *, rank, ', geos_gtfv3_interface_f: time taken = ', finish - start, 's'
20212035
end if
20222036
#endif
@@ -2402,32 +2416,21 @@ end subroutine FV_DA_Incs
24022416

24032417
subroutine FV_Finalize (STATE)
24042418

2405-
use fv_control_mod, only : fv_end
2406-
2407-
type (T_FVDYCORE_STATE),pointer :: STATE
2408-
2409-
integer isc, iec, jsc, jec
2410-
integer isd, ied, jsd, jed
2411-
integer npz, ng
2419+
use fv_control_mod, only : fv_end
24122420

2413-
isc = FV_Atm(1)%bd%isc
2414-
iec = FV_Atm(1)%bd%iec
2415-
jsc = FV_Atm(1)%bd%jsc
2416-
jec = FV_Atm(1)%bd%jec
2417-
isd = FV_Atm(1)%bd%isd
2418-
ied = FV_Atm(1)%bd%ied
2419-
jsd = FV_Atm(1)%bd%jsd
2420-
jed = FV_Atm(1)%bd%jed
2421-
npz = FV_Atm(1)%npz
2422-
ng = FV_Atm(1)%ng
2421+
type (T_FVDYCORE_STATE),pointer :: STATE
24232422

2424-
if (DEBUG) call debug_fv_state('FV_Finalize',STATE)
2423+
if (DEBUG) call debug_fv_state('FV_Finalize',STATE)
24252424

2426-
call timing_off('TOTAL')
2427-
call fv_end(FV_Atm, grids_on_this_pe ,.false.)
2425+
call timing_off('TOTAL')
2426+
call fv_end(FV_Atm, grids_on_this_pe ,.false.)
24282427

24292428
#if defined( MAPL_MODE )
2430-
! call ESMF_GridDestroy (STATE%GRID%GRID)
2429+
! call ESMF_GridDestroy (STATE%GRID%GRID)
2430+
#endif
2431+
2432+
#ifdef RUN_GTFV3
2433+
if (run_gtfv3 /= 0) call geos_gtfv3_interface_f_finalize()
24312434
#endif
24322435

24332436
end subroutine FV_Finalize

StandAlone_AdvCore.F90

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ program StandAlone_AdvCore
1616
character(*), parameter :: IAM = __FILE__
1717

1818
type (MAPL_Cap) :: cap
19-
type (MAPL_FlapCLI) :: cli
19+
type (MAPL_FargparseCLI) :: cli
2020
type (MAPL_CapOptions) :: cap_options
2121
integer :: status
2222

23-
cli = MAPL_FlapCLI( &
24-
description = 'FV Standalone dvCore', &
25-
authors = 'S.J. Lin, R. Rood, W. Putman')
23+
cli = MAPL_FargparseCLI()
2624

2725
cap_options = MAPL_CapOptions(cli)
2826
cap = MAPL_Cap('Standalone FV3 AdvCore', SetServices, cap_options=cap_options)

StandAlone_DynAdvCore.F90

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ program StandAlone_DynAdvCore
1616
character(*), parameter :: IAM = __FILE__
1717

1818
type (MAPL_Cap) :: cap
19-
type (MAPL_FlapCLI) :: cli
19+
type (MAPL_FargparseCLI) :: cli
2020
type (MAPL_CapOptions) :: cap_options
2121
integer :: status
2222

23-
cli = MAPL_FlapCLI( &
24-
description = 'FV Standalone DyAdvCore', &
25-
authors = 'S.J. Lin, R. Rood, W. Putman')
23+
cli = MAPL_FargparseCLI()
2624
cap_options = MAPL_CapOptions(cli)
2725
cap = MAPL_Cap('Standalone FV3 DynAdvCore', SetServices, cap_options = cap_options)
2826
call cap%run(_RC)

StandAlone_FV3_Dycore.F90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ program StandAlone_FV3_Dycore
1515
character(*), parameter :: IAM = __FILE__
1616

1717
type (MAPL_Cap) :: cap
18-
type (MAPL_FlapCLI) :: cli
18+
type (MAPL_FargparseCLI) :: cli
1919
type (MAPL_CapOptions) :: cap_options
2020
integer :: status
2121

22-
cli = MAPL_FlapCLI(description = 'FV Standalone Dycore',&
23-
authors = 'S.J. Lin, R. Rood, W. Putman')
22+
cli = MAPL_FargparseCLI()
2423
cap_options = MAPL_CapOptions(cli)
2524
cap = MAPL_Cap('GCM', SetServices, cap_options = cap_options)
2625
call cap%run(_RC)

0 commit comments

Comments
 (0)