From 3af3e948ea67a9213bd7c4a77f3e5ceb36cb7907 Mon Sep 17 00:00:00 2001 From: Claire Carouge Date: Wed, 27 Nov 2024 12:11:29 +1100 Subject: [PATCH 1/3] Initialise _vec parameters to default values. --- src/offline/cable_parameters.F90 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/offline/cable_parameters.F90 b/src/offline/cable_parameters.F90 index 87aa1b2a5..c8d569209 100644 --- a/src/offline/cable_parameters.F90 +++ b/src/offline/cable_parameters.F90 @@ -1380,6 +1380,11 @@ SUBROUTINE write_default_params(met, air, ssnow, veg, bgc, & incnsd(landpt(e)%ilon, landpt(e)%ilat) !possibly heterogeneous soil properties + ! Set all heterogeneous soil properties to their equivalent uniform values. + ! These values can be overridden later on by input values in files. + ! `smpc_vec` and `wbc_vec` are only used in the ground water and have no + ! equivalent in the uniform parameters (non _vec). So we do not initialise + ! these variables when we are not using the ground water scheme. DO klev=1,ms soil%clay_vec(landpt(e)%cstart:landpt(e)%cend,klev) = & @@ -1400,6 +1405,15 @@ SUBROUTINE write_default_params(met, air, ssnow, veg, bgc, & soil%watr(landpt(e)%cstart:landpt(e)%cend,klev) = & REAL(inWatr(landpt(e)%ilon, landpt(e)%ilat),r_2) + soil%zse_vec(landpt(e)%cstart:landpt(e)%cend,klev) = & + REAL(soil%zse(landpt(e)%cstart:landpt(e)%cend), r_2) + + soil%css_vec(landpt(e)%cstart:landpt(e)%cend, klev) = & + REAL(incss(landpt(e)%ilon, landpt(e)%ilat), r_2) + + soil%cnsd_vec(landpt(e)%cstart:landpt(e)%cend, klev) = & + REAL(incnsd(landpt(e)%ilon, landpt(e)%ilat), r_2) + END DO !Aquifer properties same as bottom soil layer for now From d5232d75d876e1f0ed49d766584f78b6b416d29b Mon Sep 17 00:00:00 2001 From: Claire Carouge Date: Wed, 27 Nov 2024 12:11:29 +1100 Subject: [PATCH 2/3] Remove zeroing out soil%watr since used in total_soil_conductivity() --- src/offline/cable_parameters.F90 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/offline/cable_parameters.F90 b/src/offline/cable_parameters.F90 index c8d569209..0c553c89b 100644 --- a/src/offline/cable_parameters.F90 +++ b/src/offline/cable_parameters.F90 @@ -2161,12 +2161,6 @@ SUBROUTINE derived_parameters(soil, sum_flux, bal, ssnow, veg, rough) if ((gw_params%MaxSatFraction .lt. -9999.9) .and. (mp .eq. 1)) soil%slope(:) = 0.01 - ELSE !not gw model - - !These are not used when gw_model == false - soil%watr = 0._r_2 - soil%GWwatr = 0._r_2 - END IF IF (cable_user%soil_thermal_fix) then From c2b67c768b7bfe6f3bb3a77a9e8d8a94bc8ee96c Mon Sep 17 00:00:00 2001 From: Claire Carouge Date: Wed, 27 Nov 2024 12:11:30 +1100 Subject: [PATCH 3/3] Add forgotten *_vec to the mpi code --- src/offline/cable_mpicommon.F90 | 2 +- src/offline/cable_mpimaster.F90 | 60 +++++++++++++++++++++++++++++++++ src/offline/cable_mpiworker.F90 | 40 ++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) diff --git a/src/offline/cable_mpicommon.F90 b/src/offline/cable_mpicommon.F90 index ddd0e5785..f16ee052e 100644 --- a/src/offline/cable_mpicommon.F90 +++ b/src/offline/cable_mpicommon.F90 @@ -29,7 +29,7 @@ MODULE cable_mpicommon ! base number of input fields: must correspond to CALLS to ! MPI_address (field ) in *_mpimaster/ *_mpiworker - INTEGER, PARAMETER :: nparam = 330 + INTEGER, PARAMETER :: nparam = 340 ! MPI: extra params sent only if nsoilparmnew is true INTEGER, PARAMETER :: nsoilnew = 1 diff --git a/src/offline/cable_mpimaster.F90 b/src/offline/cable_mpimaster.F90 index 5fcd013d5..1302d5178 100644 --- a/src/offline/cable_mpimaster.F90 +++ b/src/offline/cable_mpimaster.F90 @@ -3183,6 +3183,66 @@ SUBROUTINE master_cable_params (comm,met,air,ssnow,veg,bgc,soil,canopy,& & types(bidx), ierr) blen(bidx) = 1 + bidx = bidx + 1 + CALL MPI_Get_address (soil%zse_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%css_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%cnsd_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%clay_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%sand_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%silt_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%org_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%rhosoil_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%smpc_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + + bidx = bidx + 1 + CALL MPI_Get_address (soil%wbc_vec(off,1), displs(bidx), ierr) + CALL MPI_Type_create_hvector (ms, r2len, r2stride, MPI_BYTE, & + & types(bidx), ierr) + blen(bidx) = 1 + !1D bidx = bidx + 1 diff --git a/src/offline/cable_mpiworker.F90 b/src/offline/cable_mpiworker.F90 index 9f901a553..dfaf7a126 100644 --- a/src/offline/cable_mpiworker.F90 +++ b/src/offline/cable_mpiworker.F90 @@ -2263,6 +2263,46 @@ SUBROUTINE worker_cable_params (comm,met,air,ssnow,veg,bgc,soil,canopy,& bidx = bidx + 1 CALL MPI_Get_address (soil%sfc_vec, displs(bidx), ierr) blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%zse_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%css_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%cnsd_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%clay_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%sand_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%silt_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%org_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%rhosoil_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%smpc_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len + + bidx = bidx + 1 + CALL MPI_Get_address (soil%wbc_vec, displs(bidx), ierr) + blen(bidx) = ms * r2len !1d