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