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