1 | SUBROUTINE SWMAIN ( KDLON, KFLEV, |
---|
2 | $ PCST, albedo, |
---|
3 | $ PRMU0, PDP, PPLEV, aerosol,PFRACT, |
---|
4 | $ PHEAT, PFLUXD,PFLUXU, |
---|
5 | & QVISsQREF3d,omegaVIS3d,gVIS3d) |
---|
6 | |
---|
7 | use dimradmars_mod, only: ndlo2, ndlon, nflev, |
---|
8 | & nsun,naerkind |
---|
9 | use yomlw_h, only: nlaylte, gcp |
---|
10 | IMPLICIT NONE |
---|
11 | |
---|
12 | #include "callkeys.h" |
---|
13 | c |
---|
14 | c PURPOSE. |
---|
15 | c -------- |
---|
16 | c |
---|
17 | c This routine computes the shortwave (solar wavelength) |
---|
18 | c radiation fluxes in two spectral intervals |
---|
19 | c and heating rate on the first "nlaylte" layers. |
---|
20 | C |
---|
21 | c Francois Forget (2000), adapted from |
---|
22 | C Fouquart and Bonnel's ECMWF program |
---|
23 | c |
---|
24 | C IMPLICIT ARGUMENTS : |
---|
25 | C -------------------- |
---|
26 | C |
---|
27 | C ==== INPUTS === |
---|
28 | c |
---|
29 | c KDLON : number of horizontal grid points |
---|
30 | c PCST : Solar constant on Mars (W.m-2) |
---|
31 | c albedo hemispheric surface albedo |
---|
32 | c albedo (i,1) : mean albedo for solar band#1 |
---|
33 | c (see below) |
---|
34 | c albedo (i,2) : mean albedo for solar band#2 |
---|
35 | c (see below) |
---|
36 | c PRMU0 : cos of solar zenith angle (=1 when sun at zenith) |
---|
37 | c PDP : Layer thickness (Pa) |
---|
38 | c PPLEV pressure (Pa) at boundaries of each layer |
---|
39 | c aerosol aerosol extinction optical depth |
---|
40 | c at reference wavelength "longrefvis" set |
---|
41 | c in dimradmars_mod , in each layer, for one of |
---|
42 | c the "naerkind" kind of aerosol optical properties. |
---|
43 | c Pfract : day fraction of the time interval |
---|
44 | c =1 during the full day ; =0 during the night |
---|
45 | c QVISsQREF3d,omegaVIS3d,gVIS3d Aerosol optical properties |
---|
46 | c |
---|
47 | C ==== OUTPUTS === |
---|
48 | c PHEAT : Heating rate (K/s) |
---|
49 | c PFLUXD : SW downward flux at boundaries of each layer (W.m-2) |
---|
50 | c PFLUXU : SW upward flux at boundaries of each layer (W.m-2) |
---|
51 | C |
---|
52 | C ---------- |
---|
53 | C |
---|
54 | C----------------------------------------------------------------------- |
---|
55 | C |
---|
56 | C |
---|
57 | C----------------------------------------------------------------------- |
---|
58 | C |
---|
59 | C ARGUMENTS |
---|
60 | C --------- |
---|
61 | |
---|
62 | INTEGER KDLON, KFLEV |
---|
63 | REAL ZPSOL(NDLO2), aerosol(NDLO2,KFLEV,naerkind),PRMU0(NDLO2) |
---|
64 | real PCST |
---|
65 | REAL albedo(NDLO2,2) |
---|
66 | REAL PDP(NDLO2,KFLEV) |
---|
67 | REAL PPLEV(NDLO2,KFLEV+1) |
---|
68 | REAL PHEAT(NDLO2,KFLEV) |
---|
69 | REAL PFRACT(NDLO2) |
---|
70 | real PFLUXD(NDLON,NFLEV+1,2) |
---|
71 | real PFLUXU(NDLON,NFLEV+1,2) |
---|
72 | REAL :: QVISsQREF3d(NDLO2,KFLEV,nsun,naerkind) |
---|
73 | REAL :: omegaVIS3d(NDLO2,KFLEV,nsun,naerkind) |
---|
74 | REAL :: gVIS3d(NDLO2,KFLEV,nsun,naerkind) |
---|
75 | |
---|
76 | C LOCAL ARRAYS |
---|
77 | C ------------ |
---|
78 | |
---|
79 | REAL ZDSIG(NDLON,NFLEV), ZFACT(NDLON) |
---|
80 | S , ZFD(NDLON,NFLEV+1) |
---|
81 | S , ZFU(NDLON,NFLEV+1) |
---|
82 | S , ZRMU(NDLON), ZSEC(NDLON) |
---|
83 | S , ZUD(NDLON,3,NFLEV+1), ZUM(NDLON,NFLEV+1) |
---|
84 | REAL ZSIGN(NDLON), ZSIGO(NDLON) |
---|
85 | |
---|
86 | c following line has been changed, kflev--->nflev (to avoid error message |
---|
87 | c when compiling on NASA Ames Sun) |
---|
88 | REAL ZFDOWN(NDLO2,NFLEV+1),ZFUP(NDLO2,NFLEV+1) |
---|
89 | |
---|
90 | integer jl, jk, jkp1, jkl |
---|
91 | integer INU |
---|
92 | real zdfnet |
---|
93 | |
---|
94 | C ------------------------------------------------------------------ |
---|
95 | C Initializations : |
---|
96 | C ------------------------------------------------------------------ |
---|
97 | |
---|
98 | c Incident Solar flux and corrected angle in the atmosphere |
---|
99 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
100 | DO JL = 1 , KDLON |
---|
101 | c Incident Flux at the top of the atmosphere |
---|
102 | ZFACT(JL)= PRMU0(JL) * PCST * PFRACT(JL) |
---|
103 | |
---|
104 | c Cos of solar zenith angle CORRECTED for high zenith angle |
---|
105 | if (PRMU0(JL).GT.0) then |
---|
106 | ZRMU(JL)=SQRT(1224.* PRMU0(JL) * PRMU0(JL) + 1.) / 35. |
---|
107 | else |
---|
108 | ZRMU(JL)= 1. / 35. |
---|
109 | endif |
---|
110 | ZSEC(JL)=1./ZRMU(JL) |
---|
111 | END DO |
---|
112 | |
---|
113 | c Calcul of ZDSIG (thickness of layers in sigma coordinates) |
---|
114 | c ~~~~~~~~~~~~~~~ |
---|
115 | DO JL = 1 , KDLON |
---|
116 | ZSIGO(JL) = 1.0 |
---|
117 | ZPSOL(JL) = PPLEV(JL,1) |
---|
118 | END DO |
---|
119 | DO JK = 1 , nlaylte |
---|
120 | JKP1 = JK + 1 |
---|
121 | JKL = nlaylte+1 - JK |
---|
122 | DO JL = 1 , KDLON |
---|
123 | ZSIGN(JL) = PPLEV(JL,JKP1) / PPLEV(JL,1) |
---|
124 | ZDSIG(JL,JK) = ZSIGO(JL) - ZSIGN(JL) |
---|
125 | ZSIGO(JL) = ZSIGN(JL) |
---|
126 | END DO |
---|
127 | END DO |
---|
128 | |
---|
129 | C------------------------------------------------------------------ |
---|
130 | C LOOP ON SPECTRAL INTERVAL in solar spectrum |
---|
131 | C------------------------------------------------------------------ |
---|
132 | c 2 spectral interval in solar spectrum : |
---|
133 | c - INU=1: between wavelength "long1vis" and "long2vis" set in dimradmars_mod |
---|
134 | c - INU=2: between wavelength "long2vis" and "long3vis" set in dimradmars_mod |
---|
135 | |
---|
136 | DO INU = 1,2 |
---|
137 | |
---|
138 | ! NB: swrtype is set in callkeys.h |
---|
139 | if (swrtype.eq.1) then ! Fouquart |
---|
140 | CALL SWR_FOUQUART( KDLON, kflev, INU |
---|
141 | & , aerosol,QVISsQREF3d,omegaVIS3d,gVIS3d |
---|
142 | & , albedo,ZDSIG,ZPSOL,ZRMU,ZSEC |
---|
143 | & , ZFD,ZFU ) |
---|
144 | else |
---|
145 | if (swrtype.eq.2) then ! Toon |
---|
146 | CALL SWR_TOON( KDLON, kflev, INU |
---|
147 | & , aerosol,QVISsQREF3d,omegaVIS3d,gVIS3d |
---|
148 | & , albedo,ZDSIG,ZPSOL,ZRMU,ZSEC |
---|
149 | & , ZFD,ZFU ) |
---|
150 | else |
---|
151 | write(*,*) "swmain: invalid swrtype value !!" |
---|
152 | stop |
---|
153 | endif ! of if (swrtype.eq.2) |
---|
154 | endif ! of if (swrtype.eq.1) |
---|
155 | |
---|
156 | DO JK = 1 , nlaylte+1 |
---|
157 | DO JL = 1 , KDLON |
---|
158 | PFLUXD(JL,JK,INU)=ZFD(JL,JK)*ZFACT(JL) |
---|
159 | PFLUXU(JL,JK,INU)=ZFU(JL,JK)*ZFACT(JL) |
---|
160 | END DO |
---|
161 | END DO |
---|
162 | END DO ! of DO INU=1,2 |
---|
163 | |
---|
164 | C ------------------------------------------------------ |
---|
165 | C HEATING RATES |
---|
166 | C ------------------------------------------------------ |
---|
167 | |
---|
168 | DO JK = 1 , nlaylte+1 |
---|
169 | DO JL = 1 , KDLON |
---|
170 | c wavelength integrated flux at every level: |
---|
171 | ZFUP(JL,JK)= (PFLUXU(JL,JK,1)+ PFLUXU(JL,JK,2)) |
---|
172 | ZFDOWN(JL,JK)= (PFLUXD(JL,JK,1)+ PFLUXD(JL,JK,2)) |
---|
173 | END DO |
---|
174 | END DO |
---|
175 | |
---|
176 | DO JK = 1 , nlaylte |
---|
177 | DO JL = 1 , KDLON |
---|
178 | ZDFNET = ZFUP (JL,JK ) - ZFDOWN(JL,JK ) |
---|
179 | S -ZFUP (JL,JK+1) + ZFDOWN(JL,JK+1) |
---|
180 | c Heating rate |
---|
181 | PHEAT(JL,JK) = gcp * ZDFNET / PDP(JL,JK) |
---|
182 | END DO |
---|
183 | END DO |
---|
184 | |
---|
185 | RETURN |
---|
186 | END |
---|