Skip to content

Commit 9276ebf

Browse files
committed
pdaf/model: Restrict debug outputs swcstate_*, h2osoi_*
only output these debug datasets, when SWC is updated during assimilation, i.e. when `CLM:update_swc .ne. 0`
1 parent 7031903 commit 9276ebf

File tree

3 files changed

+135
-127
lines changed

3 files changed

+135
-127
lines changed

bldsva/intf_DA/pdaf/model/clm3_5/enkf_clm_mod.F90

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,15 @@ subroutine set_clm_statevec(tstartcycle, mype)
204204

205205
#ifdef PDAF_DEBUG
206206
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
207-
! TSMP-PDAF: Debug output of CLM swc
208-
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
209-
OPEN(unit=71, file=fn2, action="write")
210-
WRITE (71,"(es22.15)") swc(:,:)
211-
CLOSE(71)
207+
208+
IF(clmupdate_swc.NE.0) THEN
209+
! TSMP-PDAF: Debug output of CLM swc
210+
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
211+
OPEN(unit=71, file=fn2, action="write")
212+
WRITE (71,"(es22.15)") swc(:,:)
213+
CLOSE(71)
214+
END IF
215+
212216
END IF
213217
#endif
214218

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

359363
#ifdef PDAF_DEBUG
360364
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
361-
! TSMP-PDAF: For debug runs, output the state vector in files
362-
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
363-
OPEN(unit=71, file=fn5, action="write")
364-
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
365-
CLOSE(71)
366-
END IF
367-
#endif
368-
#ifdef PDAF_DEBUG
369-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
370-
! TSMP-PDAF: For debug runs, output the state vector in files
371-
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
372-
OPEN(unit=71, file=fn6, action="write")
373-
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
374-
CLOSE(71)
365+
366+
IF(clmupdate_swc.NE.0) THEN
367+
! TSMP-PDAF: For debug runs, output the state vector in files
368+
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
369+
OPEN(unit=71, file=fn5, action="write")
370+
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
371+
CLOSE(71)
372+
373+
! TSMP-PDAF: For debug runs, output the state vector in files
374+
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
375+
OPEN(unit=71, file=fn6, action="write")
376+
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
377+
CLOSE(71)
378+
END IF
379+
375380
END IF
376381
#endif
377382

@@ -463,36 +468,33 @@ subroutine update_clm(tstartcycle, mype) bind(C,name="update_clm")
463468
! update ice content
464469
h2osoi_ice(j,i) = swc(j,i) * dz(j,i)*denice*rice
465470
end if
466-
467471
! cc = cc + 1
468472
end do
469473
end do
470474

471475
#ifdef PDAF_DEBUG
472476
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
473-
! TSMP-PDAF: For debug runs, output the state vector in files
474-
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
475-
OPEN(unit=71, file=fn3, action="write")
476-
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
477-
CLOSE(71)
478-
END IF
479-
#endif
480-
#ifdef PDAF_DEBUG
481-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
482-
! TSMP-PDAF: For debug runs, output the state vector in files
483-
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
484-
OPEN(unit=71, file=fn4, action="write")
485-
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
486-
CLOSE(71)
487-
END IF
488-
#endif
489-
#ifdef PDAF_DEBUG
490-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
491-
! TSMP-PDAF: For debug runs, output the state vector in files
492-
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
493-
OPEN(unit=71, file=fn2, action="write")
494-
WRITE (71,"(es22.15)") swc(:,:)
495-
CLOSE(71)
477+
478+
IF(clmupdate_swc.NE.0) THEN
479+
! TSMP-PDAF: For debug runs, output the state vector in files
480+
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
481+
OPEN(unit=71, file=fn3, action="write")
482+
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
483+
CLOSE(71)
484+
485+
! TSMP-PDAF: For debug runs, output the state vector in files
486+
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
487+
OPEN(unit=71, file=fn4, action="write")
488+
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
489+
CLOSE(71)
490+
491+
! TSMP-PDAF: For debug runs, output the state vector in files
492+
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
493+
OPEN(unit=71, file=fn2, action="write")
494+
WRITE (71,"(es22.15)") swc(:,:)
495+
CLOSE(71)
496+
END IF
497+
496498
END IF
497499
#endif
498500

