@@ -68,8 +68,8 @@ subroutine clm_init(finname, pdaf_id, pdaf_max, mype) bind(C,name="clm_init")
6868! !<< TSMP PDAF comment out end
6969! !>> TSMP PDAF addition beginning
7070 use , intrinsic :: iso_C_binding, only: c_char, c_int
71- use enkf_clm_mod, only: COMM_model_clm
7271#if defined CLMSA
72+ use enkf_clm_mod, only: COMM_model_clm
7373 use enkf_clm_mod, only: define_clm_statevec
7474#endif
7575 use clm_varcon, only: averaging_var
@@ -108,10 +108,18 @@ subroutine clm_init(finname, pdaf_id, pdaf_max, mype) bind(C,name="clm_init")
108108! !>> TSMP PDAF comment out beginning
109109 ! call cime_pre_init1(esmf_logfile_option)
110110! !>> TSMP PDAF addition beginning
111+ #if defined CLMSA
111112 call cime_pre_init1(esmf_logfile_option, &
112113 COMM_model_clm, &
113114 pdaf_id= pdaf_id, &
114115 pdaf_max= pdaf_max)
116+ #endif
117+
118+ #if defined COUP_OAS_PFL
119+ ! EXPERIMENTAL: For eCLM-ParFlow-PDAF, the whole management of
120+ ! communicators has to be re-traced, see HPSCTerrSys/pdaf#82
121+ call cime_pre_init1(esmf_logfile_option)
122+ #endif
115123! !<< TSMP PDAF addition end
116124
117125 end_count = shr_sys_irtc(irtc_rate)
@@ -203,10 +211,12 @@ end subroutine clm_init
203211!- -------------------------------------------------------------------------
204212subroutine clm_advance (ntstep , tstartcycle , mype ) bind(C,name= " clm_advance" )
205213 use cime_comp_mod, only : cime_run
214+ #if defined CLMSA
206215 use enkf_clm_mod, only : cleanup_clm_statevec
207216 use enkf_clm_mod, only : define_clm_statevec
208217 use enkf_clm_mod, only : set_clm_statevec
209218 use enkf_clm_mod, only : use_omi_model
219+ #endif
210220 use , intrinsic :: iso_C_binding, only : c_int
211221
212222 implicit none
@@ -242,7 +252,9 @@ subroutine clm_finalize() bind(C,name="clm_finalize")
242252
243253 ! use ESMF, only : ESMF_Initialize, ESMF_Finalize
244254 use cime_comp_mod, only : cime_final
255+ #if defined CLMSA
245256 use enkf_clm_mod, only : cleanup_clm_statevec
257+ #endif
246258
247259 implicit none
248260
0 commit comments