source: trunk/LMDZ.GENERIC/libf/phystd/sfluxv.F @ 1834

Last change on this file since 1834 was 1781, checked in by jvatant, 7 years ago

Useless argument Gweight in rad. tr. routines ( present in radcommon.h )
-JVO

File size: 5.4 KB
Line 
1      SUBROUTINE SFLUXV(DTAUV,TAUV,TAUCUMV,RSFV,DWNV,WBARV,COSBV,
2     *                  UBAR0,STEL,NFLUXTOPV,FLUXTOPVDN,
3     *                  NFLUXOUTV_nu,NFLUXGNDV_nu,
4     *                  FMNETV,FLUXUPV,FLUXDNV,FZEROV,taugsurf)
5
6      use radinc_h
7      use radcommon_h, only: tlimit, gweight
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)
20      real*8 NFLUXTOPV, FLUXUP, FLUXDN,FLUXTOPVDN
21      real*8 NFLUXOUTV_nu(L_NSPECTV)
22      real*8 NFLUXGNDV_nu(L_NSPECTV)
23
24      integer L, NG, NW, NG1,k
25      real*8 ubar0, f0pi, btop, bsurf, taumax, eterm
26      real*8 rsfv(L_NSPECTV) ! Spectral dependency added by MT2015.
27      real*8 FZEROV(L_NSPECTV)
28
29      real*8 DIFFV, DIFFVT
30      real*8 taugsurf(L_NSPECTV,L_NGAUSS-1), fzero
31
32C======================================================================C
33
34      TAUMAX = L_TAUMAX
35
36C     ZERO THE NET FLUXES
37
38      NFLUXTOPV = 0.0
39      FLUXTOPVDN = 0.0
40
41      DO NW=1,L_NSPECTV
42         NFLUXOUTV_nu(NW)=0.0
43         NFLUXGNDV_nu(NW)=0.0
44      END DO
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
54C     WE NOW ENTER A MAJOR LOOP OVER SPECTRAL INTERVALS IN THE VISIBLE
55C     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
72C         SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE
73
74          BTOP  = 0.0
75          !BSURF = 0./0. ! why was this here?
76          BSURF = 0.
77C         LOOP OVER THE NTERMS BEGINNING HERE
78 
79
80!      FACTOR    = 1.0D0 - WDEL(1)*CDEL(1)**2
81!      TAU(1)    = TDEL(1)*FACTOR
82
83
84          ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX)
85          BSURF = RSFV(NW)*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0)
86
87C         WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM
88C         CALL A SUBROUTINE THAT SOLVES  FOR THE FLUX TERMS
89C         WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER
90C
91C         FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO
92C         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(NW),   
97     *                BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN)
98
99C         NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX
100
101          NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*GWEIGHT(NG)*
102     *                          (1.0-FZEROV(NW))
103          FLUXTOPVDN = FLUXTOPVDN+FLUXDN*GWEIGHT(NG)*
104     *                          (1.0-FZEROV(NW))
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
114c     band-resolved flux leaving TOA (RDW)
115          NFLUXOUTV_nu(NW) = NFLUXOUTV_nu(NW)
116     *      +FLUXUP*GWEIGHT(NG)*(1.0-FZEROV(NW))
117
118c     band-resolved flux at ground (RDW)
119          NFLUXGNDV_nu(NW) = NFLUXGNDV_nu(NW)
120     *      +FMDV(L_NLAYRAD)*GWEIGHT(NG)*(1.0-FZEROV(NW))
121
122
123C         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
132C       Special 17th Gauss point
133
134        NG = L_NGAUSS
135
136C       SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE
137 
138        BTOP = 0.0
139
140C       LOOP OVER THE NTERMS BEGINNING HERE
141 
142        ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX)
143        BSURF = RSFV(NW)*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0)
144
145
146C       WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM
147C       CALL A SUBROUTINE THAT SOLVES  FOR THE FLUX TERMS
148C       WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER
149C
150C       FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO
151C       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(NW),
155     *              BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN)
156
157
158C       NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX
159
160        NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*FZERO
161        FLUXTOPVDN = FLUXTOPVDN+FLUXDN*FZERO
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
168c     band-resolved flux leaving TOA (RDW)
169          NFLUXOUTV_nu(NW) = NFLUXOUTV_nu(NW)
170     *      +FLUXUP*FZERO
171
172c     band-resolved flux at ground (RDW)
173          NFLUXGNDV_nu(NW) = NFLUXGNDV_nu(NW)+FMDV(L_NLAYRAD)*FZERO
174
175
176C       THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX
177
178        DIFFVT = DIFFVT + DIFFV*FZERO
179
180
181  500 CONTINUE
182
183
184C     *** END OF MAJOR SPECTRAL INTERVAL LOOP IN THE VISIBLE*****
185
186
187      RETURN
188      END
Note: See TracBrowser for help on using the repository browser.