Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ff870eb
Snow-DA: initial implementation from CLM5-PDAF
jjokella Nov 8, 2024
867d715
Snow-DA: Add MPI-barrier after `integrate_tsmp`
jjokella Feb 7, 2025
c9fb4f6
Update enkf_clm_mod_5.F90 (#265)
jjokella Mar 4, 2025
6dd9f7f
clmupdate_snow.eq.3: snow depth observations, h2osoi_ice in state
jjokella Mar 14, 2025
8fcf62a
Merge branch 'tsmp-pdaf-patched' into tsmp-pdaf-patched-snow
jjokella Mar 14, 2025
ddad839
snow: update eclm
jjokella Mar 14, 2025
8654093
clmupdate_snow.eq.3: snow_depth and h2osno in state vector
jjokella Mar 14, 2025
7c1a2c0
Snow-DA: Re-introduce standard "point-obs" observation operator
jjokella Mar 17, 2025
12ce4ff
Snow-DA: Refactoring to prepare for PR into `master`
jjokella Mar 17, 2025
dc4f8c1
Snow-DA: adapt dimension of `rsnow`, `nsnow`
jjokella Mar 17, 2025
33252ad
Snow-DA: try to fix update conditions
jjokella Mar 17, 2025
f1c1145
Snow-DA: debug output of `h2osoi_ice`
jjokella Mar 17, 2025
b0385e4
Snow-DA: remove experimental barrier
jjokella Mar 18, 2025
62e0381
Snow-DA: No layer variable used for setting `obs_index_p`
jjokella Mar 18, 2025
e9113fe
Snow-DA: Default for `CLM:update_snow_repartitioning` to `3`
jjokella Mar 18, 2025
96a895f
Snow-DA: CLM3.5 variable declarations and error messages
jjokella Mar 18, 2025
b3f2337
Snow-DA: bugfix repartitioning condition
jjokella Mar 21, 2025
a75d841
Snow-DA: bugfix repartitioning condition II
jjokella Mar 21, 2025
1d16b75
Snow-DA: numerically better check for `rsnow.ne.0.0`
jjokella Mar 21, 2025
2dde41f
Snow-DA: repartitioning function only for `clmupdate_snow.eq.1,2`
jjokella Mar 21, 2025
d2ae20d
Snow-DA: rename `incr_h2osno` to `incr_sno`
jjokella Mar 21, 2025
37a10d0
Snow-DA: Refactor Snow-DA
jjokella Mar 27, 2025
e4101a3
Snow-DA: Introduce `CLM:update_snow.eq.4`
jjokella Mar 27, 2025
664eed3
Snow-DA: `CLM:update_snow=5,6,7`
jjokella Mar 28, 2025
3a4fda7
Snow-DA: Fix error stop condition
jjokella Mar 28, 2025
6a87e07
Snow-DA: No SWE/SD update for `CLM:update_snow >= 3`
jjokella Mar 28, 2025
81b1a6a
Snow-DA: Remove difference-check for increment-updates
jjokella Mar 28, 2025
306688b
Snow-DA: `CLM:update_snow=4..7`, check both SD and SWE
jjokella Mar 28, 2025
f435467
Snow-DA: Rule out very small SD/SWE for updates
jjokella Mar 28, 2025
8358893
Snow-DA: Bugfix for `CLM:update_snow=7`
jjokella Mar 29, 2025
364d6e9
Merge branch 'tsmp-pdaf-patched' into tsmp-pdaf-patched-snow
jjokella Oct 31, 2025
4b0c24f
fortitude style updates
jjokella Oct 31, 2025
ddbc17d
fortitude style updates II
jjokella Oct 31, 2025
25c1b58
compilation errors: re-introduce necessary declarations
jjokella Oct 31, 2025
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
8 changes: 7 additions & 1 deletion interface/framework/init_dim_obs_f_pdaf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ SUBROUTINE init_dim_obs_f_pdaf(step, dim_obs_f)
USE enkf_clm_mod, only: domain_def_clm
USE enkf_clm_mod, only: get_interp_idx
use enkf_clm_mod, only: clmstatevec_allcol
use enkf_clm_mod, only: clmupdate_snow
!hcp end
#endif
#endif
Expand Down Expand Up @@ -986,7 +987,12 @@ SUBROUTINE init_dim_obs_f_pdaf(step, dim_obs_f)
if(clmstatevec_only_active==1) then
obs_index_p(cnt) = state_clm2pdaf_p(c,clmobs_layer(i))
else
obs_index_p(cnt) = g-begg+1 + ((endg-begg+1) * (clmobs_layer(i)-1))
if(clmupdate_snow/=0) then
! Snow-DA: no layer in state vector variables
obs_index_p(cnt) = g-begg+1
else
obs_index_p(cnt) = g-begg+1 + ((endg-begg+1) * (clmobs_layer(i)-1))
end if
end if
#else
obs_index_p(cnt) = g-begg+1 + ((endg-begg+1) * (clmobs_layer(i)-1))
Expand Down
8 changes: 7 additions & 1 deletion interface/framework/init_dim_obs_pdaf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ SUBROUTINE init_dim_obs_pdaf(step, dim_obs_p)
USE enkf_clm_mod, only: domain_def_clm
USE enkf_clm_mod, only: get_interp_idx
use enkf_clm_mod, only: clmstatevec_allcol
use enkf_clm_mod, only: clmupdate_snow
!hcp end
#endif
#endif
Expand Down Expand Up @@ -979,7 +980,12 @@ SUBROUTINE init_dim_obs_pdaf(step, dim_obs_p)
if(clmstatevec_only_active==1) then
obs_index_p(cnt) = state_clm2pdaf_p(c,clmobs_layer(i))
else
obs_index_p(cnt) = g-begg+1 + ((endg-begg+1) * (clmobs_layer(i)-1))
if(clmupdate_snow/=0) then
! Snow-DA: no layer in state vector variables
obs_index_p(cnt) = g-begg+1
else
obs_index_p(cnt) = g-begg+1 + ((endg-begg+1) * (clmobs_layer(i)-1))
end if
end if
#else
obs_index_p(cnt) = g-begg+1 + ((endg-begg+1) * (clmobs_layer(i)-1))
Expand Down
38 changes: 38 additions & 0 deletions interface/model/clm3_5/enkf_clm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ module enkf_clm_mod
integer(c_int),bind(C,name="clmupdate_swc") :: clmupdate_swc
integer(c_int),bind(C,name="clmupdate_T") :: clmupdate_T ! by hcp
integer(c_int),bind(C,name="clmupdate_texture") :: clmupdate_texture
integer(c_int),bind(C,name="clmupdate_snow") :: clmupdate_snow
integer(c_int),bind(C,name="clmupdate_snow_repartitioning") :: clmupdate_snow_repartitioning
integer(c_int),bind(C,name="clmprint_swc") :: clmprint_swc
#endif
integer(c_int),bind(C,name="clmprint_et") :: clmprint_et
Expand Down Expand Up @@ -148,6 +150,25 @@ subroutine define_clm_statevec(mype)
error stop "Not implemented: clmupdate_texture.eq.2"
endif

! Snow assimilation
! Case 1: Assimilation of snow depth : allocated 1 per column in CLM5
! But observations and history file 1 per grid cell and therefore statevecsize 1 per grid cell
! Case 2: Assimilation of snow water equivalent same as above
if(clmupdate_snow.eq.1 .or. clmupdate_snow.eq.2) then
error stop "Not implemented: clmupdate_snow.eq.1 or clmupdate_snow.eq.1"
endif
! Case 3: Assimilation of snow depth: Snow depth and snow water
! equivalent in the state vector. Update of h2osoi_ice
if(clmupdate_snow.eq.3) then
error stop "Not implemented: clmupdate_snow.eq.3"
endif
! Case 4: Assimilation of snow depth: Snow depth and snow water
! equivalent in the state vector. Update of h2osoi_ice, h2osoi_liq
! and dz
if(clmupdate_snow.eq.4) then
error stop "Not implemented: clmupdate_snow.eq.4"
endif

!hcp LST DA
if(clmupdate_T.eq.1) then
clm_varsize = endg-begg+1
Expand Down Expand Up @@ -288,6 +309,14 @@ subroutine set_clm_statevec(tstartcycle, mype)
end do
endif

! Snow assimilation state vector
! Case 1: Snow depth
! Case 2: SWE
! Case 3: Snow depth + SWE
if(clmupdate_snow.ne.0) then
error stop "Not implemented: clmupdate_snow.ne.0"
endif

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
Expand Down Expand Up @@ -535,6 +564,15 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")
call clm_texture_to_parameters
endif

! Snow assimilation:
! Case 1: Snow depth
! Case 2: Snow water equivalent
! Case 3: Snow depth (assimilated) and SWE (used for increment) in state vector
! Write updated snow variable back to CLM and then repartition snow and adjust related variables
if(clmupdate_snow.ne.0) then
error stop "Not implemented: clmupdate_snow.ne.0"
endif

end subroutine update_clm

subroutine clm_correct_texture()
Expand Down
2 changes: 2 additions & 0 deletions interface/model/common/enkf.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ GLOBAL int nx_local,ny_local,nz_local;
GLOBAL int clmupdate_swc;
GLOBAL int clmupdate_T;
GLOBAL int clmupdate_texture;
GLOBAL int clmupdate_snow;
GLOBAL int clmupdate_snow_repartitioning;
GLOBAL int clmprint_swc;
GLOBAL int clmprint_et;
GLOBAL int clmstatevec_allcol;
Expand Down
2 changes: 2 additions & 0 deletions interface/model/common/read_enkfpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ void read_enkfpar(char *parname)
clmupdate_swc = iniparser_getint(pardict,"CLM:update_swc",1);
clmupdate_T = iniparser_getint(pardict,"CLM:update_T",0);
clmupdate_texture = iniparser_getint(pardict,"CLM:update_texture",0);
clmupdate_snow = iniparser_getint(pardict,"CLM:update_snow",0);
clmupdate_snow_repartitioning = iniparser_getint(pardict,"CLM:update_snow_repartitioning",3);
clmprint_swc = iniparser_getint(pardict,"CLM:print_swc",0);
clmprint_et = iniparser_getint(pardict,"CLM:print_et",0);
clmstatevec_allcol = iniparser_getint(pardict,"CLM:statevec_allcol",0);
Expand Down
Loading