1 | subroutine lwmain (ig0,icount,kdlon,kflev |
---|
2 | . ,dp,dt0,emis |
---|
3 | . ,plev,tlev,tlay,aerosol,coolrate |
---|
4 | . ,fluxground,fluxtop |
---|
5 | . ,netrad |
---|
6 | & ,QIRsQREF3d,omegaIR3d,gIR3d |
---|
7 | & ,co2ice) |
---|
8 | |
---|
9 | c---------------------------------------------------------------------- |
---|
10 | c LWMAIN organizes the LTE longwave calculations |
---|
11 | c for layer 1 to layer "nlaylte" (stored in "yomlw_h") |
---|
12 | c---------------------------------------------------------------------- |
---|
13 | |
---|
14 | use dimradmars_mod, only: ndlo2, nflev, nir, ndlon, nuco2 |
---|
15 | use dimradmars_mod, only: naerkind |
---|
16 | use yomlw_h, only: nlaylte, xi |
---|
17 | implicit none |
---|
18 | |
---|
19 | #include "callkeys.h" |
---|
20 | #include "comg1d.h" |
---|
21 | |
---|
22 | c---------------------------------------------------------------------- |
---|
23 | c 0.1 arguments |
---|
24 | c --------- |
---|
25 | c inputs: |
---|
26 | c ------- |
---|
27 | integer ig0 |
---|
28 | integer icount |
---|
29 | integer kdlon ! part of ngrid |
---|
30 | integer kflev ! part of nlayer |
---|
31 | |
---|
32 | real dp (ndlo2,kflev) ! layer pressure thickness (Pa) |
---|
33 | real dt0 (ndlo2) ! surface temperature discontinuity (K) |
---|
34 | real emis (ndlo2) ! surface emissivity |
---|
35 | real plev (ndlo2,kflev+1) ! level pressure (Pa) |
---|
36 | real tlev (ndlo2,kflev+1) ! level temperature (K) |
---|
37 | real tlay (ndlo2,kflev) ! layer temperature (K) |
---|
38 | real aerosol(ndlo2,kflev,naerkind) ! aerosol extinction optical |
---|
39 | c depth at reference wavelength "longrefvis" set |
---|
40 | c in dimradmars_mod , in each layer, for one of |
---|
41 | c the "naerkind" kind of aerosol optical properties. |
---|
42 | |
---|
43 | |
---|
44 | c outputs: |
---|
45 | c -------- |
---|
46 | real coolrate(ndlo2,kflev) ! cooling rate (K/s) |
---|
47 | real fluxground(ndlo2) ! downward ground flux (W/m2) |
---|
48 | real fluxtop(ndlo2) ! outgoing upward flux (W/m2) ("OLR") |
---|
49 | real netrad (ndlo2,kflev) ! radiative budget (W/m2) |
---|
50 | c Aerosol optical properties |
---|
51 | REAL :: QIRsQREF3d(ndlo2,kflev,nir,naerkind) |
---|
52 | REAL :: omegaIR3d(ndlo2,kflev,nir,naerkind) |
---|
53 | REAL :: gIR3d(ndlo2,kflev,nir,naerkind) |
---|
54 | |
---|
55 | c---------------------------------------------------------------------- |
---|
56 | c 0.2 local arrays |
---|
57 | c ------------ |
---|
58 | |
---|
59 | real aer_t (ndlon,nuco2,nflev+1) ! transmission (aer) |
---|
60 | real co2_u (ndlon,nuco2,nflev+1) ! absorber amounts (co2) |
---|
61 | real co2_up (ndlon,nuco2,nflev+1) ! idem scaled by the pressure (co2) |
---|
62 | |
---|
63 | real bsurf (ndlon,nir) ! surface spectral planck function |
---|
64 | real btop (ndlon,nir) ! top spectral planck function |
---|
65 | real blev (ndlon,nir,nflev+1) ! level spectral planck function |
---|
66 | real blay (ndlon,nir,nflev) ! layer spectral planck function |
---|
67 | real dblay (ndlon,nir,nflev) ! layer gradient spectral planck function |
---|
68 | real dbsublay (ndlon,nir,2*nflev) ! layer gradient spectral planck function |
---|
69 | ! in sub layers |
---|
70 | |
---|
71 | real tautotal(ndlon,nflev,nir) ! \ Total single scattering |
---|
72 | real omegtotal(ndlon,nflev,nir) ! > properties (Addition of the |
---|
73 | real gtotal(ndlon,nflev,nir) ! / NAERKIND aerosols prop.) |
---|
74 | |
---|
75 | real newcoolrate(ndlon,nflev) ! cooling rate (K/s) / with implicite scheme |
---|
76 | |
---|
77 | REAL co2ice(ndlo2) ! co2 ice surface layer (kg.m-2) |
---|
78 | REAL emis_gaz(ndlo2) ! emissivity for gaz computations |
---|
79 | |
---|
80 | integer jk,jkk,ja,jl |
---|
81 | |
---|
82 | logical firstcall |
---|
83 | save firstcall |
---|
84 | data firstcall/.true./ |
---|
85 | |
---|
86 | |
---|
87 | c---------------------------------------------------------------------- |
---|
88 | c 0.3 Initialisation |
---|
89 | c -------------- |
---|
90 | |
---|
91 | if (firstcall) then |
---|
92 | |
---|
93 | firstcall = .false. |
---|
94 | |
---|
95 | xi (:,:,:,:)=0. |
---|
96 | |
---|
97 | endif |
---|
98 | |
---|
99 | DO jl=1 , kdlon |
---|
100 | IF(co2ice(jl) .GT. 20.e-3) THEN |
---|
101 | emis_gaz(jl)=1. |
---|
102 | ELSE |
---|
103 | emis_gaz(jl)=emis(jl) |
---|
104 | ENDIF |
---|
105 | ENDDO |
---|
106 | |
---|
107 | c---------------------------------------------------------------------- |
---|
108 | c 1.0 planck function |
---|
109 | c --------------- |
---|
110 | |
---|
111 | call lwb ( kdlon, kflev, tlev, tlay, dt0 |
---|
112 | . , bsurf, btop, blay, blev, dblay, dbsublay) |
---|
113 | |
---|
114 | c---------------------------------------------------------------------- |
---|
115 | c 2.0 absorber amounts |
---|
116 | c ---------------- |
---|
117 | |
---|
118 | call lwu ( kdlon, kflev |
---|
119 | . , dp, plev, tlay, aerosol |
---|
120 | & , QIRsQREF3d,omegaIR3d,gIR3d |
---|
121 | . , aer_t, co2_u, co2_up |
---|
122 | . , tautotal,omegtotal,gtotal) |
---|
123 | |
---|
124 | c---------------------------------------------------------------------- |
---|
125 | c 3.0 transmission functions / exchange coefficiants |
---|
126 | c ---------------------------------------------- |
---|
127 | |
---|
128 | c distants |
---|
129 | c -------- |
---|
130 | if( mod(icount-1,ilwd).eq.0) then |
---|
131 | |
---|
132 | c print*, 'CALL of DISTANTS' |
---|
133 | call lwxd ( ig0, kdlon, kflev, emis_gaz |
---|
134 | . , aer_t, co2_u, co2_up) |
---|
135 | |
---|
136 | endif |
---|
137 | c neighbours |
---|
138 | c ---------- |
---|
139 | if( mod(icount-1,ilwn).eq.0) then |
---|
140 | |
---|
141 | c print*, 'CALL of NEIGHBOURS' |
---|
142 | call lwxn ( ig0, kdlon, kflev |
---|
143 | . , dp |
---|
144 | . , aer_t, co2_u, co2_up) |
---|
145 | |
---|
146 | endif |
---|
147 | c boundaries |
---|
148 | c ---------- |
---|
149 | if( mod(icount-1,ilwb).eq.0) then |
---|
150 | |
---|
151 | c print*, 'CALL of BOUNDARIES' |
---|
152 | call lwxb ( ig0, kdlon, kflev, emis_gaz |
---|
153 | . , aer_t, co2_u, co2_up) |
---|
154 | |
---|
155 | endif |
---|
156 | |
---|
157 | c---------------------------------------------------------------------- |
---|
158 | c 4.0 cooling rate |
---|
159 | c ------------ |
---|
160 | |
---|
161 | call lwflux ( ig0, kdlon, kflev, dp |
---|
162 | . , bsurf, btop, blev, blay, dbsublay |
---|
163 | . , tlay, tlev, dt0 ! pour sortie dans g2d uniquement |
---|
164 | . , emis |
---|
165 | . , tautotal,omegtotal,gtotal |
---|
166 | . , coolrate, fluxground, fluxtop |
---|
167 | . , netrad) |
---|
168 | |
---|
169 | c do jk = 1, nlaylte |
---|
170 | c print*,coolrate(1,jk) |
---|
171 | c enddo |
---|
172 | |
---|
173 | c do jkk = 0 , nlaylte+1 |
---|
174 | c do jk = 0 , nlaylte+1 |
---|
175 | c do ja = 1 , nuco2 |
---|
176 | c do jl = 1 , ngrid |
---|
177 | c if (xi (jl,ja,jk,jkk) .LT. 0 |
---|
178 | c . .OR. xi (jl,ja,jk,jkk) .GT. 1 ) then |
---|
179 | c print*,'xi bande',ja,jk,jkk,xi (jl,ja,jk,jkk) |
---|
180 | c endif |
---|
181 | c enddo |
---|
182 | c enddo |
---|
183 | c enddo |
---|
184 | c enddo |
---|
185 | |
---|
186 | c---------------------------------------------------------------------- |
---|
187 | c |
---|
188 | c 5. shema semi-implicite (lwi) |
---|
189 | c --------------------------- |
---|
190 | c |
---|
191 | c |
---|
192 | call lwi (ig0,kdlon,kflev,netrad,dblay,dp |
---|
193 | . , newcoolrate) |
---|
194 | c |
---|
195 | c Verif que (X sol,space) + somme(X i,sol) = 1 |
---|
196 | c |
---|
197 | do jkk = 1 , nlaylte |
---|
198 | do jl = 1 , kdlon |
---|
199 | c print*,'NEW et OLD coolrate :',jkk,newcoolrate(jl,jkk) |
---|
200 | c . ,coolrate(jl,jkk) |
---|
201 | coolrate(jl,jkk) = newcoolrate(jl,jkk) |
---|
202 | enddo |
---|
203 | enddo |
---|
204 | c |
---|
205 | c---------------------------------------------------------------------- |
---|
206 | |
---|
207 | return |
---|
208 | end |
---|