source: trunk/LMDZ.PLUTO.old/libf/phypluto/sfluxv.F_verbose @ 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.5 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        print*,'NW',NW
64
65
66        FZERO = FZEROV(NW)
67        IF(FZERO.ge.0.99) goto 40
68        DO NG=1,L_NGAUSS-1
69
70          print*,'NG',NG
71          if(TAUGSURF(NW,NG) .lt. TLIMIT) then
72
73            fzero = fzero + (1.0-FZEROV(NW))*GWEIGHT(NG)
74
75            goto 30
76          end if
77
78C         SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE
79
80          BTOP = 0.0
81
82C         LOOP OVER THE NTERMS BEGINNING HERE
83 
84          ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX)
85          BSURF = RSFV*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0)
86
87
88C         WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM
89C         CALL A SUBROUTINE THAT SOLVES  FOR THE FLUX TERMS
90C         WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER
91C
92C         FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO
93C         RETURN FLUXES FOR A GIVEN NT
94
95
96
97          print*,'Gfluxv'
98          CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG),
99     *                WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV,
100     *                BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN)
101          print*,'Gfluxv done'
102
103
104C         NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX
105
106          NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*GWEIGHT(NG)*
107     *                          (1.0-FZEROV(NW))
108          DO L=1,L_NLAYRAD
109            FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )*
110     *                           GWEIGHT(NG)*(1.0-FZEROV(NW))
111            FMNETV_nu(L,NW)=FMNETV_nu(L,NW)+( FMUPV(L)-FMDV(L) )*
112     *                           GWEIGHT(NG)*(1.0-FZEROV(NW))
113            FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*GWEIGHT(NG)*
114     *                   (1.0-FZEROV(NW))
115            FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*GWEIGHT(NG)*
116     *                   (1.0-FZEROV(NW))
117          END DO
118
119c         and same thing by spectral band... (RDW)
120          NFLUXTOPV_nu(NW) = NFLUXTOPV_nu(NW)
121     *      +(FLUXUP-FLUXDN)*GWEIGHT(NG)*
122     *                          (1.0-FZEROV(NW))
123
124C         THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX
125
126          DIFFVT = DIFFVT + DIFFV*GWEIGHT(NG)*(1.0-FZEROV(NW))
127
128   30     CONTINUE
129
130        END DO   ! the Gauss loop
131
132   40   continue
133C       Special 17th Gauss point
134        print*,'Special 17'
135
136        NG = L_NGAUSS
137
138C       SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE
139 
140        BTOP = 0.0
141
142C       LOOP OVER THE NTERMS BEGINNING HERE
143 
144        ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX)
145        BSURF = RSFV*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0)
146
147
148C       WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM
149C       CALL A SUBROUTINE THAT SOLVES  FOR THE FLUX TERMS
150C       WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER
151C
152C       FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO
153C       RETURN FLUXES FOR A GIVEN NT
154
155        print*,'Gfluxv new'
156        print*,'values=',DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG),
157     *              WBARV(1,NW,NG),COSBV(1,NW,NG)
158
159        CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG),
160     *              WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV,
161     *              BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN)
162        print*,'Gfluxv new done'
163
164
165C       NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX
166
167
168        print*,'fmdv',fmdv
169        print*,'fzero',fzero
170
171
172        NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*FZERO
173        DO L=1,L_NLAYRAD
174          FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )*FZERO
175          FMNETV_nu(L,NW)=FMNETV_nu(L,NW)+( FMUPV(L)-FMDV(L) )*FZERO
176          FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*FZERO
177          FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*FZERO
178        END DO
179
180c         and same thing by spectral band... (RDW)
181          NFLUXTOPV_nu(NW) = NFLUXTOPV_nu(NW)
182     *      +(FLUXUP-FLUXDN)*FZERO
183
184
185C       THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX
186
187        DIFFVT = DIFFVT + DIFFV*FZERO
188
189
190  500 CONTINUE
191
192C     *** END OF MAJOR SPECTRAL INTERVAL LOOP IN THE VISIBLE*****
193
194
195      RETURN
196      END
Note: See TracBrowser for help on using the repository browser.