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