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