source: trunk/LMDZ.PLUTO.old/libf/phypluto/sfluxv.F_saved @ 3436

Last change on this file since 3436 was 3175, checked in by emillour, 11 months ago

Pluto PCM:
Add the old Pluto LMDZ for reference (required prior step to making
an LMDZ.PLUTO using the same framework as the other physics packages).
TB+EM

File size: 5.1 KB
Line 
1      SUBROUTINE SFLUXV(DTAUV,TAUV,TAUCUMV,RSFV,DWNV,WBARV,COSBV,
2     *                UBAR0,STEL,GWEIGHT,NFLUXTOPV,NFLUXTOPV_nu,
3     *                FMNETV,fmnetv_nu,FLUXUPV,FLUXDNV,FZEROV,taugsurf)
4
5      use radinc_h
6      use radcommon_h, only: tlimit
7
8      implicit none
9
10      real*8 FMNETV(L_NLAYRAD)
11      real*8 FMNETV_NU(L_NLAYRAD,L_NSPECTV)
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
21      real*8 NFLUXTOPV_nu(L_NSPECTV)
22      real*8 GWEIGHT(L_NGAUSS)
23
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
31      real*8 taugsurf(L_NSPECTV,L_NGAUSS-1), fzero
32
33C======================================================================C
34
35      TAUMAX = L_TAUMAX
36
37C     ZERO THE NET FLUXES
38
39      NFLUXTOPV = 0.0
40
41
42      DO L=1,L_NLAYRAD
43        FMNETV(L)  = 0.0
44        FLUXUPV(L) = 0.0
45        FLUXDNV(L) = 0.0
46      END DO
47      DO NW=1,L_NSPECTV
48        NFLUXTOPV_nu(nw) = 0.
49        DO L=1,L_NLAYRAD
50           FMNETV_nu(L,NW)  = 0.0
51        END DO
52      END DO
53   
54
55      DIFFVT = 0.0
56
57C     WE NOW ENTER A MAJOR LOOP OVER SPECTRAL INTERVALS IN THE VISIBLE
58C     TO CALCULATE THE NET FLUX IN EACH SPECTRAL INTERVAL
59
60      DO 500 NW=1,L_NSPECTV
61     
62        F0PI = STEL(NW)
63
64
65        FZERO = FZEROV(NW)
66        IF(FZERO.ge.0.99) goto 40
67        DO NG=1,L_NGAUSS-1
68
69          if(TAUGSURF(NW,NG) .lt. TLIMIT) then
70
71            fzero = fzero + (1.0-FZEROV(NW))*GWEIGHT(NG)
72
73            goto 30
74          end if
75
76C         SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE
77
78          BTOP = 0.0
79
80C         LOOP OVER THE NTERMS BEGINNING HERE
81 
82          ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX)
83          BSURF = RSFV*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0)
84
85
86C         WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM
87C         CALL A SUBROUTINE THAT SOLVES  FOR THE FLUX TERMS
88C         WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER
89C
90C         FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO
91C         RETURN FLUXES FOR A GIVEN NT
92
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
100C         NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX
101
102          NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*GWEIGHT(NG)*
103     *                          (1.0-FZEROV(NW))
104          DO L=1,L_NLAYRAD
105            FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )*
106     *                           GWEIGHT(NG)*(1.0-FZEROV(NW))
107            FMNETV_nu(L,NW)=FMNETV_nu(L,NW)+( FMUPV(L)-FMDV(L) )*
108     *                           GWEIGHT(NG)*(1.0-FZEROV(NW))
109            FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*GWEIGHT(NG)*
110     *                   (1.0-FZEROV(NW))
111            FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*GWEIGHT(NG)*
112     *                   (1.0-FZEROV(NW))
113          END DO
114
115c         and same thing by spectral band... (RDW)
116          NFLUXTOPV_nu(NW) = NFLUXTOPV_nu(NW)
117     *      +(FLUXUP-FLUXDN)*GWEIGHT(NG)*
118     *                          (1.0-FZEROV(NW))
119
120C         THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX
121
122          DIFFVT = DIFFVT + DIFFV*GWEIGHT(NG)*(1.0-FZEROV(NW))
123
124   30     CONTINUE
125
126        END DO   ! the Gauss loop
127
128   40   continue
129C       Special 17th Gauss point
130
131        NG = L_NGAUSS
132
133C       SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE
134 
135        BTOP = 0.0
136
137C       LOOP OVER THE NTERMS BEGINNING HERE
138 
139        ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX)
140        BSURF = RSFV*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0)
141
142
143C       WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM
144C       CALL A SUBROUTINE THAT SOLVES  FOR THE FLUX TERMS
145C       WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER
146C
147C       FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO
148C       RETURN FLUXES FOR A GIVEN NT
149
150        CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG),
151     *              WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV,
152     *              BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN)
153
154
155C       NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX
156
157
158
159
160        NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*FZERO
161        DO L=1,L_NLAYRAD
162          FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )*FZERO
163          FMNETV_nu(L,NW)=FMNETV_nu(L,NW)+( 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         and same thing by spectral band... (RDW)
169          NFLUXTOPV_nu(NW) = NFLUXTOPV_nu(NW)
170     *      +(FLUXUP-FLUXDN)*FZERO
171
172
173C       THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX
174
175        DIFFVT = DIFFVT + DIFFV*FZERO
176
177
178  500 CONTINUE
179
180C     *** END OF MAJOR SPECTRAL INTERVAL LOOP IN THE VISIBLE*****
181
182
183      RETURN
184      END
Note: See TracBrowser for help on using the repository browser.