bldsva/intf_DA/pdaf/model/clm5_0/enkf_clm_mod_5.F90

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,15 @@ subroutine set_clm_statevec(tstartcycle, mype)
333333

334334
#ifdef PDAF_DEBUG
335335
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
336-
! TSMP-PDAF: Debug output of CLM swc
337-
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
338-
OPEN(unit=71, file=fn2, action="write")
339-
WRITE (71,"(es22.15)") swc(:,:)
340-
CLOSE(71)
336+
337+
IF(clmupdate_swc.NE.0) THEN
338+
! TSMP-PDAF: Debug output of CLM swc
339+
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
340+
OPEN(unit=71, file=fn2, action="write")
341+
WRITE (71,"(es22.15)") swc(:,:)
342+
CLOSE(71)
343+
END IF
344+
341345
END IF
342346
#endif
343347

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

458462
#ifdef PDAF_DEBUG
459463
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
460-
! TSMP-PDAF: For debug runs, output the state vector in files
461-
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
462-
OPEN(unit=71, file=fn5, action="write")
463-
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
464-
CLOSE(71)
465-
END IF
466-
#endif
467-
#ifdef PDAF_DEBUG
468-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
469-
! TSMP-PDAF: For debug runs, output the state vector in files
470-
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
471-
OPEN(unit=71, file=fn6, action="write")
472-
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
473-
CLOSE(71)
464+
465+
IF(clmupdate_swc.NE.0) THEN
466+
! TSMP-PDAF: For debug runs, output the state vector in files
467+
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
468+
OPEN(unit=71, file=fn5, action="write")
469+
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
470+
CLOSE(71)
471+
472+
! TSMP-PDAF: For debug runs, output the state vector in files
473+
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
474+
OPEN(unit=71, file=fn6, action="write")
475+
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
476+
CLOSE(71)
477+
END IF
478+
474479
END IF
475480
#endif
476481

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

573578
#ifdef PDAF_DEBUG
574579
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
575-
! TSMP-PDAF: For debug runs, output the state vector in files
576-
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
577-
OPEN(unit=71, file=fn3, action="write")
578-
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
579-
CLOSE(71)
580-
END IF
581-
#endif
582-
#ifdef PDAF_DEBUG
583-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
584-
! TSMP-PDAF: For debug runs, output the state vector in files
585-
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
586-
OPEN(unit=71, file=fn4, action="write")
587-
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
588-
CLOSE(71)
589-
END IF
590-
#endif
591-
#ifdef PDAF_DEBUG
592-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
593-
! TSMP-PDAF: For debug runs, output the state vector in files
594-
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
595-
OPEN(unit=71, file=fn2, action="write")
596-
WRITE (71,"(es22.15)") swc(:,:)
597-
CLOSE(71)
580+
581+
IF(clmupdate_swc.NE.0) THEN
582+
! TSMP-PDAF: For debug runs, output the state vector in files
583+
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
584+
OPEN(unit=71, file=fn3, action="write")
585+
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
586+
CLOSE(71)
587+
588+
! TSMP-PDAF: For debug runs, output the state vector in files
589+
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
590+
OPEN(unit=71, file=fn4, action="write")
591+
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
592+
CLOSE(71)
593+
594+
! TSMP-PDAF: For debug runs, output the state vector in files
595+
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
596+
OPEN(unit=71, file=fn2, action="write")
597+
WRITE (71,"(es22.15)") swc(:,:)
598+
CLOSE(71)
599+
END IF
600+
598601
END IF
599602
#endif
600603

bldsva/intf_DA/pdaf/model/eclm/enkf_clm_mod_5.F90

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,15 @@ subroutine set_clm_statevec(tstartcycle, mype)
333333

