Changeset 3409 for trunk/LMDZ.PLUTO/libf
- Timestamp:
- Aug 20, 2024, 12:12:40 PM (4 months ago)
- Location:
- trunk/LMDZ.PLUTO/libf/phypluto
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/libf/phypluto/dsolver.F
r3184 r3409 40 40 41 41 L=2*NL 42 42 43 43 C ************MIXED COEFFICENTS********** 44 44 C THIS VERSION AVOIDS SINGULARITIES ASSOC. … … 53 53 54 54 C EVEN TERMS 55 55 56 56 DO I=2,LM2,2 57 57 N = N+1 58 AF(I) = (E1(N)+E3(N))*(GAMA(N+1)-1.) 58 AF(I) = (E1(N)+E3(N))*(GAMA(N+1)-1.) 59 59 BF(I) = (E2(N)+E4(N))*(GAMA(N+1)-1.) 60 IF (BF(I).eq.0) THEN 61 BF(I) = 1e-16 62 END IF 60 63 CF(I) = 2.0*(1.-GAMA(N+1)**2) 61 64 DF(I) = (GAMA(N+1)-1.) * (CPM1(N+1) - CP(N)) + 62 65 * (1.-GAMA(N+1))* (CM(N)-CMM1(N+1)) 63 66 END DO 64 67 65 68 N = 0 66 69 LM1 = L-1 … … 69 72 AF(I) = 2.0*(1.-GAMA(N)**2) 70 73 BF(I) = (E1(N)-E3(N))*(1.+GAMA(N+1)) 74 IF (BF(I).eq.0) THEN 75 BF(I) = 1e-16 76 END IF 71 77 CF(I) = (E1(N)+E3(N))*(GAMA(N+1)-1.) 72 78 DF(I) = E3(N)*(CPM1(N+1) - CP(N)) + E1(N)*(CM(N) - CMM1(N+1)) 73 79 END DO 74 80 75 81 AF(L) = E1(NL)-RSF*E3(NL) 76 82 BF(L) = E2(NL)-RSF*E4(NL) 83 IF (BF(L).eq.0) THEN 84 BF(L) = 1e-16 85 END IF 77 86 CF(L) = 0.0 78 87 DF(L) = BSURF-CP(NL)+RSF*CM(NL) 79 88 80 89 CALL DTRIDGL(L,AF,BF,CF,DF,XK) 81 90 82 91 C ***UNMIX THE COEFFICIENTS**** 83 92 … … 98 107 99 108 28 CONTINUE 100 109 101 110 RETURN 102 111 END -
trunk/LMDZ.PLUTO/libf/phypluto/gfluxv.F
r3184 r3409 1 1 module gfluxv_mod 2 2 3 3 implicit none 4 4 5 5 contains 6 6 7 7 SUBROUTINE GFLUXV(DTDEL,TDEL,TAUCUMIN,WDEL,CDEL,UBAR0,F0PI,RSF, 8 8 * BTOP,BSURF,FMIDP,FMIDM,DIFFV,FLUXUP,FLUXDN) … … 12 12 C FOR THE VISIBLE FLUX AT ONE WAVELENGTH AND SOLVES FOR THE FLUXES AT 13 13 C THE LEVELS. THIS VERSION IS SET UP TO WORK WITH LAYER OPTICAL DEPTHS 14 C MEASURED FROM THE TOP OF EACH LAYER. (DTAU) TOP OF EACH LAYER HAS 14 C MEASURED FROM THE TOP OF EACH LAYER. (DTAU) TOP OF EACH LAYER HAS 15 15 C OPTICAL DEPTH TAU(N).IN THIS SUB LEVEL N IS ABOVE LAYER N. THAT IS LAYER N 16 16 C HAS LEVEL N ON TOP AND LEVEL N+1 ON BOTTOM. OPTICAL DEPTH INCREASES 17 17 C FROM TOP TO BOTTOM. SEE C.P. MCKAY, TGM NOTES. 18 C THIS SUBROUTINE DIFFERS FROM ITS IR COUNTERPART IN THAT HERE WE SOLVE FOR 18 C THIS SUBROUTINE DIFFERS FROM ITS IR COUNTERPART IN THAT HERE WE SOLVE FOR 19 19 C THE FLUXES DIRECTLY USING THE GENERALIZED NOTATION OF MEADOR AND WEAVOR 20 20 C J.A.S., 37, 630-642, 1980. 21 C THE TRI-DIAGONAL MATRIX SOLVER IS DSOLVER AND IS DOUBLE PRECISION SO MANY 21 C THE TRI-DIAGONAL MATRIX SOLVER IS DSOLVER AND IS DOUBLE PRECISION SO MANY 22 22 C VARIABLES ARE PASSED AS SINGLE THEN BECOME DOUBLE IN DSOLVER 23 23 C … … 29 29 C WDEL(NLEVEL) = SINGLE SCATTERING ALBEDO 30 30 C CDEL(NLL) = ASYMMETRY FACTORS, 0=ISOTROPIC 31 C UBARV = AVERAGE ANGLE, 31 C UBARV = AVERAGE ANGLE, 32 32 C UBAR0 = SOLAR ZENITH ANGLE 33 33 C F0PI = INCIDENT SOLAR DIRECT BEAM FLUX … … 41 41 C added Dec 2002 42 42 C DIFFV = downward diffuse solar flux at the surface 43 C 43 C 44 44 !======================================================================! 45 45 … … 76 76 NAYER = L_NLAYRAD 77 77 TAUMAX = L_TAUMAX !Default is 35.0 78 78 79 79 ! Delta-Eddington Scaling 80 80 … … 91 91 FACTOR = 1.0D0 - WDEL(L)*CDEL(L)**2 92 92 W0(L) = WDEL(L)*(1.0D0-CDEL(L)**2)/FACTOR 93 IF (W0(L).gt.1) THEN 94 W0(L) = 1 95 END IF 93 96 COSBAR(L) = CDEL(L)/(1.0D0+CDEL(L)) 94 97 … … 105 108 FACTOR = 1.0D0 - WDEL(L)*CDEL(L)**2 106 109 W0(L) = WDEL(L)*(1.0D0-CDEL(L)**2)/FACTOR 110 IF (W0(L).gt.1) THEN 111 W0(L) = 1 112 END IF 107 113 COSBAR(L) = CDEL(L)/(1.0D0+CDEL(L)) 108 114 DTAU(L) = DTDEL(L)*FACTOR … … 123 129 ALPHA(L)=SQRT( (1.0-W0(L))/(1.0-W0(L)*COSBAR(L) ) ) 124 130 125 C SET OF CONSTANTS DETERMINED BY DOM 131 C SET OF CONSTANTS DETERMINED BY DOM 126 132 127 133 ! Quadrature method … … 148 154 c but the scaling is Eddington? 149 155 150 LAMDA(L) = SQRT(G1(L)**2 - G2(L)**2) 156 IF (G1(L) - G2(L) < 1E-15) THEN 157 LAMDA(L) = 0 158 ELSE 159 LAMDA(L) = SQRT(G1(L)**2 - G2(L)**2) 160 END IF 151 161 GAMA(L) = (G1(L)-LAMDA(L))/G2(L) 152 162 END DO … … 156 166 G4 = 1.0-G3(L) 157 167 DENOM = LAMDA(L)**2 - 1./UBAR0**2 158 168 159 169 C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 160 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 170 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 161 171 C THE SCATTERING GOES TO ZERO 162 172 C PREVENT THIS WITH AN IF STATEMENT … … 172 182 C CPM1 AND CMM1 ARE THE CPLUS AND CMINUS TERMS EVALUATED 173 183 C AT THE TOP OF THE LAYER, THAT IS LOWER OPTICAL DEPTH TAU(L) 174 184 175 185 CPM1(L) = AP*EXP(-TAU(L)/UBAR0) 176 186 CMM1(L) = AM*EXP(-TAU(L)/UBAR0) … … 185 195 186 196 187 197 188 198 C NOW CALCULATE THE EXPONENTIAL TERMS NEEDED 189 199 C FOR THE TRIDIAGONAL ROTATED LAYERED METHOD … … 204 214 205 215 C NOW WE CALCULATE THE FLUXES AT THE MIDPOINTS OF THE LAYERS. 206 216 207 217 DO L=1,L_NLAYRAD-1 208 218 EXPTRM = MIN(TAUMAX,LAMDA(L)*(TAUCUM(2*L+1)-TAUCUM(2*L))) 209 219 210 220 EP = EXP(EXPTRM) 211 221 … … 215 225 216 226 C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 217 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 227 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 218 228 C THE SCATTERING GOES TO ZERO 219 229 C PREVENT THIS WITH A IF STATEMENT … … 237 247 FMIDP(L) = XK1(L)*EP + GAMA(L)*XK2(L)*EM + CPMID 238 248 FMIDM(L) = XK1(L)*EP*GAMA(L) + XK2(L)*EM + CMMID 239 249 240 250 C ADD THE DIRECT FLUX TO THE DOWNWELLING TERM 241 251 242 252 FMIDM(L)= FMIDM(L)+UBAR0*F0PI*EXP(-MIN(TAUMID,TAUMAX)/UBAR0) 243 244 END DO 245 253 254 END DO 255 246 256 C FLUX AT THE Ptop layer 247 257 … … 256 266 257 267 C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 258 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 268 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 259 269 C THE SCATTERING GOES TO ZERO 260 270 C PREVENT THIS WITH A IF STATEMENT … … 284 294 ! fluxdn = fluxdn+UBAR0*F0PI*EXP(-MIN(TAUCUM(1),TAUMAX)/UBAR0) 285 295 !JL18 the line above assumed that the top of the radiative model was P=0 286 ! it seems to be better for the IR to use the middle of the last physical layer as the radiative top. 296 ! it seems to be better for the IR to use the middle of the last physical layer as the radiative top. 287 297 ! so we correct the downwelling flux below for the calculation of the heating rate 288 298 fluxdn = fluxdn+UBAR0*F0PI*EXP(-TAUCUM(2)/UBAR0) … … 291 301 C DTAU instead of DTAU/2. 292 302 293 L = L_NLAYRAD 303 L = L_NLAYRAD 294 304 EXPTRM = MIN(TAUMAX,LAMDA(L)*(TAUCUM(L_LEVELS)- 295 305 * TAUCUM(L_LEVELS-1))) … … 302 312 303 313 C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 304 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 314 C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 305 315 C THE SCATTERING GOES TO ZERO 306 316 C PREVENT THIS WITH A IF STATEMENT
Note: See TracChangeset
for help on using the changeset viewer.