Skip to content

Commit

Permalink
Update comments in cld_sub_mod for clarity
Browse files Browse the repository at this point in the history
Signed-off-by: Lizzie Lundgren <[email protected]>
  • Loading branch information
lizziel committed Jun 2, 2023
1 parent 1929de9 commit bdf192d
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/Core/cld_sub_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ MODULE CLD_SUB_MOD

IMPLICIT NONE

! Public driver
PUBLIC :: CLOUD_JX

! Used locally for cloud flags 5, 6, 7, 8
PRIVATE :: ICA_NR
PRIVATE :: ICA_ALL
PRIVATE :: ICA_III

! Use locally for cloud flags 6 and 7
PRIVATE :: ICA_QUD

! Not used
PRIVATE :: HEAPSORT_A

CONTAINS
Expand Down Expand Up @@ -284,10 +290,17 @@ SUBROUTINE CLOUD_JX (U0,SZA,RFL,SOLF,LPRTJ,PPP,ZZZ,TTT,HHH,DDD, &
IRANX = mod (IRAN+N-1, NRAN_) + 1
XRAN = RAN4(IRANX)
I = 1
! ewl debug: Cloud-J gets I = 4 for cldflg5, GC I = 1?
! XRAN :
! OCDFS(I) :
! NICA :
do while (XRAN .gt. OCDFS(I) .and. I .lt. NICA)
I = I+1
enddo

! ewl debug: what happens if I set I to 4? Still runs...
!I = 4

call ICA_III( LPRTJ0, CLT, LTOP, CBIN_, I, NCLDF, GFNR, &
GNR, GBOT, GTOP, NRG, NICA, TTCOL )

Expand All @@ -304,6 +317,17 @@ SUBROUTINE CLOUD_JX (U0,SZA,RFL,SOLF,LPRTJ,PPP,ZZZ,TTT,HHH,DDD, &
enddo

if(LPRTJ0) then
! ewl debug: trying to figure out why GC printing 1, 1, 0.0
! and then nothing in the loop....
! N : iterator of NRANDO (1:50)
! I : Set earlier in while loop. 4 in cloud-j
! OCOL(I) : Computed in ICA_ALL earlier. Too low!
! LTOP : 34 levels??
! TTCOL(L): Computed in ICA_III earlier
! LWPX(L) : Set to LWP (input arg) unless TTCOL(L) < 1.d-8
! IWPX(L) : Set to IWP (input arg) unless TTCOL(L) < 1.d-8
print *, "ewl in cloud-j: LTOP: ", LTOP

write(6,'(a,2i6,f8.3)') ' pick random ICA:',N,I,OCOL(I)
do L = 1,LTOP
if (TTCOL(L) .ge. 1.d-8) then
Expand Down Expand Up @@ -617,6 +641,17 @@ SUBROUTINE ICA_NR(LPRTJ0,CLDF,CLTAU,IWPX,LWPX,ZZZ,CLDIW,LTOP,CBIN_, &
! N=19=[90-95%],N=20=[95-100%]
!---assume the upper end of the range and renormalize in-cloud TAU to preserve
! CLDF*TAU

! Debug prints of inputs
if ( LPRTJ0 ) then
print *, "ICA_NR inputs:"
print *, " - LTOP, CBIN_, ICA_: ", LTOP, CBIN_, ICA_
do L=1,LTOP
print *, " - 1:LTOP loop, CLDIW(L), CLDF(L), ZZZ(L): ", &
L, CLDIW(L), CLDF(L), ZZZ(L)
enddo
endif

FBIN = CBIN_
do K = 1,CBIN_
CFBIN(K) = float(K) / FBIN
Expand Down Expand Up @@ -950,6 +985,23 @@ SUBROUTINE ICA_ALL(LPRTJ0,CLF,CLT,LTOP,CBINU,ICAU, CFBIN,CLDCOR,NCLDF, &
integer I, II, IG1,IG2, G, L, IGNR(10),GCLDY(10),GRP1,GRP2
logical L_CLR1,L_CLR2 ,LSKIP ,LGR_CLR(10)
!-----------------------------------------------------------------------

! Debug prints of inputs
if ( LPRTJ0 ) then
print *, "ICA_ALL inputs:"
print *, " - LTOP, CBINU, ICAU, NRG, NICA, CLDCOR: ", LTOP, CBINU, ICAU, NRG, NICA, CLDCOR
do L=1,LTOP
print *, " - 1:LTOP loop, NCLDF(L): ", L, NCLDF(L)
enddo
do L=1,CBINU
print *, " - 1:CBINU loop, CFBIN: ", L, CFBIN(L)
enddo
do L=1,9
print *, " - 1:9 loop, GBOT, GTOP, GLVL, GNR, GCMX, GFNR(L,1): ", &
L, GBOT(L), GTOP(L), GLVL(L), GNR(L), GCMX(L), GFNR(L,1)
enddo
endif

CLTOT(:) = 0.d0

CF0(1) = 0.d0
Expand Down Expand Up @@ -1078,6 +1130,24 @@ SUBROUTINE ICA_III(LPRTJ0, CLT, LTOP, CBINU, III, NCLDF, GFNR, &

integer II, IG, G, L
!-----------------------------------------------------------------------

! Debug prints of inputs
if ( LPRTJ0 ) then
print *, "ICA_III inputs:"
print *, " - LTOP, CBINU, NRG, NICA, III, NCLDF: ", &
LTOP, CBINU, NRG, NICA, III, NCLDF
do L=1,LTOP
print *, " - L, NCLDF(L): ", L, NCLDF(L)
enddo
do L=1,CBINU
print *, " - 1:CBINU loop, GFNR(1,CBINU): ", L, GFNR(1,L)
enddo
do L=1,9
print *, " - 1:9 loop, GBOT, GTOP, GNR: ", &
L, GBOT(L), GTOP(L), GNR(L)
enddo
endif

TTCOL(:) = 0.d0
II = max(1, min(NICA,III))
do G = 1,NRG
Expand Down

0 comments on commit bdf192d

Please sign in to comment.