Skip to content

Commit

Permalink
pdaf/model: Restrict debug outputs swcstate_*, h2osoi_*
Browse files Browse the repository at this point in the history
only output these debug datasets, when SWC is updated during
assimilation, i.e. when `CLM:update_swc .ne. 0`
  • Loading branch information
jjokella committed Jan 24, 2025
1 parent 7031903 commit 9276ebf
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 127 deletions.
88 changes: 45 additions & 43 deletions bldsva/intf_DA/pdaf/model/clm3_5/enkf_clm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,15 @@ subroutine set_clm_statevec(tstartcycle, mype)

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: Debug output of CLM swc
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: Debug output of CLM swc
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down Expand Up @@ -358,20 +362,21 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn5, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn6, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn5, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn6, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down Expand Up @@ -463,36 +468,33 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")
! update ice content
h2osoi_ice(j,i) = swc(j,i) * dz(j,i)*denice*rice
end if

! cc = cc + 1
end do
end do

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn3, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn4, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn3, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn4, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down
87 changes: 45 additions & 42 deletions bldsva/intf_DA/pdaf/model/clm5_0/enkf_clm_mod_5.F90
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,15 @@ subroutine set_clm_statevec(tstartcycle, mype)

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: Debug output of CLM swc
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: Debug output of CLM swc
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down Expand Up @@ -457,20 +461,21 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn5, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn6, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn5, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn6, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down Expand Up @@ -572,29 +577,27 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn3, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn4, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn3, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn4, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down
87 changes: 45 additions & 42 deletions bldsva/intf_DA/pdaf/model/eclm/enkf_clm_mod_5.F90
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,15 @@ subroutine set_clm_statevec(tstartcycle, mype)

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: Debug output of CLM swc
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: Debug output of CLM swc
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down Expand Up @@ -457,20 +461,21 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn5, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn6, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn5, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
OPEN(unit=71, file=fn6, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down Expand Up @@ -572,29 +577,27 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")

#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn3, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn4, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)
END IF
#endif
#ifdef PDAF_DEBUG
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)

IF(clmupdate_swc.NE.0) THEN
! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn3, action="write")
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn4, action="write")
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
CLOSE(71)

! TSMP-PDAF: For debug runs, output the state vector in files
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
OPEN(unit=71, file=fn2, action="write")
WRITE (71,"(es22.15)") swc(:,:)
CLOSE(71)
END IF

END IF
#endif

Expand Down

0 comments on commit 9276ebf

Please sign in to comment.