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