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