Skip to content

Commit 1d423b7

Browse files
committed
Communicate csoil and cplant from worker to master
This is required so we have the correct values for `csoil` and `cplant` in the restart file as reflected in the worker processes.
1 parent 3ec8a03 commit 1d423b7

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

src/offline/cable_mpicommon.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ MODULE cable_mpicommon
103103
! MPI: number of fields included in restart_t type for data
104104
! that is returned only for creating a restart file at the end of the run
105105
! MPI: gol124: canopy%rwater removed when Bernard ported to CABLE_r491
106-
INTEGER, PARAMETER :: nrestart = 15
106+
INTEGER, PARAMETER :: nrestart = 17
107107
INTEGER, PARAMETER :: nsumcasaflux = 62
108108
INTEGER, PARAMETER :: nsumcasapool = 40
109109
INTEGER, PARAMETER :: nclimate = 30

src/offline/cable_mpimaster.F90

+15-2
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ SUBROUTINE mpidrv_master (comm, trunk_sumbal, dels, koffset, kend, PLUME, CRU)
599599
! MPI: create type to send restart data back to the master
600600
! only if restart file is to be created
601601
IF(output%restart) THEN
602-
CALL master_restart_types (comm, canopy, air)
602+
CALL master_restart_types (comm, canopy, air, bgc)
603603
END IF
604604

605605
! CALL zero_sum_casa(sum_casapool, sum_casaflux)
@@ -7171,7 +7171,7 @@ END SUBROUTINE master_climate_types
71717171
!CLNEND SUBROUTINE master_casa_restart_types
71727172

71737173
! MPI: creates datatype handles to receive restart data from workers
7174-
SUBROUTINE master_restart_types (comm, canopy, air)
7174+
SUBROUTINE master_restart_types (comm, canopy, air, bgc)
71757175

71767176
USE mpi
71777177

@@ -7185,6 +7185,7 @@ SUBROUTINE master_restart_types (comm, canopy, air)
71857185

71867186
TYPE(canopy_type), INTENT(IN) :: canopy
71877187
TYPE (air_type),INTENT(IN) :: air
7188+
TYPE (bgc_pool_type), INTENT(IN) :: bgc
71887189
! TYPE (casa_pool), INTENT(INOUT) :: casapool
71897190
! TYPE (casa_flux), INTENT(INOUT) :: casaflux
71907191
! TYPE (casa_met), INTENT(INOUT) :: casamet
@@ -7246,6 +7247,18 @@ SUBROUTINE master_restart_types (comm, canopy, air)
72467247
& types(bidx), ierr)
72477248
blocks(bidx) = 1
72487249

7250+
bidx = bidx + 1
7251+
CALL MPI_Get_address (bgc%cplant(off,1), displs(bidx), ierr)
7252+
CALL MPI_Type_create_hvector (ncp, r1len, r1stride, MPI_BYTE, &
7253+
& types(bidx), ierr)
7254+
blocks(bidx) = 1
7255+
7256+
bidx = bidx + 1
7257+
CALL MPI_Get_address (bgc%csoil(off,1), displs(bidx), ierr)
7258+
CALL MPI_Type_create_hvector (ncs, r1len, r1stride, MPI_BYTE, &
7259+
& types(bidx), ierr)
7260+
blocks(bidx) = 1
7261+
72497262
last2d = bidx
72507263

72517264
! ------------- 1D vectors -------------

src/offline/cable_mpiworker.F90

+11-2
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ SUBROUTINE mpidrv_worker (comm)
365365
! only if restart file is to be created
366366
IF(output%restart) THEN
367367

368-
CALL worker_restart_type (comm, canopy, air)
368+
CALL worker_restart_type (comm, canopy, air, bgc)
369369

370370
END IF
371371

@@ -6354,7 +6354,7 @@ END SUBROUTINE worker_climate_types
63546354
! MPI: creates restart_t type to send to the master the fields
63556355
! that are only required for the restart file but not included in the
63566356
! results sent at the end of each time step
6357-
SUBROUTINE worker_restart_type (comm, canopy, air)
6357+
SUBROUTINE worker_restart_type (comm, canopy, air, bgc)
63586358

63596359
USE mpi
63606360

@@ -6366,6 +6366,7 @@ SUBROUTINE worker_restart_type (comm, canopy, air)
63666366

63676367
TYPE(canopy_type), INTENT(IN) :: canopy
63686368
TYPE (air_type),INTENT(IN) :: air
6369+
TYPE (bgc_pool_type), INTENT(IN) :: bgc
63696370

63706371
! MPI: temp arrays for marshalling all types into a struct
63716372
INTEGER, ALLOCATABLE, DIMENSION(:) :: blocks
@@ -6408,6 +6409,14 @@ SUBROUTINE worker_restart_type (comm, canopy, air)
64086409
! MPI: gol124: changed to r1 when Bernard ported to CABLE_r491
64096410
blocks(bidx) = r1len * ms
64106411

6412+
bidx = bidx + 1
6413+
CALL MPI_Get_address (bgc%cplant(off,1), displs(bidx), ierr)
6414+
blocks(bidx) = r1len * ncp
6415+
6416+
bidx = bidx + 1
6417+
CALL MPI_Get_address (bgc%csoil(off,1), displs(bidx), ierr)
6418+
blocks(bidx) = r1len * ncs
6419+
64116420
bidx = bidx + 1
64126421
CALL MPI_Get_address (canopy%cduv(off), displs(bidx), ierr)
64136422
blocks(bidx) = r1len

0 commit comments

Comments
 (0)