From b9d73072888a780487b56a637502240d7342785a Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Thu, 11 Jun 2026 23:27:31 +0200 Subject: [PATCH 1/4] reduce log-file output avoid spamming in log file, thereby improve performance --- src/clm5/biogeophys/BalanceCheckMod.F90 | 4 ++++ src/clm5/main/lnd2atmMod.F90 | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/clm5/biogeophys/BalanceCheckMod.F90 b/src/clm5/biogeophys/BalanceCheckMod.F90 index 7ca412955a..a664391d99 100644 --- a/src/clm5/biogeophys/BalanceCheckMod.F90 +++ b/src/clm5/biogeophys/BalanceCheckMod.F90 @@ -356,6 +356,7 @@ subroutine BalanceCheck( bounds, & end do found = .false. +#ifndef COUP_OAS_PFL do c = bounds%begc, bounds%endc if (abs(errh2o(c)) > 1.e-9_r8) then found = .true. @@ -446,6 +447,7 @@ subroutine BalanceCheck( bounds, & #endif end if end if +#endif ! Snow balance check @@ -691,6 +693,7 @@ subroutine BalanceCheck( bounds, & ! Soil energy balance check +#ifndef COUP_OAS_PFL found = .false. do c = bounds%begc,bounds%endc if (col%active(c)) then @@ -714,6 +717,7 @@ subroutine BalanceCheck( bounds, & end if #endif end if +#endif end associate diff --git a/src/clm5/main/lnd2atmMod.F90 b/src/clm5/main/lnd2atmMod.F90 index 7d1d68602d..341235029c 100644 --- a/src/clm5/main/lnd2atmMod.F90 +++ b/src/clm5/main/lnd2atmMod.F90 @@ -472,7 +472,7 @@ subroutine lnd2atm(bounds, & do j = 1, nlevsoi if (lnd2atm_inst%qflx_parflow_grc(g,j) == spval) then lnd2atm_inst%qflx_parflow_grc(g,j) = 0._r8 - write(iulog,*)'WARNING: qflx_parflow_grc is nan at grid point ',g,' level',j,' replaced with 0.' +! write(iulog,*)'WARNING: qflx_parflow_grc is nan at grid point ',g,' level',j,' replaced with 0.' end if end do enddo From 1206290d670a07961e45d00a7de8a63c688f66a4 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 11 Aug 2026 18:07:12 +0200 Subject: [PATCH 2/4] eCLM-ParFlow: account for soil ice when receiving ParFlow water content - ParFlow has no ice phase, thus pfl_h2osoi_liq is the total soil water. Cap the diagnosed ice content and take the remaining as liquid. --- src/clm5/biogeophys/SoilWaterMovementMod.F90 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/clm5/biogeophys/SoilWaterMovementMod.F90 b/src/clm5/biogeophys/SoilWaterMovementMod.F90 index f86212882a..2ab4fc48c7 100644 --- a/src/clm5/biogeophys/SoilWaterMovementMod.F90 +++ b/src/clm5/biogeophys/SoilWaterMovementMod.F90 @@ -1487,21 +1487,24 @@ subroutine soilwater_parflow(bounds, num_hydrologyc, & integer :: c,j,fc ! indices associate(& - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) + smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] + h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) + h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) pfl_h2osoi_liq => waterstate_inst%pfl_h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] ParFlow soil water (mm) pfl_psi => waterstate_inst%pfl_psi_col & ! Input: [real(r8) (:,:) ] ParFlow pressure head (mm) ) ! end associate statement - ! COUP_OAS_PFL - ! TODO + ! Exchange of soil water and pressure head between ParFlow and eCLM + ! ParFlow has no ice phase, so that the received water it the total water content. + ! Keep the ice what PhaseChanged diagnosed earlier in the time step. do fc = 1, num_hydrologyc c = filter_hydrologyc(fc) do j = 1, nlevgrnd - h2osoi_liq(c,j) = pfl_h2osoi_liq(c,j) + h2osoi_ice(c,j) = min(h2osoi_ice(c,j), pfl_h2osoi_liq(c,j)) + h2osoi_liq(c,j) = max(0._r8, pfl_h2osoi_liq(c,j) - h2osoi_ice(c,j)) if (pfl_psi(c,j) <= 0) then smp_l(c,j) = max(smpmin(c), pfl_psi(c,j)) end if From 477ef4b8c74ed3a76ef931a8c040870c5ba4e7d3 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Mon, 17 Aug 2026 12:13:30 +0200 Subject: [PATCH 3/4] Revert "reduce log-file output" This reverts commit b9d73072888a780487b56a637502240d7342785a. --- src/clm5/biogeophys/BalanceCheckMod.F90 | 4 ---- src/clm5/main/lnd2atmMod.F90 | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/clm5/biogeophys/BalanceCheckMod.F90 b/src/clm5/biogeophys/BalanceCheckMod.F90 index a664391d99..7ca412955a 100644 --- a/src/clm5/biogeophys/BalanceCheckMod.F90 +++ b/src/clm5/biogeophys/BalanceCheckMod.F90 @@ -356,7 +356,6 @@ subroutine BalanceCheck( bounds, & end do found = .false. -#ifndef COUP_OAS_PFL do c = bounds%begc, bounds%endc if (abs(errh2o(c)) > 1.e-9_r8) then found = .true. @@ -447,7 +446,6 @@ subroutine BalanceCheck( bounds, & #endif end if end if -#endif ! Snow balance check @@ -693,7 +691,6 @@ subroutine BalanceCheck( bounds, & ! Soil energy balance check -#ifndef COUP_OAS_PFL found = .false. do c = bounds%begc,bounds%endc if (col%active(c)) then @@ -717,7 +714,6 @@ subroutine BalanceCheck( bounds, & end if #endif end if -#endif end associate diff --git a/src/clm5/main/lnd2atmMod.F90 b/src/clm5/main/lnd2atmMod.F90 index 341235029c..7d1d68602d 100644 --- a/src/clm5/main/lnd2atmMod.F90 +++ b/src/clm5/main/lnd2atmMod.F90 @@ -472,7 +472,7 @@ subroutine lnd2atm(bounds, & do j = 1, nlevsoi if (lnd2atm_inst%qflx_parflow_grc(g,j) == spval) then lnd2atm_inst%qflx_parflow_grc(g,j) = 0._r8 -! write(iulog,*)'WARNING: qflx_parflow_grc is nan at grid point ',g,' level',j,' replaced with 0.' + write(iulog,*)'WARNING: qflx_parflow_grc is nan at grid point ',g,' level',j,' replaced with 0.' end if end do enddo From 31e938a87674610e9671740298d7bfd1f8224764 Mon Sep 17 00:00:00 2001 From: Stefan Poll Date: Tue, 1 Sep 2026 13:21:29 +0200 Subject: [PATCH 4/4] eCLM-ParFlow: add in-code comment for soil ice partitioning --- src/clm5/biogeophys/SoilWaterMovementMod.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/clm5/biogeophys/SoilWaterMovementMod.F90 b/src/clm5/biogeophys/SoilWaterMovementMod.F90 index 2ab4fc48c7..f68d9a041b 100644 --- a/src/clm5/biogeophys/SoilWaterMovementMod.F90 +++ b/src/clm5/biogeophys/SoilWaterMovementMod.F90 @@ -1487,7 +1487,7 @@ subroutine soilwater_parflow(bounds, num_hydrologyc, & integer :: c,j,fc ! indices associate(& - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] + smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) @@ -1498,7 +1498,8 @@ subroutine soilwater_parflow(bounds, num_hydrologyc, & ! Exchange of soil water and pressure head between ParFlow and eCLM ! ParFlow has no ice phase, so that the received water it the total water content. - ! Keep the ice what PhaseChanged diagnosed earlier in the time step. + ! Keep the ice what PhaseChanged diagnosed earlier in the time step and + ! attribute the remainder to liquid, so that liq and ice matches the received total. do fc = 1, num_hydrologyc c = filter_hydrologyc(fc)