Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions interface/framework/assimilate_pdaf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ SUBROUTINE assimilate_pdaf()
USE mod_assimilation, & ! Variables for assimilation
ONLY: filtertype
USE mod_assimilation, ONLY: use_omi
#ifdef CLMSA
#ifdef CLMFIVE
USE PDAF_interfaces_module, & ! Check consistency of PDAF calls
ONLY: PDAFomi_assimilate_local, PDAFomi_assimilate_global, &
PDAFomi_assimilate_lenkf, PDAF_get_localfilter, &
PDAFomi_assimilate_enkf_nondiagR, &
PDAFomi_assimilate_global_nondiagR, PDAFomi_assimilate_local_nondiagR
#endif
#endif

IMPLICIT NONE
Expand Down Expand Up @@ -134,6 +136,7 @@ SUBROUTINE assimilate_pdaf()
! *********************************

OMI: IF (use_omi) THEN
#ifdef CLMSA
#ifdef CLMFIVE
CALL PDAF_get_localfilter(localfilter)

Expand Down Expand Up @@ -167,6 +170,7 @@ SUBROUTINE assimilate_pdaf()
END IF

END IF
#endif
#endif
ELSE OMI

Expand Down
2 changes: 2 additions & 0 deletions interface/framework/callback_obs_pdafomi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

! Author: Yorck Ewerdwalbesloh

#ifdef CLMSA
#ifdef CLMFIVE
SUBROUTINE init_dim_obs_pdafomi(step, dim_obs)

Expand Down Expand Up @@ -365,3 +366,4 @@ SUBROUTINE deallocate_obs_pdafomi()
END SUBROUTINE deallocate_obs_pdafomi

#endif
#endif
6 changes: 3 additions & 3 deletions interface/framework/init_pdaf_parse.F90
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ SUBROUTINE init_pdaf_parse()
use mod_assimilation,&
only: cradius_GRACE, sradius_GRACE, &
cradius_SM, sradius_SM
#ifdef CLMSA
#ifdef CLMFIVE
use obs_GRACE_pdafomi, only: rms_obs_GRACE
use obs_SM_pdafomi, only: rms_obs_SM
#endif
#if defined CLMSA
#ifdef CLMFIVE
use enkf_clm_mod, only: use_omi_model
#endif
#endif
Expand Down Expand Up @@ -99,6 +97,7 @@ SUBROUTINE init_pdaf_parse()
handle = "rms_obs" ! Assumed uniform RMS error of the observations
CALL parse(handle, rms_obs)

#ifdef CLMSA
#ifdef CLMFIVE
rms_obs_GRACE = rms_obs ! backward compatibility
handle = "rms_obs_GRACE" ! RMS error for GRACE observations
Expand All @@ -109,6 +108,7 @@ SUBROUTINE init_pdaf_parse()
! rms_obs_C = rms_obs ! backward compatibility
! handle = 'rms_obs_C' ! RMS error for C observations
! CALL parse(handle, rms_obs_C)
#endif
#endif

handle = "dim_obs" ! Number of observations
Expand Down
4 changes: 2 additions & 2 deletions interface/framework/mod_read_obs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ subroutine check(status)
end subroutine check


#ifdef CLMSA
#ifdef CLMFIVE
!> @author Anne Springer, adaptation for TSMP2 by Yorck Ewerdwalbesloh
!> @date 04.12.2023
Expand Down Expand Up @@ -888,7 +889,6 @@ subroutine check_n_observationfile_set_zero(fn,nn)
end if

end subroutine check_n_observationfile_set_zero
#endif

!> @author Yorck Ewerdwalbesloh
!> @date 29.10.2025
Expand Down Expand Up @@ -947,7 +947,6 @@ subroutine check_n_observationfile_next_type(fn, obs_type_str)
end subroutine check_n_observationfile_next_type


