[2899] | 1 | module sfluxv_mod |
---|
| 2 | |
---|
| 3 | implicit none |
---|
| 4 | |
---|
| 5 | contains |
---|
| 6 | |
---|
[135] | 7 | SUBROUTINE SFLUXV(DTAUV,TAUV,TAUCUMV,RSFV,DWNV,WBARV,COSBV, |
---|
[1781] | 8 | * UBAR0,STEL,NFLUXTOPV,FLUXTOPVDN, |
---|
[961] | 9 | * NFLUXOUTV_nu,NFLUXGNDV_nu, |
---|
[135] | 10 | * FMNETV,FLUXUPV,FLUXDNV,FZEROV,taugsurf) |
---|
| 11 | |
---|
[2899] | 12 | use radinc_h, only: L_TAUMAX, L_LEVELS, L_NSPECTV, L_NGAUSS |
---|
| 13 | use radinc_h, only: L_NLAYRAD, L_NLEVRAD |
---|
[1781] | 14 | use radcommon_h, only: tlimit, gweight |
---|
[2899] | 15 | use gfluxv_mod, only: gfluxv |
---|
[135] | 16 | |
---|
| 17 | implicit none |
---|
| 18 | |
---|
| 19 | real*8 FMNETV(L_NLAYRAD) |
---|
| 20 | real*8 TAUCUMV(L_LEVELS,L_NSPECTV,L_NGAUSS) |
---|
| 21 | real*8 TAUV(L_NLEVRAD,L_NSPECTV,L_NGAUSS) |
---|
| 22 | real*8 DTAUV(L_NLAYRAD,L_NSPECTV,L_NGAUSS), DWNV(L_NSPECTV) |
---|
| 23 | real*8 FMUPV(L_NLAYRAD), FMDV(L_NLAYRAD) |
---|
| 24 | real*8 COSBV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 25 | real*8 WBARV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 26 | real*8 STEL(L_NSPECTV) |
---|
| 27 | real*8 FLUXUPV(L_NLAYRAD), FLUXDNV(L_NLAYRAD) |
---|
[961] | 28 | real*8 NFLUXTOPV, FLUXUP, FLUXDN,FLUXTOPVDN |
---|
[366] | 29 | real*8 NFLUXOUTV_nu(L_NSPECTV) |
---|
[253] | 30 | real*8 NFLUXGNDV_nu(L_NSPECTV) |
---|
[135] | 31 | |
---|
| 32 | integer L, NG, NW, NG1,k |
---|
[1482] | 33 | real*8 ubar0, f0pi, btop, bsurf, taumax, eterm |
---|
| 34 | real*8 rsfv(L_NSPECTV) ! Spectral dependency added by MT2015. |
---|
[135] | 35 | real*8 FZEROV(L_NSPECTV) |
---|
| 36 | |
---|
| 37 | real*8 DIFFV, DIFFVT |
---|
| 38 | real*8 taugsurf(L_NSPECTV,L_NGAUSS-1), fzero |
---|
| 39 | |
---|
| 40 | C======================================================================C |
---|
| 41 | |
---|
| 42 | TAUMAX = L_TAUMAX |
---|
| 43 | |
---|
| 44 | C ZERO THE NET FLUXES |
---|
| 45 | |
---|
| 46 | NFLUXTOPV = 0.0 |
---|
[961] | 47 | FLUXTOPVDN = 0.0 |
---|
[135] | 48 | |
---|
[253] | 49 | DO NW=1,L_NSPECTV |
---|
[366] | 50 | NFLUXOUTV_nu(NW)=0.0 |
---|
[253] | 51 | NFLUXGNDV_nu(NW)=0.0 |
---|
| 52 | END DO |
---|
[135] | 53 | |
---|
| 54 | DO L=1,L_NLAYRAD |
---|
| 55 | FMNETV(L) = 0.0 |
---|
| 56 | FLUXUPV(L) = 0.0 |
---|
| 57 | FLUXDNV(L) = 0.0 |
---|
| 58 | END DO |
---|
| 59 | |
---|
| 60 | DIFFVT = 0.0 |
---|
| 61 | |
---|
| 62 | C WE NOW ENTER A MAJOR LOOP OVER SPECTRAL INTERVALS IN THE VISIBLE |
---|
| 63 | C TO CALCULATE THE NET FLUX IN EACH SPECTRAL INTERVAL |
---|
| 64 | |
---|
| 65 | DO 500 NW=1,L_NSPECTV |
---|
| 66 | |
---|
| 67 | F0PI = STEL(NW) |
---|
| 68 | |
---|
| 69 | FZERO = FZEROV(NW) |
---|
| 70 | IF(FZERO.ge.0.99) goto 40 |
---|
| 71 | DO NG=1,L_NGAUSS-1 |
---|
| 72 | |
---|
| 73 | if(TAUGSURF(NW,NG) .lt. TLIMIT) then |
---|
| 74 | |
---|
| 75 | fzero = fzero + (1.0-FZEROV(NW))*GWEIGHT(NG) |
---|
| 76 | |
---|
| 77 | goto 30 |
---|
| 78 | end if |
---|
| 79 | |
---|
| 80 | C SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE |
---|
| 81 | |
---|
[253] | 82 | BTOP = 0.0 |
---|
| 83 | !BSURF = 0./0. ! why was this here? |
---|
| 84 | BSURF = 0. |
---|
[135] | 85 | C LOOP OVER THE NTERMS BEGINNING HERE |
---|
| 86 | |
---|
[253] | 87 | |
---|
| 88 | ! FACTOR = 1.0D0 - WDEL(1)*CDEL(1)**2 |
---|
| 89 | ! TAU(1) = TDEL(1)*FACTOR |
---|
| 90 | |
---|
| 91 | |
---|
[135] | 92 | ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX) |
---|
[1482] | 93 | BSURF = RSFV(NW)*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0) |
---|
[135] | 94 | |
---|
| 95 | C WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM |
---|
| 96 | C CALL A SUBROUTINE THAT SOLVES FOR THE FLUX TERMS |
---|
| 97 | C WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER |
---|
| 98 | C |
---|
| 99 | C FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO |
---|
| 100 | C RETURN FLUXES FOR A GIVEN NT |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG), |
---|
[1482] | 104 | * WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV(NW), |
---|
[135] | 105 | * BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN) |
---|
| 106 | |
---|
| 107 | C NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX |
---|
| 108 | |
---|
| 109 | NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*GWEIGHT(NG)* |
---|
| 110 | * (1.0-FZEROV(NW)) |
---|
[961] | 111 | FLUXTOPVDN = FLUXTOPVDN+FLUXDN*GWEIGHT(NG)* |
---|
| 112 | * (1.0-FZEROV(NW)) |
---|
[135] | 113 | DO L=1,L_NLAYRAD |
---|
| 114 | FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )* |
---|
| 115 | * GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
| 116 | FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*GWEIGHT(NG)* |
---|
| 117 | * (1.0-FZEROV(NW)) |
---|
| 118 | FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*GWEIGHT(NG)* |
---|
| 119 | * (1.0-FZEROV(NW)) |
---|
| 120 | END DO |
---|
| 121 | |
---|
[366] | 122 | c band-resolved flux leaving TOA (RDW) |
---|
| 123 | NFLUXOUTV_nu(NW) = NFLUXOUTV_nu(NW) |
---|
| 124 | * +FLUXUP*GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
[135] | 125 | |
---|
[366] | 126 | c band-resolved flux at ground (RDW) |
---|
[253] | 127 | NFLUXGNDV_nu(NW) = NFLUXGNDV_nu(NW) |
---|
| 128 | * +FMDV(L_NLAYRAD)*GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
| 129 | |
---|
| 130 | |
---|
[135] | 131 | C THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX |
---|
| 132 | |
---|
| 133 | DIFFVT = DIFFVT + DIFFV*GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
| 134 | |
---|
| 135 | 30 CONTINUE |
---|
| 136 | |
---|
| 137 | END DO ! the Gauss loop |
---|
| 138 | |
---|
| 139 | 40 continue |
---|
| 140 | C Special 17th Gauss point |
---|
| 141 | |
---|
| 142 | NG = L_NGAUSS |
---|
| 143 | |
---|
| 144 | C SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE |
---|
| 145 | |
---|
| 146 | BTOP = 0.0 |
---|
| 147 | |
---|
| 148 | C LOOP OVER THE NTERMS BEGINNING HERE |
---|
| 149 | |
---|
| 150 | ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX) |
---|
[1482] | 151 | BSURF = RSFV(NW)*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0) |
---|
[135] | 152 | |
---|
| 153 | |
---|
| 154 | C WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM |
---|
| 155 | C CALL A SUBROUTINE THAT SOLVES FOR THE FLUX TERMS |
---|
| 156 | C WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER |
---|
| 157 | C |
---|
| 158 | C FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO |
---|
| 159 | C RETURN FLUXES FOR A GIVEN NT |
---|
| 160 | |
---|
| 161 | CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG), |
---|
[1482] | 162 | * WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV(NW), |
---|
[135] | 163 | * BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN) |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | C NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX |
---|
| 167 | |
---|
| 168 | NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*FZERO |
---|
[961] | 169 | FLUXTOPVDN = FLUXTOPVDN+FLUXDN*FZERO |
---|
[135] | 170 | DO L=1,L_NLAYRAD |
---|
| 171 | FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )*FZERO |
---|
| 172 | FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*FZERO |
---|
| 173 | FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*FZERO |
---|
| 174 | END DO |
---|
| 175 | |
---|
[366] | 176 | c band-resolved flux leaving TOA (RDW) |
---|
| 177 | NFLUXOUTV_nu(NW) = NFLUXOUTV_nu(NW) |
---|
| 178 | * +FLUXUP*FZERO |
---|
[135] | 179 | |
---|
[366] | 180 | c band-resolved flux at ground (RDW) |
---|
[253] | 181 | NFLUXGNDV_nu(NW) = NFLUXGNDV_nu(NW)+FMDV(L_NLAYRAD)*FZERO |
---|
[135] | 182 | |
---|
[253] | 183 | |
---|
[135] | 184 | C THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX |
---|
| 185 | |
---|
| 186 | DIFFVT = DIFFVT + DIFFV*FZERO |
---|
| 187 | |
---|
| 188 | |
---|
| 189 | 500 CONTINUE |
---|
| 190 | |
---|
[253] | 191 | |
---|
[135] | 192 | C *** END OF MAJOR SPECTRAL INTERVAL LOOP IN THE VISIBLE***** |
---|
| 193 | |
---|
| 194 | |
---|
[2899] | 195 | END SUBROUTINE SFLUXV |
---|
| 196 | |
---|
| 197 | end module sfluxv_mod |
---|
| 198 | |
---|