| 1 | SUBROUTINE sw(ngrid,nlayer,ldiurn, |
|---|
| 2 | $ coefvis,albedo, |
|---|
| 3 | $ plevel,ps_rad,pmu,pfract,psolarf0, |
|---|
| 4 | $ fsrfvis,dtsw, |
|---|
| 5 | $ lwrite) |
|---|
| 6 | USE phys_const |
|---|
| 7 | IMPLICIT NONE |
|---|
| 8 | c======================================================================= |
|---|
| 9 | c |
|---|
| 10 | c Rayonnement solaire en atmosphere non diffusante avec un |
|---|
| 11 | c coefficient d'absoprption gris. |
|---|
| 12 | c |
|---|
| 13 | c======================================================================= |
|---|
| 14 | c |
|---|
| 15 | c declarations: |
|---|
| 16 | c ------------- |
|---|
| 17 | c |
|---|
| 18 | c |
|---|
| 19 | c arguments: |
|---|
| 20 | c ---------- |
|---|
| 21 | c |
|---|
| 22 | INTEGER ngrid,nlayer |
|---|
| 23 | REAL albedo(ngrid),coefvis |
|---|
| 24 | REAL pmu(ngrid),pfract(ngrid) |
|---|
| 25 | REAL plevel(ngrid,nlayer+1),ps_rad |
|---|
| 26 | REAL psolarf0 |
|---|
| 27 | REAL fsrfvis(ngrid),dtsw(ngrid,nlayer) |
|---|
| 28 | LOGICAL lwrite,ldiurn |
|---|
| 29 | c |
|---|
| 30 | c variables locales: |
|---|
| 31 | c ------------------ |
|---|
| 32 | c |
|---|
| 33 | |
|---|
| 34 | REAL zalb(ngrid),zmu(ngrid),zfract(ngrid) |
|---|
| 35 | REAL zplev(ngrid,nlayer+1) |
|---|
| 36 | REAL zflux(ngrid),zdtsw(ngrid,nlayer) |
|---|
| 37 | |
|---|
| 38 | INTEGER ig,l,nlevel,index(ngrid),ncount,igout |
|---|
| 39 | REAL ztrdir(ngrid,nlayer+1),ztrref(ngrid,nlayer+1) |
|---|
| 40 | REAL zfsrfref(ngrid) |
|---|
| 41 | REAL z1(ngrid) |
|---|
| 42 | REAL zu(ngrid,nlayer+1) |
|---|
| 43 | REAL tau0 |
|---|
| 44 | |
|---|
| 45 | LOGICAL firstcall |
|---|
| 46 | SAVE firstcall |
|---|
| 47 | DATA firstcall/.true./ |
|---|
| 48 | !$OMP THREADPRIVATE(firstcall) |
|---|
| 49 | |
|---|
| 50 | c----------------------------------------------------------------------- |
|---|
| 51 | c 1. initialisations: |
|---|
| 52 | c ------------------- |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | nlevel=nlayer+1 |
|---|
| 56 | |
|---|
| 57 | c----------------------------------------------------------------------- |
|---|
| 58 | c Definitions des tableaux locaux pour les points ensoleilles: |
|---|
| 59 | c ------------------------------------------------------------ |
|---|
| 60 | |
|---|
| 61 | IF (ldiurn) THEN |
|---|
| 62 | ncount=0 |
|---|
| 63 | DO ig=1,ngrid |
|---|
| 64 | index(ig)=0 |
|---|
| 65 | ENDDO |
|---|
| 66 | DO ig=1,ngrid |
|---|
| 67 | IF(pfract(ig).GT.1.e-6) THEN |
|---|
| 68 | ncount=ncount+1 |
|---|
| 69 | index(ncount)=ig |
|---|
| 70 | ENDIF |
|---|
| 71 | ENDDO |
|---|
| 72 | CALL monGATHER(ncount,zfract,pfract,index) |
|---|
| 73 | CALL monGATHER(ncount,zmu,pmu,index) |
|---|
| 74 | CALL monGATHER(ncount,zalb,albedo,index) |
|---|
| 75 | DO l=1,nlevel |
|---|
| 76 | CALL monGATHER(ncount,zplev(1,l),plevel(1,l),index) |
|---|
| 77 | ENDDO |
|---|
| 78 | ELSE |
|---|
| 79 | ncount=ngrid |
|---|
| 80 | zfract(:)=pfract(:) |
|---|
| 81 | zmu(:)=pmu(:) |
|---|
| 82 | zalb(:)=albedo(:) |
|---|
| 83 | zplev(:,:)=plevel(:,:) |
|---|
| 84 | ENDIF |
|---|
| 85 | |
|---|
| 86 | c----------------------------------------------------------------------- |
|---|
| 87 | c calcul des profondeurs optiques integres depuis p=0: |
|---|
| 88 | c ---------------------------------------------------- |
|---|
| 89 | |
|---|
| 90 | tau0=-.5*log(coefvis) |
|---|
| 91 | |
|---|
| 92 | c calcul de la partie homogene de l'opacite |
|---|
| 93 | tau0=tau0/ps_rad |
|---|
| 94 | DO l=1,nlayer+1 |
|---|
| 95 | DO ig=1,ncount |
|---|
| 96 | zu(ig,l)=tau0*zplev(ig,l) |
|---|
| 97 | ENDDO |
|---|
| 98 | ENDDO |
|---|
| 99 | |
|---|
| 100 | c----------------------------------------------------------------------- |
|---|
| 101 | c 2. calcul de la transmission depuis le sommet de l'atmosphere: |
|---|
| 102 | c ----------------------------------------------------------- |
|---|
| 103 | |
|---|
| 104 | DO l=1,nlevel |
|---|
| 105 | DO ig=1,ncount |
|---|
| 106 | ztrdir(ig,l)=exp(-zu(ig,l)/zmu(ig)) |
|---|
| 107 | ENDDO |
|---|
| 108 | ENDDO |
|---|
| 109 | |
|---|
| 110 | IF (lwrite) THEN |
|---|
| 111 | igout=ncount/2+1 |
|---|
| 112 | PRINT* |
|---|
| 113 | PRINT*,'Diagnostique des transmission dans le spectre solaire' |
|---|
| 114 | PRINT*,'zfract, zmu, zalb' |
|---|
| 115 | PRINT*,zfract(igout), zmu(igout), zalb(igout) |
|---|
| 116 | PRINT*,'Pression, quantite d abs, transmission' |
|---|
| 117 | DO l=1,nlayer+1 |
|---|
| 118 | PRINT*,zplev(igout,l),zu(igout,l),ztrdir(igout,l) |
|---|
| 119 | ENDDO |
|---|
| 120 | ENDIF |
|---|
| 121 | |
|---|
| 122 | c----------------------------------------------------------------------- |
|---|
| 123 | c 3. taux de chauffage, ray. solaire direct: |
|---|
| 124 | c ------------------------------------------ |
|---|
| 125 | |
|---|
| 126 | DO l=1,nlayer |
|---|
| 127 | DO ig=1,ncount |
|---|
| 128 | zdtsw(ig,l)=g*psolarf0*zfract(ig)*zmu(ig)* |
|---|
| 129 | $ (ztrdir(ig,l+1)-ztrdir(ig,l))/ |
|---|
| 130 | $ (cpp*(zplev(ig,l)-zplev(ig,l+1))) |
|---|
| 131 | ENDDO |
|---|
| 132 | ENDDO |
|---|
| 133 | IF (lwrite) THEN |
|---|
| 134 | PRINT* |
|---|
| 135 | PRINT*,'Diagnostique des taux de chauffage solaires:' |
|---|
| 136 | PRINT*,' 1 taux de chauffage lie au ray. solaire direct' |
|---|
| 137 | DO l=1,nlayer |
|---|
| 138 | PRINT*,zdtsw(igout,l) |
|---|
| 139 | ENDDO |
|---|
| 140 | ENDIF |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | c----------------------------------------------------------------------- |
|---|
| 144 | c 4. calcul du flux solaire arrivant sur le sol: |
|---|
| 145 | c ---------------------------------------------- |
|---|
| 146 | |
|---|
| 147 | DO ig=1,ncount |
|---|
| 148 | z1(ig)=zfract(ig)*zmu(ig)*psolarf0*ztrdir(ig,1) |
|---|
| 149 | zflux(ig)=(1.-zalb(ig))*z1(ig) |
|---|
| 150 | zfsrfref(ig)= zalb(ig)*z1(ig) |
|---|
| 151 | ENDDO |
|---|
| 152 | IF (lwrite) THEN |
|---|
| 153 | PRINT* |
|---|
| 154 | PRINT*,'Diagnostique des taux de chauffage solaires:' |
|---|
| 155 | PRINT*,' 2 flux solaire net incident sur le sol' |
|---|
| 156 | PRINT*,zflux(igout) |
|---|
| 157 | ENDIF |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | c----------------------------------------------------------------------- |
|---|
| 161 | c 5.calcul des traansmissions depuis le sol, cas diffus: |
|---|
| 162 | c ------------------------------------------------------ |
|---|
| 163 | |
|---|
| 164 | DO l=1,nlevel |
|---|
| 165 | DO ig=1,ncount |
|---|
| 166 | ztrref(ig,l)=exp(-(zu(ig,1)-zu(ig,l))*1.66) |
|---|
| 167 | ENDDO |
|---|
| 168 | ENDDO |
|---|
| 169 | |
|---|
| 170 | IF (lwrite) THEN |
|---|
| 171 | PRINT* |
|---|
| 172 | PRINT*,'Diagnostique des taux de chauffage solaires' |
|---|
| 173 | PRINT*,' 3 transmission avec les sol' |
|---|
| 174 | PRINT*,'niveau transmission' |
|---|
| 175 | DO l=1,nlevel |
|---|
| 176 | PRINT*,l,ztrref(igout,l) |
|---|
| 177 | ENDDO |
|---|
| 178 | ENDIF |
|---|
| 179 | |
|---|
| 180 | c----------------------------------------------------------------------- |
|---|
| 181 | c 6.ajout a l'echauffement de la contribution du ray. sol. reflechit: |
|---|
| 182 | c ------------------------------------------------------------------- |
|---|
| 183 | |
|---|
| 184 | DO l=1,nlayer |
|---|
| 185 | DO ig=1,ncount |
|---|
| 186 | zdtsw(ig,l)=zdtsw(ig,l)+ |
|---|
| 187 | $ g*zfsrfref(ig)*(ztrref(ig,l+1)-ztrref(ig,l))/ |
|---|
| 188 | $ (cpp*(zplev(ig,l+1)-zplev(ig,l))) |
|---|
| 189 | ENDDO |
|---|
| 190 | ENDDO |
|---|
| 191 | |
|---|
| 192 | c----------------------------------------------------------------------- |
|---|
| 193 | c 10. sorites eventuelles: |
|---|
| 194 | c ------------------------ |
|---|
| 195 | |
|---|
| 196 | IF (lwrite) THEN |
|---|
| 197 | PRINT* |
|---|
| 198 | PRINT*,'Diagnostique des taux de chauffage solaires:' |
|---|
| 199 | PRINT*,' 3 taux de chauffage total' |
|---|
| 200 | DO l=1,nlayer |
|---|
| 201 | PRINT*,zdtsw(igout,l) |
|---|
| 202 | ENDDO |
|---|
| 203 | ENDIF |
|---|
| 204 | |
|---|
| 205 | IF (ldiurn) THEN |
|---|
| 206 | CALL zerophys(ngrid,fsrfvis) |
|---|
| 207 | CALL monscatter(ncount,fsrfvis,index,zflux) |
|---|
| 208 | CALL zerophys(ngrid*nlayer,dtsw) |
|---|
| 209 | DO l=1,nlayer |
|---|
| 210 | CALL monscatter(ncount,dtsw(1,l),index,zdtsw(1,l)) |
|---|
| 211 | ENDDO |
|---|
| 212 | ELSE |
|---|
| 213 | print*,'NOT DIURNE' |
|---|
| 214 | fsrfvis(:)=zflux(:) |
|---|
| 215 | dtsw(:,:)=zdtsw(:,:) |
|---|
| 216 | ENDIF |
|---|
| 217 | c call dump2d(iim,jjm-1,zflux(2),'ZFLUX ') |
|---|
| 218 | c call dump2d(iim,jjm-1,fsrfvis(2),'FSRVIS ') |
|---|
| 219 | c call dump2d(iim,jjm-1,ztrdir(2,1),'ztrdir ') |
|---|
| 220 | c call dump2d(iim,jjm-1,pmu(2),'pmu ') |
|---|
| 221 | c call dump2d(iim,jjm-1,pfract(2),'pfract ') |
|---|
| 222 | c call dump2d(iim,jjm-1,albedo(2),'albedo ') |
|---|
| 223 | c call dump2d(iim,jjm-1,ztrdir(2,1),'ztrdir ') |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | RETURN |
|---|
| 227 | END |
|---|