#ifdef CLMFIVE
!> @author Yorck Ewerdwalbesloh
!> @date 29.10.2025
!> @brief Update observation type for next assimilation cycle
Expand Down Expand Up @@ -1188,6 +1187,7 @@ subroutine domain_def_clm(lon_clmobs, lat_clmobs, dim_obs, &

end subroutine domain_def_clm
#endif
#endif


end module mod_read_obs
2 changes: 2 additions & 0 deletions interface/framework/next_observation_pdaf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ SUBROUTINE next_observation_pdaf(stepnow, nsteps, doexit, time)
USE mod_assimilation, ONLY: use_omi
use mod_read_obs, &
only: check_n_observationfile, check_n_observationfile_da_interval
#ifdef CLMSA
#ifdef CLMFIVE
use mod_read_obs, only: check_n_observationfile_set_zero
use mod_read_obs, only: check_n_observationfile_next_type
Expand All @@ -73,6 +74,7 @@ SUBROUTINE next_observation_pdaf(stepnow, nsteps, doexit, time)
use clm_varcon, only: set_averaging_to_zero
use clm_varcon, only: ispval
use enkf_clm_mod, only: clmupdate_tws
#endif
#endif
IMPLICIT NONE

Expand Down
2 changes: 2 additions & 0 deletions interface/framework/obs_GRACE_pdafomi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
!! * 2019-06 - Lars Nerger - Initial code
!! * Later revisions - see repository log
!!
#ifdef CLMSA
#ifdef CLMFIVE
MODULE obs_GRACE_pdafomi

Expand Down Expand Up @@ -1420,6 +1421,7 @@ end subroutine deallocate_obs_GRACE

END MODULE obs_GRACE_pdafomi
#endif
#endif



2 changes: 2 additions & 0 deletions interface/framework/obs_SM_pdafomi.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
! Author: Yorck Ewerdwalbesloh, adaptations of original implementations of TSMP2-PDAF interface for OMI framework


#ifdef CLMSA
#ifdef CLMFIVE
MODULE obs_SM_pdafomi

Expand Down Expand Up @@ -1403,3 +1404,4 @@ end subroutine deallocate_obs_SM

END MODULE obs_SM_pdafomi
#endif
#endif
6 changes: 6 additions & 0 deletions interface/framework/prepoststep_ens_pdaf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,18 @@ SUBROUTINE prepoststep_ens_pdaf(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, &
use mod_tsmp, &
only: tag_model_parflow, pf_statevecsize, nprocclm, model

#ifdef CLMSA
#ifdef CLMFIVE
USE mod_assimilation, ONLY: use_omi
#endif
#endif

IMPLICIT NONE

#ifdef CLMSA
#ifdef CLMFIVE
external :: deallocate_obs_pdafomi
#endif
#endif

! !ARGUMENTS:
Expand Down Expand Up @@ -275,6 +279,7 @@ SUBROUTINE prepoststep_ens_pdaf(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, &
firsttime = .FALSE.
end if

#ifdef CLMSA
#ifdef CLMFIVE
OMI: IF (use_omi) THEN ! deallocate observation arrays for second call of prepoststep
if (firsttime_omi) then
Expand All @@ -285,4 +290,5 @@ SUBROUTINE prepoststep_ens_pdaf(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, &
end if
end if OMI
#endif
#endif
END SUBROUTINE prepoststep_ens_pdaf
14 changes: 13 additions & 1 deletion interface/model/eclm/enkf_clm_5.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ subroutine clm_init(finname, pdaf_id, pdaf_max, mype) bind(C,name="clm_init")
!!<< TSMP PDAF comment out end
!!>> TSMP PDAF addition beginning
use, intrinsic :: iso_C_binding, only: c_char, c_int
use enkf_clm_mod, only: COMM_model_clm
#if defined CLMSA
use enkf_clm_mod, only: COMM_model_clm
use enkf_clm_mod, only: define_clm_statevec
#endif
use clm_varcon, only: averaging_var
Expand Down Expand Up @@ -108,10 +108,18 @@ subroutine clm_init(finname, pdaf_id, pdaf_max, mype) bind(C,name="clm_init")
!!>> TSMP PDAF comment out beginning
! call cime_pre_init1(esmf_logfile_option)
!!>> TSMP PDAF addition beginning
#if defined CLMSA
call cime_pre_init1(esmf_logfile_option, &
COMM_model_clm, &
pdaf_id=pdaf_id, &
pdaf_max=pdaf_max)
#endif

#if defined COUP_OAS_PFL
! EXPERIMENTAL: For eCLM-ParFlow-PDAF, the whole management of
! communicators has to be re-traced, see HPSCTerrSys/pdaf#82
call cime_pre_init1(esmf_logfile_option)
#endif
!!<< TSMP PDAF addition end

end_count = shr_sys_irtc(irtc_rate)
Expand Down Expand Up @@ -203,10 +211,12 @@ end subroutine clm_init
!--------------------------------------------------------------------------
subroutine clm_advance(ntstep, tstartcycle, mype) bind(C,name="clm_advance")
use cime_comp_mod, only : cime_run
#if defined CLMSA
use enkf_clm_mod, only : cleanup_clm_statevec
use enkf_clm_mod, only : define_clm_statevec
use enkf_clm_mod, only : set_clm_statevec
use enkf_clm_mod, only : use_omi_model
#endif
use, intrinsic :: iso_C_binding, only : c_int

implicit none
Expand Down Expand Up @@ -242,7 +252,9 @@ subroutine clm_finalize() bind(C,name="clm_finalize")

! use ESMF, only : ESMF_Initialize, ESMF_Finalize
use cime_comp_mod, only : cime_final
#if defined CLMSA
use enkf_clm_mod, only : cleanup_clm_statevec
#endif

implicit none

Expand Down
Loading