334334
#ifdef PDAF_DEBUG
335335
IF(clmt_printensemble == tstartcycle + 1 .OR. clmt_printensemble < 0) THEN
336-
! TSMP-PDAF: Debug output of CLM swc
337-
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
338-
OPEN(unit=71, file=fn2, action="write")
339-
WRITE (71,"(es22.15)") swc(:,:)
340-
CLOSE(71)
336+
337+
IF(clmupdate_swc.NE.0) THEN
338+
! TSMP-PDAF: Debug output of CLM swc
339+
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".integrate.", tstartcycle + 1, ".txt"
340+
OPEN(unit=71, file=fn2, action="write")
341+
WRITE (71,"(es22.15)") swc(:,:)
342+
CLOSE(71)
343+
END IF
344+
341345
END IF
342346
#endif
343347

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

458462
#ifdef PDAF_DEBUG
459463
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
460-
! TSMP-PDAF: For debug runs, output the state vector in files
461-
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
462-
OPEN(unit=71, file=fn5, action="write")
463-
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
464-
CLOSE(71)
465-
END IF
466-
#endif
467-
#ifdef PDAF_DEBUG
468-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
469-
! TSMP-PDAF: For debug runs, output the state vector in files
470-
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
471-
OPEN(unit=71, file=fn6, action="write")
472-
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
473-
CLOSE(71)
464+
465+
IF(clmupdate_swc.NE.0) THEN
466+
! TSMP-PDAF: For debug runs, output the state vector in files
467+
WRITE(fn5, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".bef_up.", tstartcycle, ".txt"
468+
OPEN(unit=71, file=fn5, action="write")
469+
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
470+
CLOSE(71)
471+
472+
! TSMP-PDAF: For debug runs, output the state vector in files
473+
WRITE(fn6, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".bef_up.", tstartcycle, ".txt"
474+
OPEN(unit=71, file=fn6, action="write")
475+
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
476+
CLOSE(71)
477+
END IF
478+
474479
END IF
475480
#endif
476481

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

573578
#ifdef PDAF_DEBUG
574579
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
575-
! TSMP-PDAF: For debug runs, output the state vector in files
576-
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
577-
OPEN(unit=71, file=fn3, action="write")
578-
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
579-
CLOSE(71)
580-
END IF
581-
#endif
582-
#ifdef PDAF_DEBUG
583-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
584-
! TSMP-PDAF: For debug runs, output the state vector in files
585-
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
586-
OPEN(unit=71, file=fn4, action="write")
587-
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
588-
CLOSE(71)
589-
END IF
590-
#endif
591-
#ifdef PDAF_DEBUG
592-
IF(clmt_printensemble == tstartcycle .OR. clmt_printensemble < 0) THEN
593-
! TSMP-PDAF: For debug runs, output the state vector in files
594-
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
595-
OPEN(unit=71, file=fn2, action="write")
596-
WRITE (71,"(es22.15)") swc(:,:)
597-
CLOSE(71)
580+
581+
IF(clmupdate_swc.NE.0) THEN
582+
! TSMP-PDAF: For debug runs, output the state vector in files
583+
WRITE(fn3, "(a,i5.5,a,i5.5,a)") "h2osoi_liq", mype, ".update.", tstartcycle, ".txt"
584+
OPEN(unit=71, file=fn3, action="write")
585+
WRITE (71,"(es22.15)") h2osoi_liq(:,:)
586+
CLOSE(71)
587+
588+
! TSMP-PDAF: For debug runs, output the state vector in files
589+
WRITE(fn4, "(a,i5.5,a,i5.5,a)") "h2osoi_ice", mype, ".update.", tstartcycle, ".txt"
590+
OPEN(unit=71, file=fn4, action="write")
591+
WRITE (71,"(es22.15)") h2osoi_ice(:,:)
592+
CLOSE(71)
593+
594+
! TSMP-PDAF: For debug runs, output the state vector in files
595+
WRITE(fn2, "(a,i5.5,a,i5.5,a)") "swcstate_", mype, ".update.", tstartcycle, ".txt"
596+
OPEN(unit=71, file=fn2, action="write")
597+
WRITE (71,"(es22.15)") swc(:,:)
598+
CLOSE(71)
599+
END IF
600+
598601
END IF
599602
#endif
600603

0 commit comments

Comments
 (0)