Changeset 787 for trunk/LMDZ.GENERIC/libf
- Timestamp:
- Sep 19, 2012, 8:26:55 PM (12 years ago)
- Location:
- trunk/LMDZ.GENERIC/libf
- Files:
-
- 6 added
- 8 deleted
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/dyn3d/calfis.F
r751 r787 72 72 #include "comgeom2.h" 73 73 #include "control.h" 74 75 #include "advtrac.h" 76 !! this is to get tnom (tracers name) 74 77 75 78 c Arguments : … … 422 425 423 426 CALL physiq (ngridmx,llm,nq, 427 . tnom, 424 428 , debut,lafin, 425 429 , rday_ecri,heure,dtphys, -
trunk/LMDZ.GENERIC/libf/dyn3d/ini_archive.F
r711 r787 34 34 35 35 c======================================================================= 36 37 USE comsoil_h 36 38 37 39 implicit none … … 49 51 #include "serre.h" 50 52 #include "control.h" 51 #include"comsoil.h"52 53 53 54 #include "netcdf.inc" -
trunk/LMDZ.GENERIC/libf/dyn3d/lect_start_archive.F
r588 r787 3 3 & q,qsurf,surfith,nid) 4 4 5 USE surfdat_h 6 USE comsoil_h 7 USE tracer_h 8 5 9 c======================================================================= 6 10 c … … 22 26 #include "dimensions.h" 23 27 #include "dimphys.h" 24 #include "surfdat.h"25 #include "comsoil.h"26 28 #include "planete.h" 27 29 #include "paramet.h" … … 36 38 #include "lmdstd.h" 37 39 #include "netcdf.inc" 38 #include "tracer.h"39 40 #include"advtrac.h" 40 41 c======================================================================= -
trunk/LMDZ.GENERIC/libf/dyn3d/newstart.F
r699 r787 15 15 c======================================================================= 16 16 17 USE tracer_h 18 USE comsoil_h 19 USE surfdat_h 20 USE comgeomfi_h 21 17 22 implicit none 18 23 19 24 #include "dimensions.h" 20 25 #include "dimphys.h" 21 #include "surfdat.h"22 #include "comsoil.h"23 26 #include "planete.h" 24 27 #include "paramet.h" … … 37 40 #include "netcdf.inc" 38 41 #include "advtrac.h" 39 #include "tracer.h"40 42 c======================================================================= 41 43 c Declarations … … 243 245 ! tnom(:) now contains tracer names 244 246 ! JL12 we will need the tracer names to read start in dyneta0 247 248 ! Initialize global tracer indexes (stored in tracer.h) 249 ! ... this has to be done before phyetat0 250 call initracer(ngridmx,nqmx,tnom) 251 245 252 246 253 c----------------------------------------------------------------------- … … 293 300 . ps,phis,time) 294 301 302 303 ! ALLOCATE ARRAYS IN comgeomfi_h (done in inifis usually) 304 IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngridmx)) 305 IF (.not. ALLOCATED(long)) ALLOCATE(long(ngridmx)) 306 IF (.not. ALLOCATED(area)) ALLOCATE(area(ngridmx)) 307 cursor = 1 ! added by AS in dimphys. 1 for sequential runs. 308 295 309 write(*,*) 'Reading file STARTFI' 296 310 fichnom = 'startfi.nc' 297 CALL phyetat0 ( fichnom,tab0,Lmodif,nsoilmx,nqmx,311 CALL phyetat0 (ngridmx,fichnom,tab0,Lmodif,nsoilmx,nqmx, 298 312 . day_ini,time, 299 313 . tsurf,tsoil,emis,q2,qsurf, !) ! temporary modif by RDW … … 352 366 c----------------------------------------------------------------------- 353 367 if (choix_1.eq.0) then 354 call tabfi (n id,Lmodif,tab0,day_ini,lllm,p_rad,368 call tabfi (ngridmx,nid,Lmodif,tab0,day_ini,lllm,p_rad, 355 369 . p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time) 356 370 else if (choix_1.eq.1) then 357 371 Lmodif=1 ! Lmodif set to 1 to allow modifications in phyeta0 358 call tabfi (n id_fi,Lmodif,tab0,day_ini,lllm,p_rad,372 call tabfi (ngridmx,nid_fi,Lmodif,tab0,day_ini,lllm,p_rad, 359 373 . p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time) 360 374 endif … … 369 383 kappa = 8.314*1000./(p_mugaz*p_cpp) ! added by RDW 370 384 371 372 385 c======================================================================= 373 386 c INITIALISATIONS DIVERSES 374 387 c======================================================================= 375 ! Initialize global tracer indexes (stored in tracer.h)376 call initracer()377 388 ! Load parameters from run.def file 378 389 CALL defrun_new( 99, .TRUE. ) … … 1413 1424 1414 1425 1415 call physdem1( "restartfi.nc",lonfi,latfi,nsoilmx,nqmx,1426 call physdem1(ngridmx,"restartfi.nc",lonfi,latfi,nsoilmx,nqmx, 1416 1427 . dtphys,float(day_ini), 1417 1428 . time,tsurf,tsoil,emis,q2,qsurf, 1418 1429 . airefi,albfi,ithfi,zmea,zstd,zsig,zgam,zthe, 1419 . cloudfrac,totalfrac,hice )1430 . cloudfrac,totalfrac,hice,tnom) 1420 1431 1421 1432 c======================================================================= -
trunk/LMDZ.GENERIC/libf/dyn3d/start2archive.F
r711 r787 18 18 c 19 19 c======================================================================= 20 21 USE comsoil_h 20 22 21 23 implicit none … … 34 36 35 37 #include "dimphys.h" 36 #include "comsoil.h"37 38 #include "planete.h" 38 39 #include"advtrac.h" … … 162 163 Lmodif=0 163 164 164 CALL phyetat0 (fichnom,0,Lmodif,nsoilmx,nqmx,day_ini_fi,timefi, 165 CALL phyetat0 (ngridmx,fichnom,0,Lmodif,nsoilmx,nqmx,day_ini_fi, 166 . timefi, 165 167 . tsurf,tsoil,emis,q2,qsurf, 166 168 ! change FF 05/2011 -
trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90
r741 r787 4 4 use radinc_h, only : L_TAUMAX,naerkind 5 5 use aerosol_mod 6 USE comgeomfi_h 7 USE tracer_h 6 8 7 9 implicit none … … 28 30 ! pq Aerosol mixing ratio 29 31 ! reffrad(ngrid,nlayer,naerkind) Aerosol effective radius 30 ! QREFvis3d(ngrid mx,nlayermx,naerkind) \ 3d extinction coefficients31 ! QREFir3d(ngrid mx,nlayermx,naerkind) / at reference wavelengths32 ! QREFvis3d(ngrid,nlayermx,naerkind) \ 3d extinction coefficients 33 ! QREFir3d(ngrid,nlayermx,naerkind) / at reference wavelengths 32 34 ! 33 35 ! Output … … 42 44 #include "callkeys.h" 43 45 #include "comcstfi.h" 44 #include "comgeomfi.h"45 #include "tracer.h"46 46 #include "comvert.h" 47 47 … … 53 53 REAL aerosol(ngrid,nlayer,naerkind) 54 54 REAL reffrad(ngrid,nlayer,naerkind) 55 REAL QREFvis3d(ngrid mx,nlayermx,naerkind)56 REAL QREFir3d(ngrid mx,nlayermx,naerkind)55 REAL QREFvis3d(ngrid,nlayermx,naerkind) 56 REAL QREFir3d(ngrid,nlayermx,naerkind) 57 57 58 58 REAL tau_col(ngrid) 59 59 ! REAL tauref(ngrid), tau_col(ngrid) 60 60 61 real cloudfrac(ngrid mx,nlayermx)61 real cloudfrac(ngrid,nlayermx) 62 62 real aerosol0 63 63 … … 77 77 ! for fixed dust profiles 78 78 real topdust, expfactor, zp 79 REAL taudusttmp(ngrid mx) ! Temporary dust opacity used before scaling80 REAL tauh2so4tmp(ngrid mx) ! Temporary h2so4 opacity used before scaling79 REAL taudusttmp(ngrid) ! Temporary dust opacity used before scaling 80 REAL tauh2so4tmp(ngrid) ! Temporary h2so4 opacity used before scaling 81 81 ! BENJAMIN MODIFS 82 82 real CLFtot 83 real totcloudfrac(ngrid mx)83 real totcloudfrac(ngrid) 84 84 logical clearsky 85 85 … … 87 87 IF (firstcall) THEN 88 88 89 ! are these tests of any real use ?90 IF(ngrid.NE.ngridmx) THEN91 PRINT*,'STOP in aeropacity!'92 PRINT*,'problem of dimensions:'93 PRINT*,'ngrid =',ngrid94 PRINT*,'ngridmx =',ngridmx95 STOP96 ENDIF97 98 if (nq.gt.nqmx) then99 write(*,*) 'STOP in aeropacity: (nq .gt. nqmx)!'100 write(*,*) 'nq=',nq,' nqmx=',nqmx101 stop102 endif103 104 89 write(*,*) "Tracers found in aeropacity:" 105 do iq=1,nq mx90 do iq=1,nq 106 91 tracername=noms(iq) 107 92 if (tracername.eq."co2_ice") then … … 150 135 iaer=iaero_co2 151 136 ! 1. Initialization 152 aerosol(1:ngrid mx,1:nlayermx,iaer)=0.0137 aerosol(1:ngrid,1:nlayermx,iaer)=0.0 153 138 ! 2. Opacity calculation 154 139 if (noaero) then ! aerosol set to a very low value 155 aerosol(1:ngrid mx,1:nlayermx,iaer)=1.e-9140 aerosol(1:ngrid,1:nlayermx,iaer)=1.e-9 156 141 elseif (aerofixco2.or.(i_co2ice.eq.0)) then ! CO2 ice cloud prescribed 157 aerosol(1:ngrid mx,1:nlayermx,iaer)=1.e-9158 !aerosol(1:ngrid mx,12,iaer)=4.0 ! single cloud layer option142 aerosol(1:ngrid,1:nlayermx,iaer)=1.e-9 143 !aerosol(1:ngrid,12,iaer)=4.0 ! single cloud layer option 159 144 else 160 145 DO ig=1, ngrid … … 187 172 iaer=iaero_h2o 188 173 ! 1. Initialization 189 aerosol(1:ngrid mx,1:nlayermx,iaer)=0.0174 aerosol(1:ngrid,1:nlayermx,iaer)=0.0 190 175 ! 2. Opacity calculation 191 176 if (aerofixh2o.or.(i_h2oice.eq.0).or.clearsky) then 192 aerosol(1:ngrid mx,1:nlayermx,iaer) =1.e-9177 aerosol(1:ngrid,1:nlayermx,iaer) =1.e-9 193 178 194 179 ! put cloud at cloudlvl … … 241 226 242 227 if(CLFvarying)then 243 call totalcloudfrac( cloudfrac,totcloudfrac,pplev,pq,aerosol(1:ngridmx,1:nlayermx,iaer))228 call totalcloudfrac(ngrid,nq,cloudfrac,totcloudfrac,pplev,pq,aerosol(1:ngrid,1:nlayermx,iaer)) 244 229 do ig=1, ngrid 245 230 do l=1,nlayer-1 ! to stop the rad tran bug … … 268 253 iaer=iaero_dust 269 254 ! 1. Initialization 270 aerosol(1:ngrid mx,1:nlayermx,iaer)=0.0255 aerosol(1:ngrid,1:nlayermx,iaer)=0.0 271 256 272 257 topdust=30.0 ! km (used to be 10.0 km) LK … … 322 307 323 308 ! 1. Initialization 324 aerosol(1:ngrid mx,1:nlayermx,iaer)=0.0309 aerosol(1:ngrid,1:nlayermx,iaer)=0.0 325 310 326 311 … … 386 371 end do 387 372 388 do ig=1, 373 do ig=1,ngrid 389 374 do l=1,nlayer 390 375 do iaer = 1, naerkind … … 399 384 end do 400 385 401 do ig=1, 386 do ig=1,ngrid 402 387 if(tau_col(ig).gt.1.e3)then 403 388 print*,'WARNING: tau_col=',tau_col(ig) -
trunk/LMDZ.GENERIC/libf/phystd/aeroptproperties.F90
r726 r787 60 60 INTEGER :: grid_i,grid_j 61 61 ! Intermediate variable 62 REAL :: var_tmp,var3d_tmp(ngrid mx,nlayermx)62 REAL :: var_tmp,var3d_tmp(ngrid,nlayermx) 63 63 ! Bilinear interpolation factors 64 64 REAL :: kx,ky,k1,k2,k3,k4 … … 161 161 INTEGER :: ngrid,nlayer 162 162 ! Aerosol effective radius used for radiative transfer (meter) 163 REAL :: reffrad(ngrid mx,nlayermx,naerkind)163 REAL :: reffrad(ngrid,nlayermx,naerkind) 164 164 ! Aerosol effective variance used for radiative transfer (n.u.) 165 REAL :: nueffrad(ngrid mx,nlayermx,naerkind)165 REAL :: nueffrad(ngrid,nlayermx,naerkind) 166 166 167 167 ! Outputs 168 168 ! ------- 169 169 170 REAL :: QVISsQREF3d(ngrid mx,nlayermx,L_NSPECTV,naerkind)171 REAL :: omegaVIS3d(ngrid mx,nlayermx,L_NSPECTV,naerkind)172 REAL :: gVIS3d(ngrid mx,nlayermx,L_NSPECTV,naerkind)173 174 REAL :: QIRsQREF3d(ngrid mx,nlayermx,L_NSPECTI,naerkind)175 REAL :: omegaIR3d(ngrid mx,nlayermx,L_NSPECTI,naerkind)176 REAL :: gIR3d(ngrid mx,nlayermx,L_NSPECTI,naerkind)177 178 REAL :: QREFvis3d(ngrid mx,nlayermx,naerkind)179 REAL :: QREFir3d(ngrid mx,nlayermx,naerkind)180 181 REAL :: omegaREFvis3d(ngrid mx,nlayermx,naerkind)182 REAL :: omegaREFir3d(ngrid mx,nlayermx,naerkind)170 REAL :: QVISsQREF3d(ngrid,nlayermx,L_NSPECTV,naerkind) 171 REAL :: omegaVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 172 REAL :: gVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 173 174 REAL :: QIRsQREF3d(ngrid,nlayermx,L_NSPECTI,naerkind) 175 REAL :: omegaIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 176 REAL :: gIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 177 178 REAL :: QREFvis3d(ngrid,nlayermx,naerkind) 179 REAL :: QREFir3d(ngrid,nlayermx,naerkind) 180 181 REAL :: omegaREFvis3d(ngrid,nlayermx,naerkind) 182 REAL :: omegaREFir3d(ngrid,nlayermx,naerkind) 183 183 184 184 DO iaer = 1, naerkind ! Loop on aerosol kind … … 380 380 381 381 DO lg = 1,nlayer 382 DO ig = 1, ngrid382 DO ig = 1, ngrid 383 383 ! 2.1 Effective radius index and kx calculation 384 384 var_tmp=reffrad(ig,lg,iaer)/refftabmin … … 725 725 ENDIF ! -------------------------------- 726 726 ENDDO !nlayermx 727 ENDDO !ngrid mx727 ENDDO !ngrid 728 728 729 729 !================================================================== -
trunk/LMDZ.GENERIC/libf/phystd/calcenergy_kcm.F90
r305 r787 22 22 real Play(1:nlayermx),Plev(1:nlayermx+1) 23 23 real Qsurf,Q(1:nlayermx) 24 real muvar( ngridmx,nlayermx+1)24 real muvar(1,nlayermx+1) 25 25 26 26 ! internal -
trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
r728 r787 5 5 fluxsurf_sw,fluxtop_lw,fluxabs_sw,fluxtop_dn, & 6 6 OLR_nu,OSR_nu, & 7 reffrad, tau_col,cloudfrac,totcloudfrac,&7 reffrad,nueffrad,tau_col,cloudfrac,totcloudfrac, & 8 8 clearsky,firstcall,lastcall) 9 9 … … 16 16 use radii_mod, only : su_aer_radii,co2_reffrad,h2o_reffrad,dust_reffrad,h2so4_reffrad 17 17 use aerosol_mod 18 19 USE tracer_h 18 20 19 21 implicit none … … 37 39 #include "comcstfi.h" 38 40 #include "callkeys.h" 39 #include "tracer.h"40 41 41 42 !----------------------------------------------------------------------- … … 60 61 ! Globally varying aerosol optical properties on GCM grid 61 62 ! Not needed everywhere so not in radcommon_h 62 REAL :: QVISsQREF3d(ngridmx,nlayermx,L_NSPECTV,naerkind) 63 REAL :: omegaVIS3d(ngridmx,nlayermx,L_NSPECTV,naerkind) 64 REAL :: gVIS3d(ngridmx,nlayermx,L_NSPECTV,naerkind) 65 66 REAL :: QIRsQREF3d(ngridmx,nlayermx,L_NSPECTI,naerkind) 67 REAL :: omegaIR3d(ngridmx,nlayermx,L_NSPECTI,naerkind) 68 REAL :: gIR3d(ngridmx,nlayermx,L_NSPECTI,naerkind) 69 70 REAL :: QREFvis3d(ngridmx,nlayermx,naerkind) 71 REAL :: QREFir3d(ngridmx,nlayermx,naerkind) 72 73 ! REAL :: omegaREFvis3d(ngridmx,nlayermx,naerkind) 74 ! REAL :: omegaREFir3d(ngridmx,nlayermx,naerkind) ! not sure of the point of these... 75 76 REAL reffrad(ngrid,nlayer,naerkind) 77 REAL, SAVE :: nueffrad(ngridmx,nlayermx,naerkind) 78 79 ! OUTPUT 80 REAL dtsw(ngridmx,nlayermx) ! heating rate (K/s) due to SW 81 REAL dtlw(ngridmx,nlayermx) ! heating rate (K/s) due to LW 82 REAL fluxsurf_lw(ngridmx) ! incident LW flux to surf (W/m2) 83 REAL fluxtop_lw(ngridmx) ! outgoing LW flux to space (W/m2) 84 REAL fluxsurf_sw(ngridmx) ! incident SW flux to surf (W/m2) 85 REAL fluxabs_sw(ngridmx) ! SW flux absorbed by planet (W/m2) 86 REAL fluxtop_dn(ngridmx) ! incident top of atmosphere SW flux (W/m2) 63 REAL :: QVISsQREF3d(ngrid,nlayermx,L_NSPECTV,naerkind) 64 REAL :: omegaVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 65 REAL :: gVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 66 67 REAL :: QIRsQREF3d(ngrid,nlayermx,L_NSPECTI,naerkind) 68 REAL :: omegaIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 69 REAL :: gIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 70 71 ! REAL :: omegaREFvis3d(ngrid,nlayermx,naerkind) 72 ! REAL :: omegaREFir3d(ngrid,nlayermx,naerkind) ! not sure of the point of these... 73 74 !!! this is a local instance of a variable saved in physiq.F and being an argument 75 REAL, INTENT(INOUT) :: reffrad(ngrid,nlayer,naerkind) 76 REAL, INTENT(INOUT) :: nueffrad(ngrid,nlayermx,naerkind) 77 78 !! OUTPUT 79 REAL dtsw(ngrid,nlayermx) ! heating rate (K/s) due to SW 80 REAL dtlw(ngrid,nlayermx) ! heating rate (K/s) due to LW 81 REAL fluxsurf_lw(ngrid) ! incident LW flux to surf (W/m2) 82 REAL fluxtop_lw(ngrid) ! outgoing LW flux to space (W/m2) 83 REAL fluxsurf_sw(ngrid) ! incident SW flux to surf (W/m2) 84 REAL fluxabs_sw(ngrid) ! SW flux absorbed by planet (W/m2) 85 REAL fluxtop_dn(ngrid) ! incident top of atmosphere SW flux (W/m2) 87 86 REAL OLR_nu(ngrid,L_NSPECTI)! Outgoing LW radition in each band (Normalized to the band width (W/m2/cm-1) 88 87 REAL OSR_nu(ngrid,L_NSPECTV)! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1) 88 89 89 !----------------------------------------------------------------------- 90 90 ! Declaration of the variables required by correlated-k subroutines … … 126 126 127 127 real*8 qvar(L_LEVELS) ! mixing ratio of variable component (mol/mol) 128 REAL pq(ngrid mx,nlayer,nq)129 REAL qsurf(ngrid mx,nqmx) ! tracer on surface (e.g. kg.m-2)128 REAL pq(ngrid,nlayer,nq) 129 REAL qsurf(ngrid,nq) ! tracer on surface (e.g. kg.m-2) 130 130 integer nq 131 131 … … 140 140 save qxvaer, qsvaer, gvaer 141 141 save qxiaer, qsiaer, giaer 142 save QREFvis3d, QREFir3d 142 143 !REAL :: QREFvis3d(ngrid,nlayermx,naerkind) 144 !REAL :: QREFir3d(ngrid,nlayermx,naerkind) 145 !save QREFvis3d, QREFir3d 146 real, dimension(:,:,:), save, allocatable :: QREFvis3d 147 real, dimension(:,:,:), save, allocatable :: QREFir3d 143 148 144 149 REAL tau_col(ngrid) ! diagnostic from aeropacity … … 165 170 166 171 ! for H2O cloud fraction in aeropacity 167 real cloudfrac(ngrid mx,nlayermx)168 real totcloudfrac(ngrid mx)172 real cloudfrac(ngrid,nlayermx) 173 real totcloudfrac(ngrid) 169 174 logical clearsky 170 175 171 176 ! for weird cloud test 172 real pqtest(ngrid mx,nlayer,nq)177 real pqtest(ngrid,nlayer,nq) 173 178 174 179 real maxrad, minrad … … 178 183 179 184 ! included by RW for runaway greenhouse 1D study 180 real muvar(ngrid mx,nlayermx+1)185 real muvar(ngrid,nlayermx+1) 181 186 real vtmp(nlayermx) 182 187 REAL*8 muvarrad(L_LEVELS) … … 195 200 196 201 if(firstcall) then 202 203 ALLOCATE(QREFvis3d(ngrid,nlayermx,naerkind)) 204 ALLOCATE(QREFir3d(ngrid,nlayermx,naerkind)) 197 205 198 206 call system('rm -f surf_vals_long.out') … … 204 212 call abort 205 213 endif 206 call su_aer_radii( reffrad,nueffrad)214 call su_aer_radii(ngrid,reffrad,nueffrad) 207 215 208 216 … … 233 241 OSR_nu(:,:) = 0. 234 242 235 if (ngrid mx.eq.1) then243 if (ngrid.eq.1) then 236 244 PRINT*, 'Simulate global averaged conditions ?' 237 245 global1d = .false. ! default value … … 266 274 267 275 if ((iaer.eq.iaero_co2).and.tracer.and.(igcm_co2_ice.gt.0)) then ! treat condensed co2 particles. 268 call co2_reffrad( pq,reffrad)269 print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid mx,1:nlayermx,iaer))/1.e-6,' um'270 print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid mx,1:nlayermx,iaer))/1.e-6,' um'276 call co2_reffrad(ngrid,nq,pq,reffrad) 277 print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 278 print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 271 279 end if 272 280 if ((iaer.eq.iaero_h2o).and.water) then ! treat condensed water particles. to be generalized for other aerosols 273 call h2o_reffrad( pq,pt,reffrad,nueffrad)274 print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid mx,1:nlayermx,iaer))/1.e-6,' um'275 print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngrid mx,1:nlayermx,iaer))/1.e-6,' um'281 call h2o_reffrad(ngrid,nq,pq,pt,reffrad,nueffrad) 282 print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 283 print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 276 284 endif 277 285 if(iaer.eq.iaero_dust)then 278 call dust_reffrad( reffrad)286 call dust_reffrad(ngrid,reffrad) 279 287 print*,'Dust particle size = ',reffrad(1,1,iaer)/1.e-6,' um' 280 288 endif 281 289 if(iaer.eq.iaero_h2so4)then 282 call h2so4_reffrad( reffrad)290 call h2so4_reffrad(ngrid,reffrad) 283 291 print*,'H2SO4 particle size =',reffrad(1,1,iaer)/1.e-6,' um' 284 292 endif … … 304 312 !----------------------------------------------------------------------- 305 313 ! Starting Big Loop over every GCM column 306 do ig=1,ngrid mx314 do ig=1,ngrid 307 315 308 316 !======================================================================= … … 452 460 endif 453 461 454 if ((ngrid mx.eq.1).and.(global1d)) then ! fixed zenith angle 'szangle' in 1D simulations w/ globally-averaged sunlight462 if ((ngrid.eq.1).and.(global1d)) then ! fixed zenith angle 'szangle' in 1D simulations w/ globally-averaged sunlight 455 463 acosz = cos(pi*szangle/180.0) 456 464 print*,'acosz=',acosz,', szangle=',szangle … … 550 558 !i_var=igcm_h2o_vap 551 559 i_var=1 552 if(nq mx.gt.1)then560 if(nq.gt.1)then 553 561 print*,'Need 1 tracer only to run kcm1d.e' 554 562 stop … … 653 661 fluxtoplanet=0. 654 662 655 if((ngrid mx.eq.1).and.(global1d))then663 if((ngrid.eq.1).and.(global1d))then 656 664 do nw=1,L_NSPECTV 657 665 stel_fract(nw)= stel(nw) * 0.25 / acosz -
trunk/LMDZ.GENERIC/libf/phystd/callsedim.F
r486 r787 2 2 $ pplev,zlev, pt, 3 3 & pq, pdqfi, pdqsed,pdqs_sed,nq,rfall) 4 5 USE tracer_h 6 4 7 IMPLICIT NONE 5 8 … … 25 28 #include "dimphys.h" 26 29 #include "comcstfi.h" 27 #include "tracer.h"28 30 #include "callkeys.h" 29 30 #include "fisice.h"31 31 32 32 c arguments: … … 53 53 INTEGER l,ig, iq 54 54 55 real zqi(ngrid mx,nlayermx,nqmx) ! to locally store tracers56 real masse (ngrid mx,nlayermx) ! Layer mass (kg.m-2)57 real epaisseur (ngrid mx,nlayermx) ! Layer thickness (m)58 real wq(ngrid mx,nlayermx+1) ! displaced tracer mass (kg.m-2)59 c real dens(ngrid mx,nlayermx) ! Mean density of the ice part. accounting for dust core60 real rfall(ngrid mx,nlayermx)55 real zqi(ngrid,nlayermx,nq) ! to locally store tracers 56 real masse (ngrid,nlayermx) ! Layer mass (kg.m-2) 57 real epaisseur (ngrid,nlayermx) ! Layer thickness (m) 58 real wq(ngrid,nlayermx+1) ! displaced tracer mass (kg.m-2) 59 c real dens(ngrid,nlayermx) ! Mean density of the ice part. accounting for dust core 60 real rfall(ngrid,nlayermx) 61 61 62 62 … … 69 69 70 70 IF (firstcall) THEN 71 IF(ngrid.NE.ngridmx) THEN72 PRINT*,'STOP dans callsedim'73 PRINT*,'probleme de dimensions :'74 PRINT*,'ngrid =',ngrid75 PRINT*,'ngridmx =',ngridmx76 STOP77 ENDIF78 79 71 firstcall=.false. 80 72 ENDIF ! of IF (firstcall) … … 96 88 ! of general tracers.] 97 89 98 zqi(1:ngrid,1:nlay,1:nq mx) = 0.90 zqi(1:ngrid,1:nlay,1:nq) = 0. 99 91 do iq=1,nq 100 92 if((radius(iq).gt.1.e-9).and.(iq.ne.igcm_co2_ice)) then … … 104 96 105 97 do l=1,nlay 106 do ig=1, ngrid98 do ig=1, ngrid 107 99 zqi(ig,l,iq)=pq(ig,l,iq)+pdqfi(ig,l,iq)*ptimestep 108 100 enddo … … 128 120 !====================================================================== 129 121 130 do ig=1,ngrid 122 do ig=1,ngrid 131 123 ! Ehouarn: with new way of tracking tracers by name, this is simply 132 124 pdqs_sed(ig,iq) = wq(ig,1)/ptimestep -
trunk/LMDZ.GENERIC/libf/phystd/condense_cloud.F90
r728 r787 10 10 use radii_mod, only : co2_reffrad 11 11 use aerosol_mod, only : iaero_co2 12 USE surfdat_h 13 USE comgeomfi_h 14 USE tracer_h 15 12 16 13 17 implicit none … … 55 59 #include "dimphys.h" 56 60 #include "comcstfi.h" 57 #include "surfdat.h"58 #include "comgeomfi.h"59 61 #include "comvert.h" 60 62 #include "callkeys.h" 61 #include "tracer.h"62 63 63 64 !----------------------------------------------------------------------- … … 80 81 REAL pdu(ngrid,nlayer) , pdv(ngrid,nlayer) 81 82 REAL pduc(ngrid,nlayer) , pdvc(ngrid,nlayer) 82 REAL pq(ngrid mx,nlayer,nq),pdq(ngrid,nlayer,nq)83 REAL pq(ngrid,nlayer,nq),pdq(ngrid,nlayer,nq) 83 84 REAL pdqc(ngrid,nlayer,nq), pdqsc(ngrid,nq) 84 85 … … 92 93 INTEGER l,ig,icap,ilay,it,iq 93 94 94 REAL*8 zt(ngrid mx,nlayermx)95 REAL zq(ngrid mx,nlayermx,nqmx)95 REAL*8 zt(ngrid,nlayermx) 96 REAL zq(ngrid,nlayermx,nq) 96 97 REAL zcpi 97 REAL ztcond (ngrid mx,nlayermx)98 REAL ztnuc (ngrid mx,nlayermx)99 REAL ztcondsol(ngrid mx)100 REAL zdiceco2(ngrid mx)101 REAL zcondicea(ngrid mx,nlayermx), zcondices(ngridmx)102 REAL zfallice(ngrid mx), Mfallice(ngridmx)98 REAL ztcond (ngrid,nlayermx) 99 REAL ztnuc (ngrid,nlayermx) 100 REAL ztcondsol(ngrid) 101 REAL zdiceco2(ngrid) 102 REAL zcondicea(ngrid,nlayermx), zcondices(ngrid) 103 REAL zfallice(ngrid), Mfallice(ngrid) 103 104 REAL zmflux(nlayermx+1) 104 105 REAL zu(nlayermx),zv(nlayermx) 105 REAL ztsrf(ngrid mx)106 REAL ztsrf(ngrid) 106 107 REAL ztc(nlayermx), ztm(nlayermx+1) 107 108 REAL zum(nlayermx+1) , zvm(nlayermx+1) 108 LOGICAL condsub(ngrid mx)109 LOGICAL condsub(ngrid) 109 110 REAL subptimestep 110 111 Integer Ntime 111 real masse (ngrid mx,nlayermx), w(ngridmx,nlayermx,nqmx)112 real wq(ngrid mx,nlayermx+1)112 real masse (ngrid,nlayermx), w(ngrid,nlayermx,nq) 113 real wq(ngrid,nlayermx+1) 113 114 real vstokes,reff 114 115 115 116 ! Special diagnostic variables 116 real tconda1(ngrid mx,nlayermx)117 real tconda2(ngrid mx,nlayermx)118 real zdtsig (ngrid mx,nlayermx)119 real zdt (ngrid mx,nlayermx)117 real tconda1(ngrid,nlayermx) 118 real tconda2(ngrid,nlayermx) 119 real zdtsig (ngrid,nlayermx) 120 real zdt (ngrid,nlayermx) 120 121 121 122 !----------------------------------------------------------------------- 122 123 ! Saved local variables 123 124 124 REAL emisref(ngridmx)125 125 REAL latcond 126 126 REAL ccond 127 127 REAL cpice 128 SAVE emisref, cpice 128 REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: emisref 129 SAVE cpice 129 130 SAVE latcond,ccond 130 131 … … 155 156 call zerophys(ngrid*nlayer*nq,pdqc) 156 157 call zerophys(ngrid*nlayer*nq,pdtc) 157 call zerophys(ngrid mx*nlayermx*nqmx,zq)158 call zerophys(ngrid mx*nlayermx,zt)158 call zerophys(ngrid*nlayermx*nq,zq) 159 call zerophys(ngrid*nlayermx,zt) 159 160 160 161 ! Initialisation 161 162 IF (firstcall) THEN 162 163 164 ALLOCATE(emisref(ngrid)) !! this should be deallocated in lastcall... 165 163 166 ! find CO2 ice tracer 164 do iq=1,nq mx167 do iq=1,nq 165 168 tracername=noms(iq) 166 169 if (tracername.eq."co2_ice") then … … 287 290 ! Calculate the mass of each atmospheric layer (kg.m-2) 288 291 do ilay=1,nlayer 289 do ig=1,ngrid292 DO ig=1,ngrid 290 293 masse(ig,ilay)=(pplev(ig,ilay) - pplev(ig,ilay+1)) /g 291 294 end do … … 312 315 313 316 ! sedimentation computed from radius computed from q in module radii_mod 314 call co2_reffrad( zq,reffrad)317 call co2_reffrad(ngrid,nq,zq,reffrad) 315 318 316 319 do ilay=1,nlayer 317 do ig=1,ngrid320 DO ig=1,ngrid 318 321 319 322 reff = reffrad(ig,ilay,iaero_co2) … … 337 340 ! Progressively accumulating the flux to the ground 338 341 ! Mfallice is the total amount of ice fallen to the ground 339 doig=1,ngrid342 DO ig=1,ngrid 340 343 Mfallice(ig) = Mfallice(ig) + wq(ig,i_co2ice) 341 344 end do … … 463 466 ! Surface albedo and emissivity of the ground below the snow (emisref) 464 467 ! -------------------------------------------------------------------- 465 do ig=1,ngrid468 DO ig=1,ngrid 466 469 IF(ig.GT.ngrid/2+1) THEN 467 470 icap=2 -
trunk/LMDZ.GENERIC/libf/phystd/convadj.F
r253 r787 5 5 & pduadj,pdvadj,pdhadj, 6 6 & pdqadj) 7 8 USE tracer_h 7 9 8 10 implicit none … … 31 33 #include "comcstfi.h" 32 34 #include "callkeys.h" 33 #include "tracer.h"34 35 35 36 … … 54 55 55 56 INTEGER ig,i,l,l1,l2,jj 56 INTEGER jcnt, jadrs(ngrid mx)57 INTEGER jcnt, jadrs(ngrid) 57 58 58 59 REAL sig(nlayermx+1),sdsig(nlayermx),dsig(nlayermx) 59 REAL zu(ngrid mx,nlayermx),zv(ngridmx,nlayermx)60 REAL zh(ngrid mx,nlayermx)61 REAL zu2(ngrid mx,nlayermx),zv2(ngridmx,nlayermx)62 REAL zh2(ngrid mx,nlayermx), zhc(ngridmx,nlayermx)60 REAL zu(ngrid,nlayermx),zv(ngrid,nlayermx) 61 REAL zh(ngrid,nlayermx) 62 REAL zu2(ngrid,nlayermx),zv2(ngrid,nlayermx) 63 REAL zh2(ngrid,nlayermx), zhc(ngrid,nlayermx) 63 64 REAL zhm,zsm,zdsm,zum,zvm,zalpha,zhmc 64 65 … … 66 67 INTEGER iq,ico2 67 68 save ico2 68 REAL zq(ngrid mx,nlayermx,nqmx), zq2(ngridmx,nlayermx,nqmx)69 REAL zqm(nq mx),zqco2m69 REAL zq(ngrid,nlayermx,nq), zq2(ngrid,nlayermx,nq) 70 REAL zqm(nq),zqco2m 70 71 real m_co2, m_noco2, A , B 71 72 save A, B … … 73 74 real mtot1, mtot2 , mm1, mm2 74 75 integer l1ref, l2ref 75 LOGICAL vtest(ngrid mx),down,firstcall76 LOGICAL vtest(ngrid),down,firstcall 76 77 save firstcall 77 78 data firstcall/.true./ … … 87 88 88 89 IF (firstcall) THEN 89 IF(ngrid.NE.ngridmx) THEN90 PRINT*91 PRINT*,'STOP in convadj'92 PRINT*,'ngrid =',ngrid93 PRINT*,'ngridmx =',ngridmx94 ENDIF95 90 ico2=0 96 91 if (tracer) then 97 92 ! Prepare Special treatment if one of the tracers is CO2 gas 98 do iq=1,nq mx93 do iq=1,nq 99 94 if (noms(iq).eq."co2") then 100 95 print*,'dont go there' … … 401 396 do iq=1, nq 402 397 do l=1,nlay 403 do ig=1,ngrid398 DO ig=1,ngrid 404 399 pdqadj(ig,l,iq)=(zq2(ig,l,iq)-zq(ig,l,iq))/ptimestep 405 400 end do -
trunk/LMDZ.GENERIC/libf/phystd/datareadnc.F
r588 r787 85 85 INTEGER i,j,k 86 86 87 INTEGER klatdat,ngridm xgdat88 PARAMETER (klatdat=180,ngridm xgdat=360)87 INTEGER klatdat,ngridmixgdat 88 PARAMETER (klatdat=180,ngridmixgdat=360) 89 89 90 90 c on passe une grille en rlonu rlatv et im+1 jm a interp_horiz) … … 245 245 do j=1,jmdp1 246 246 do i=1,imd 247 zdataS(i+imdp1*(j-1)) = zdata(i+ngridm xgdat*(j-1))247 zdataS(i+imdp1*(j-1)) = zdata(i+ngridmixgdat*(j-1)) 248 248 enddo 249 zdataS(imdp1+imdp1*(j-1)) = zdata(1+ngridm xgdat*(j-1))249 zdataS(imdp1+imdp1*(j-1)) = zdata(1+ngridmixgdat*(j-1)) 250 250 enddo 251 251 -
trunk/LMDZ.GENERIC/libf/phystd/dimphys.h
r786 r787 12 12 !integer, parameter :: nsoilmx = 13 ! for z1=0.03 cm, depth = 104.8 m => earth case 13 13 !----------------------------------------------------------------------- 14 15 common/dimphys/cursor 16 integer cursor !! this is the position of point 1 on the globe 17 !! it is 1 obviously for sequential runs 18 !! but might differ for paraller runs 19 !! it is used in phyetat0 mostly 20 -
trunk/LMDZ.GENERIC/libf/phystd/evap.F
r650 r787 1 subroutine evap( dtime,pt, pq, pdq, pdt,1 subroutine evap(ngrid,nq,dtime,pt, pq, pdq, pdt, 2 2 $ dqevap,dtevap, qevap, tevap) 3 3 4 4 use watercommon_h 5 USE tracer_h 5 6 6 7 implicit none … … 8 9 #include "dimensions.h" 9 10 #include "dimphys.h" 10 #include "tracer.h"11 11 #include "comcstfi.h" 12 12 … … 24 24 !================================================================== 25 25 26 INTEGER ngrid,nq 27 26 28 ! Arguments: 27 REAL pt(ngrid mx,nlayermx)28 REAL pq(ngrid mx,nlayermx,nqmx)29 REAL pdt(ngrid mx,nlayermx)30 REAL pdq(ngrid mx,nlayermx,nqmx)31 REAL dqevap(ngrid mx,nlayermx)32 REAL dtevap(ngrid mx,nlayermx)33 REAL qevap(ngrid mx,nlayermx,nqmx)29 REAL pt(ngrid,nlayermx) 30 REAL pq(ngrid,nlayermx,nq) 31 REAL pdt(ngrid,nlayermx) 32 REAL pdq(ngrid,nlayermx,nq) 33 REAL dqevap(ngrid,nlayermx) 34 REAL dtevap(ngrid,nlayermx) 35 REAL qevap(ngrid,nlayermx,nq) 34 36 REAL dtime 35 37 36 38 ! Local: 37 REAL tevap(ngrid mx,nlayermx)39 REAL tevap(ngrid,nlayermx) 38 40 REAL zlvdcp 39 41 REAL zlsdcp … … 46 48 47 49 DO l=1,nlayermx 48 DO ig=1,ngrid mx50 DO ig=1,ngrid 49 51 qevap(ig,l,igcm_h2o_vap)=pq(ig,l,igcm_h2o_vap) 50 52 s +pdq(ig,l,igcm_h2o_vap)*dtime … … 56 58 57 59 DO l = 1, nlayermx 58 DO ig = 1, ngrid mx60 DO ig = 1, ngrid 59 61 zlvdcp=RLVTT/RCPD!/(1.0+RVTMP2*qevap(ig,l,igcm_h2o_vap)) 60 62 zlsdcp=RLSTT/RCPD!/(1.0+RVTMP2*qevap(ig,l,igcm_h2o_vap)) -
trunk/LMDZ.GENERIC/libf/phystd/forceWCfn.F
r253 r787 1 subroutine forceWCfn(pplev,pt,dq,dqs) 1 subroutine forceWCfn(ngrid,nq,pplev,pt,dq,dqs) 2 3 USE tracer_h 2 4 3 5 implicit none … … 19 21 #include "dimphys.h" 20 22 #include "comcstfi.h" 21 #include "tracer.h" 23 24 INTEGER ngrid,nq 22 25 23 26 real masse, Wtot, Wdiff 24 27 25 real pplev(ngrid mx,nlayermx+1)26 real pt(ngrid mx)28 real pplev(ngrid,nlayermx+1) 29 real pt(ngrid) 27 30 28 real dqs(ngrid mx,nqmx)29 real dq(ngrid mx,nlayermx,nqmx)31 real dqs(ngrid,nq) 32 real dq(ngrid,nlayermx,nq) 30 33 31 34 integer iq, ig, ilay 32 35 33 do iq=1,nq mx34 do ig=1,ngrid mx36 do iq=1,nq 37 do ig=1,ngrid 35 38 Wtot = 0.0 36 39 do ilay=1,nlayermx -
trunk/LMDZ.GENERIC/libf/phystd/hydrol.F90
r773 r787 1 subroutine hydrol( ptimestep,rnat,tsurf, &1 subroutine hydrol(ngrid,nq,ptimestep,rnat,tsurf, & 2 2 qsurf,dqsurf,dqs_hyd,pcapcal, & 3 3 albedo0,albedo,mu0,pdtsurf,pdtsurf_hyd,hice) 4 4 5 5 use watercommon_h, only: T_h2O_ice_liq, RLFTT, rhowater, mx_eau_sol 6 USE surfdat_h 7 use comdiurn_h 8 USE comgeomfi_h 9 USE tracer_h 6 10 7 11 implicit none … … 36 40 #include "comcstfi.h" 37 41 #include "callkeys.h" 38 #include "tracer.h" 39 #include "fisice.h" 40 #include "comgeomfi.h" 41 #include "comdiurn.h" 42 #include "surfdat.h" 42 43 integer ngrid,nq 43 44 44 45 ! Inputs … … 60 61 ! Arguments 61 62 ! --------- 62 integer rnat(ngridmx) ! I changed this to integer (RW) 63 real runoff(ngridmx) 64 save runoff 63 integer rnat(ngrid) ! I changed this to integer (RW) 64 real,dimension(:),allocatable,save :: runoff 65 65 real totalrunoff, tsea, oceanarea 66 66 save oceanarea 67 67 68 68 real ptimestep 69 real mu0(ngrid mx)70 real qsurf(ngrid mx,nqmx), tsurf(ngridmx)71 real dqsurf(ngrid mx,nqmx), pdtsurf(ngridmx)72 real hice(ngrid mx)73 real albedo0(ngrid mx), albedo(ngridmx)69 real mu0(ngrid) 70 real qsurf(ngrid,nq), tsurf(ngrid) 71 real dqsurf(ngrid,nq), pdtsurf(ngrid) 72 real hice(ngrid) 73 real albedo0(ngrid), albedo(ngrid) 74 74 75 75 real oceanarea2 … … 77 77 ! Output 78 78 ! ------ 79 real dqs_hyd(ngrid mx,nqmx)80 real pdtsurf_hyd(ngrid mx)79 real dqs_hyd(ngrid,nq) 80 real pdtsurf_hyd(ngrid) 81 81 82 82 ! Local … … 85 85 integer ig,iq, icap ! wld like to remove icap 86 86 real fsnoi, subli, fauxo 87 real twater(ngrid mx)88 real pcapcal(ngrid mx)89 real hicebis(ngrid mx)90 real zqsurf(ngrid mx,nqmx)91 real ztsurf(ngrid mx)87 real twater(ngrid) 88 real pcapcal(ngrid) 89 real hicebis(ngrid) 90 real zqsurf(ngrid,nq) 91 real ztsurf(ngrid) 92 92 93 93 integer ivap, iliq, iice … … 104 104 105 105 if(firstcall)then 106 107 ALLOCATE(runoff(ngrid)) 106 108 107 109 ivap=igcm_h2o_vap … … 126 128 ! Total ocean surface area 127 129 oceanarea=0. 128 do ig=1,ngrid mx130 do ig=1,ngrid 129 131 if(rnat(ig).eq.0)then 130 132 oceanarea=oceanarea+area(ig) … … 150 152 ! ------------------------------------------ 151 153 152 do ig=1,ngrid mx154 do ig=1,ngrid 153 155 ztsurf(ig) = tsurf(ig) + ptimestep*pdtsurf(ig) 154 156 pdtsurf_hyd(ig)=0.0 155 do iq=1,nq mx157 do iq=1,nq 156 158 zqsurf(ig,iq) = qsurf(ig,iq) + ptimestep*dqsurf(ig,iq) 157 159 enddo 158 160 enddo 159 161 160 do ig=1,ngrid mx161 do iq=1,nq mx162 do ig=1,ngrid 163 do iq=1,nq 162 164 dqs_hyd(ig,iq) = 0.0 163 165 enddo 164 166 enddo 165 167 166 do ig = 1, ngrid mx168 do ig = 1, ngrid 167 169 168 170 ! Ocean … … 257 259 258 260 runoff(ig) = max(zqsurf(ig,iliq) - mx_eau_sol, 0.0) 259 if(ngrid mx.gt.1)then ! runoff only exists in 3D261 if(ngrid.gt.1)then ! runoff only exists in 3D 260 262 if(runoff(ig).ne.0.0)then 261 263 zqsurf(ig,iliq) = mx_eau_sol … … 283 285 endif 284 286 285 end do ! ig=1,ngrid mx287 end do ! ig=1,ngrid 286 288 287 289 ! perform crude bulk averaging of temperature in ocean … … 290 292 291 293 oceanarea2=0. 292 DO ig=1,ngrid mx294 DO ig=1,ngrid 293 295 if((rnat(ig).eq.0).and.(hice(ig).eq.0.))then 294 296 oceanarea2=oceanarea2+area(ig)*pcapcal(ig) … … 297 299 298 300 tsea=0. 299 DO ig=1,ngrid mx301 DO ig=1,ngrid 300 302 if((rnat(ig).eq.0).and.(hice(ig).eq.0.))then 301 303 tsea=tsea+ztsurf(ig)*area(ig)*pcapcal(ig)/oceanarea2 … … 303 305 END DO 304 306 305 DO ig=1,ngrid mx307 DO ig=1,ngrid 306 308 if((rnat(ig).eq.0).and.(hice(ig).eq.0))then 307 309 pdtsurf_hyd(ig) = pdtsurf_hyd(ig) + (tsea-ztsurf(ig))/oceantime … … 318 320 319 321 totalrunoff=0. 320 do ig=1,ngrid mx322 do ig=1,ngrid 321 323 if (rnat(ig).eq.1) then 322 324 totalrunoff = totalrunoff + area(ig)*runoff(ig) … … 324 326 enddo 325 327 326 do ig=1,ngrid mx328 do ig=1,ngrid 327 329 if (rnat(ig).eq.0) then 328 330 zqsurf(ig,iliq) = zqsurf(ig,iliq) + & … … 338 340 339 341 icap=1 340 do ig=1,ngrid mx342 do ig=1,ngrid 341 343 if (qsurf(ig,igcm_co2_ice).gt.0) then 342 344 albedo(ig) = albedice(icap) … … 347 349 348 350 349 do ig=1,ngrid mx351 do ig=1,ngrid 350 352 dqs_hyd(ig,iliq)=(zqsurf(ig,iliq) - qsurf(ig,iliq))/ptimestep 351 353 dqs_hyd(ig,iice)=(zqsurf(ig,iice) - qsurf(ig,iice))/ptimestep 352 354 enddo 353 355 354 call writediagfi(ngrid mx,'runoff','Runoff amount',' ',2,runoff)356 call writediagfi(ngrid,'runoff','Runoff amount',' ',2,runoff) 355 357 356 358 return -
trunk/LMDZ.GENERIC/libf/phystd/inifis.F
r728 r787 6 6 use radinc_h, only : naerkind 7 7 use datafile_mod, only: datadir 8 use comdiurn_h 9 10 !! to be conservative, but why this include here? 11 use surfdat_h 12 use comsaison_h 13 14 USE comgeomfi_h 8 15 9 16 !======================================================================= … … 50 57 #include "planete.h" 51 58 #include "comcstfi.h" 52 #include "comsaison.h"53 #include "comdiurn.h"54 #include "comgeomfi.h"55 59 #include "callkeys.h" 56 #include "surfdat.h"57 60 58 61 … … 61 64 62 65 INTEGER ngrid,nlayer 63 REAL plat(ngrid),plon(ngrid),parea(ngrid mx)66 REAL plat(ngrid),plon(ngrid),parea(ngrid) 64 67 integer day_ini 65 68 INTEGER ig,ierr … … 87 90 avocado = 6.02214179e23 ! added by RW 88 91 92 cursor = 1 ! added by AS in dimphys. 1 for sequential runs. 93 89 94 ! -------------------------------------------------------- 90 95 ! The usual Tests … … 95 100 PRINT*,'nlayer = ',nlayer 96 101 PRINT*,'nlayermx = ',nlayermx 97 STOP98 ENDIF99 100 IF (ngrid.NE.ngridmx) THEN101 PRINT*,'STOP in inifis'102 PRINT*,'Probleme de dimensions :'103 PRINT*,'ngrid = ',ngrid104 PRINT*,'ngridmx = ',ngridmx105 102 STOP 106 103 ENDIF … … 299 296 ! Test of incompatibility: 300 297 ! if kastprof used, we must be in 1D 301 if (kastprof.and.(ngrid mx.gt.1)) then298 if (kastprof.and.(ngrid.gt.1)) then 302 299 print*,'kastprof can only be used in 1D!' 303 300 call abort … … 350 347 ! Test of incompatibility: 351 348 ! if testradtimes used, we must be in 1D 352 if (testradtimes.and.(ngrid mx.gt.1)) then349 if (testradtimes.and.(ngrid.gt.1)) then 353 350 print*,'testradtimes can only be used in 1D!' 354 351 call abort … … 595 592 ! ------------------------ 596 593 594 ! ALLOCATE ARRAYS IN comgeomfi_h 595 IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngrid)) 596 IF (.not. ALLOCATED(long)) ALLOCATE(long(ngrid)) 597 IF (.not. ALLOCATED(area)) ALLOCATE(area(ngrid)) 598 597 599 CALL SCOPY(ngrid,plon,1,long,1) 598 600 CALL SCOPY(ngrid,plat,1,lati,1) 599 601 CALL SCOPY(ngrid,parea,1,area,1) 600 totarea=SSUM(ngridmx,area,1) 602 totarea=SSUM(ngrid,area,1) 603 604 !! those are defined in comdiurn_h.F90 605 IF (.not.ALLOCATED(sinlat)) ALLOCATE(sinlat(ngrid)) 606 IF (.not.ALLOCATED(coslat)) ALLOCATE(coslat(ngrid)) 607 IF (.not.ALLOCATED(sinlon)) ALLOCATE(sinlon(ngrid)) 608 IF (.not.ALLOCATED(coslon)) ALLOCATE(coslon(ngrid)) 601 609 602 610 DO ig=1,ngrid -
trunk/LMDZ.GENERIC/libf/phystd/initracer.F
r253 r787 1 SUBROUTINE initracer() 2 3 1 SUBROUTINE initracer(ngrid,nq,nametrac) 2 3 use surfdat_h 4 USE comgeomfi_h 5 USE tracer_h 4 6 IMPLICIT NONE 5 7 c======================================================================= … … 13 15 c Test of dimension : 14 16 c Initialize COMMON tracer in tracer.h, using tracer names provided 15 c by the dynamics in "advtrac.h"17 c by the argument nametrac 16 18 c 17 19 c author: F.Forget … … 25 27 #include "comcstfi.h" 26 28 #include "callkeys.h" 27 #include "tracer.h" 28 #include "advtrac.h" 29 #include "comgeomfi.h" 30 #include "watercap.h" 31 #include "fisice.h" 32 33 ! real qsurf(ngridmx,nqmx) ! tracer on surface (e.g. kg.m-2) 34 ! real co2ice(ngridmx) ! co2 ice mass on surface (e.g. kg.m-2) 29 30 integer :: ngrid,nq 31 32 ! real qsurf(ngrid,nq) ! tracer on surface (e.g. kg.m-2) 33 ! real co2ice(ngrid) ! co2 ice mass on surface (e.g. kg.m-2) 35 34 character(len=20) :: txt ! to store some text 36 35 integer iq,ig,count … … 38 37 ! logical :: oldnames ! =.true. if old tracer naming convention (q01,...) 39 38 39 character*20 nametrac(nq) ! name of the tracer from dynamics 40 40 41 41 42 c----------------------------------------------------------------------- 42 c radius(nq mx) ! aerosol particle radius (m)43 c rho_q(nq mx) ! tracer densities (kg.m-3)44 c qext(nq mx) ! Single Scat. Extinction coeff at 0.67 um45 c alpha_lift(nq mx) ! saltation vertical flux/horiz flux ratio (m-1)46 c alpha_devil(nq mx) ! lifting coeeficient by dust devil43 c radius(nq) ! aerosol particle radius (m) 44 c rho_q(nq) ! tracer densities (kg.m-3) 45 c qext(nq) ! Single Scat. Extinction coeff at 0.67 um 46 c alpha_lift(nq) ! saltation vertical flux/horiz flux ratio (m-1) 47 c alpha_devil(nq) ! lifting coeeficient by dust devil 47 48 c rho_dust ! Mars dust density 48 49 c rho_ice ! Water ice density … … 51 52 c----------------------------------------------------------------------- 52 53 54 !! we allocate once for all arrays in common in tracer_h.F90 55 !! (supposedly those are not used before call to initracer) 56 ALLOCATE(noms(nq)) 57 ALLOCATE(mmol(nq)) 58 ALLOCATE(radius(nq)) 59 ALLOCATE(rho_q(nq)) 60 ALLOCATE(qext(nq)) 61 ALLOCATE(alpha_lift(nq)) 62 ALLOCATE(alpha_devil(nq)) 63 ALLOCATE(qextrhor(nq)) 64 ALLOCATE(igcm_dustbin(nq)) 65 !! initialization 66 alpha_lift(:)=0. 67 alpha_devil(:)=0. 68 53 69 ! Initialization: get tracer names from the dynamics and check if we are 54 70 ! using 'old' tracer convention ('q01',q02',...) … … 57 73 58 74 ! copy tracer names from dynamics 59 do iq=1,nq mx60 noms(iq)= tnom(iq)75 do iq=1,nq 76 noms(iq)=nametrac(iq) 61 77 enddo 62 78 … … 65 81 ! 0. initialize tracer indexes to zero: 66 82 ! NB: igcm_* indexes are commons in 'tracer.h' 67 do iq=1,nq mx83 do iq=1,nq 68 84 igcm_dustbin(iq)=0 69 85 enddo … … 97 113 count=0 98 114 ! if (dustbin.gt.0) then 99 ! do iq=1,nq mx115 ! do iq=1,nq 100 116 ! txt=" " 101 117 ! write(txt,'(a4,i2.2)')'dust',count+1 … … 105 121 ! mmol(iq)=100. 106 122 ! endif 107 ! enddo !do iq=1,nq mx123 ! enddo !do iq=1,nq 108 124 ! endif ! of if (dustbin.gt.0) 109 125 110 126 111 127 ! if (doubleq) then 112 ! do iq=1,nq mx128 ! do iq=1,nq 113 129 ! if (noms(iq).eq."dust_mass") then 114 130 ! igcm_dust_mass=iq … … 122 138 ! endif ! of if (doubleq) 123 139 ! 2. find chemistry and water tracers 124 do iq=1,nq mx140 do iq=1,nq 125 141 if (noms(iq).eq."co2") then 126 142 igcm_co2=iq … … 147 163 ! write(*,*) 'h2o_ice: count=',count 148 164 endif 149 enddo ! of do iq=1,nq mx165 enddo ! of do iq=1,nq 150 166 151 167 ! check that we identified all tracers: 152 if (count.ne.nq mx) then168 if (count.ne.nq) then 153 169 write(*,*) "initracer: found only ",count," tracers" 154 write(*,*) " expected ",nq mx170 write(*,*) " expected ",nq 155 171 do iq=1,count 156 172 write(*,*)' ',iq,' ',trim(noms(iq)) … … 159 175 else 160 176 write(*,*) "initracer: found all expected tracers, namely:" 161 do iq=1,nq mx177 do iq=1,nq 162 178 write(*,*)' ',iq,' ',trim(noms(iq)) 163 179 enddo … … 168 184 c Initialisation tracers .... 169 185 c------------------------------------------------------------ 170 call zerophys(nq mx,rho_q)186 call zerophys(nq,rho_q) 171 187 172 188 rho_dust=2500. ! Mars dust density (kg.m-3) … … 182 198 c$$$c iq=1: Q mass mixing ratio, iq=2: N number mixing ratio 183 199 c$$$ 184 c$$$ if( (nq mx.lt.2).or.(water.and.(nqmx.lt.3)) ) then185 c$$$ write(*,*)'initracer: nq mx is too low : nqmx=', nqmx200 c$$$ if( (nq.lt.2).or.(water.and.(nq.lt.3)) ) then 201 c$$$ write(*,*)'initracer: nq is too low : nq=', nq 186 202 c$$$ write(*,*)'water= ',water,' doubleq= ',doubleq 187 203 c$$$ end if … … 259 275 260 276 261 ! if(ngrid mx.eq.1)277 ! if(ngrid.eq.1) 262 278 263 279 264 280 ! to be modified for BC+ version? 265 do ig=1,ngridmx 266 if (ngridmx.ne.1) watercaptag(ig)=.false. 281 282 !! this is defined in surfdat_h.F90 283 IF (.not.ALLOCATED(dryness)) ALLOCATE(dryness(ngrid)) 284 IF (.not.ALLOCATED(watercaptag)) ALLOCATE(watercaptag(ngrid)) 285 286 do ig=1,ngrid 287 if (ngrid.ne.1) watercaptag(ig)=.false. 267 288 dryness(ig) = 1. 268 289 enddo … … 274 295 c Perennial H20 north cap defined by watercaptag=true (allows surface to be 275 296 c hollowed by sublimation in vdifc). 276 ! do ig=1,ngrid mx297 ! do ig=1,ngrid 277 298 ! if (lati(ig)*180./pi.gt.84) then 278 ! if (ngrid mx.ne.1) watercaptag(ig)=.true.299 ! if (ngrid.ne.1) watercaptag(ig)=.true. 279 300 ! dryness(ig) = 1. 280 301 c Use the following cap definition for high spatial resolution (latitudinal bin <= 5 deg) 281 302 c if (lati(ig)*180./pi.lt.85.and.long(ig).ge.0) then 282 c if (ngrid mx.ne.1) watercaptag(ig)=.true.303 c if (ngrid.ne.1) watercaptag(ig)=.true. 283 304 c dryness(ig) = 1. 284 305 c endif 285 306 c if (lati(ig)*180./pi.ge.85) then 286 c if (ngrid mx.ne.1) watercaptag(ig)=.true.307 c if (ngrid.ne.1) watercaptag(ig)=.true. 287 308 c dryness(ig) = 1. 288 309 c endif 289 310 ! endif ! (lati>80 deg) 290 ! end do ! (ngrid mx)311 ! end do ! (ngrid) 291 312 ! ENDIF ! (caps) 292 313 293 ! if(iceparty.and.(nq mx.ge.2)) then314 ! if(iceparty.and.(nq.ge.2)) then 294 315 295 316 radius(igcm_h2o_ice)=3.e-6 … … 303 324 304 325 305 ! elseif(iceparty.and.(nq mx.lt.2)) then306 ! write(*,*) 'nq mx is too low : nqmx=', nqmx326 ! elseif(iceparty.and.(nq.lt.2)) then 327 ! write(*,*) 'nq is too low : nq=', nq 307 328 ! write(*,*) 'water= ',water,' iceparty= ',iceparty 308 329 ! endif -
trunk/LMDZ.GENERIC/libf/phystd/iniwrite.F
r135 r787 1 1 SUBROUTINE iniwrite(nid,idayref,phis) 2 3 USE comsoil_h 4 2 5 IMPLICIT NONE 3 6 … … 31 34 #include "serre.h" 32 35 #include"dimphys.h" 33 #include"comsoil.h"34 36 35 37 c Arguments: -
trunk/LMDZ.GENERIC/libf/phystd/iniwrite_specIR.F
r533 r787 3 3 use radinc_h, only: L_NSPECTI 4 4 use radcommon_h, only: WNOI,DWNI 5 use comsoil_h 5 6 6 7 implicit none … … 35 36 #include "serre.h" 36 37 #include"dimphys.h" 37 #include"comsoil.h"38 38 39 39 c Arguments: -
trunk/LMDZ.GENERIC/libf/phystd/iniwrite_specVI.F
r533 r787 3 3 use radinc_h, only: L_NSPECTV 4 4 use radcommon_h, only: WNOV,DWNV 5 use comsoil_h 5 6 6 7 implicit none … … 35 36 #include "serre.h" 36 37 #include"dimphys.h" 37 #include"comsoil.h"38 38 39 39 c Arguments: -
trunk/LMDZ.GENERIC/libf/phystd/iniwritesoil.F90
r135 r787 1 subroutine iniwritesoil(nid) 1 subroutine iniwritesoil(nid,ngrid) 2 3 use comsoil_h 2 4 3 5 ! initialization routine for 'writediagoil'. Here we create/define … … 12 14 #include"comcstfi.h" 13 15 #include"comgeom.h" 14 #include"comsoil.h"15 16 #include"netcdf.inc" 16 17 17 18 ! Arguments: 19 integer,intent(in) :: ngrid 18 20 integer,intent(in) :: nid ! NetCDF output file ID 19 21 … … 246 248 do i=1,iip1 247 249 data3(i,1,l)=inertiedat(1,l) 248 data3(i,jjp1,l)=inertiedat(ngrid mx,l)250 data3(i,jjp1,l)=inertiedat(ngrid,l) 249 251 enddo 252 !!! THIS WILL NOT WORK IN PARALLEL !!!! 250 253 ! rest of the grid 251 254 do j=2,jjm -
trunk/LMDZ.GENERIC/libf/phystd/kcm1d.F90
r716 r787 5 5 use watercommon_h, only: mH2O 6 6 use ioipsl_getincom 7 use comsaison_h 7 8 8 9 implicit none … … 31 32 #include "comcstfi.h" 32 33 #include "planete.h" 33 #include "comsaison.h"34 34 #include "control.h" 35 #include "advtrac.h"36 35 37 36 ! -------------------------------------------------------------- … … 71 70 real dTstrat 72 71 real aerosol(nlayermx,naerkind) ! aerosol tau (kg/kg) 73 real OLR_nu( ngridmx,L_NSPECTI)74 real OSR_nu( ngridmx,L_NSPECTV)72 real OLR_nu(1,L_NSPECTI) 73 real OSR_nu(1,L_NSPECTV) 75 74 real Eatmtot 76 75 77 76 integer ierr 78 77 logical firstcall,lastcall,global1d 78 79 character*20 nametrac(nqmx) ! name of the tracer (no need for adv trac common) 79 80 80 81 ! -------------- … … 92 93 nlayer=nlayermx 93 94 nlevel=nlayer+1 95 96 !! this is defined in comsaison_h 97 ALLOCATE(mu0(1)) 98 ALLOCATE(fract(1)) 99 94 100 95 101 … … 224 230 do iq=1,nq 225 231 ! minimal version, just read in the tracer names, 1 per line 226 read(90,*,iostat=ierr) tnom(iq)232 read(90,*,iostat=ierr) nametrac(iq) 227 233 if (ierr.ne.0) then 228 234 write(*,*) 'kcm1d: error reading tracer names...' … … 232 238 endif 233 239 234 call initracer( )240 call initracer(1,nq,nametrac) 235 241 236 242 endif 237 243 238 244 239 do iq=1,nq mx245 do iq=1,nq 240 246 do ilay=1,nlayer 241 247 q(ilay,iq) = 0. … … 243 249 enddo 244 250 245 do iq=1,nq mx251 do iq=1,nq 246 252 qsurf(iq) = 0. 247 253 enddo … … 265 271 266 272 ! Run radiative transfer 267 call callcorrk( ngridmx,nlayer,q,nqmx,qsurf, &273 call callcorrk(1,nlayer,q,nq,qsurf, & 268 274 albedo,emis,mu0,plev,play,temp, & 269 275 tsurf,fract,dist_star,aerosol,muvar, & 270 276 dtlw,dtsw,fluxsurf_lw,fluxsurf_sw,fluxtop_lw, & 271 fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,reffrad, tau_col, &277 fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,reffrad,nueffrad,tau_col, & 272 278 cloudfrac,totcloudfrac,.false.,firstcall,lastcall) 273 279 … … 298 304 firstcall=.false. 299 305 lastcall=.true. 300 call callcorrk( ngridmx,nlayer,q,nqmx,qsurf, &306 call callcorrk(1,nlayer,q,nq,qsurf, & 301 307 albedo,emis,mu0,plev,play,temp, & 302 308 tsurf,fract,dist_star,aerosol,muvar, & 303 309 dtlw,dtsw,fluxsurf_lw,fluxsurf_sw,fluxtop_lw, & 304 310 fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu, & 305 reffrad, tau_col, &311 reffrad,nueffrad,tau_col, & 306 312 cloudfrac,totcloudfrac,.false.,firstcall,lastcall) 307 313 -
trunk/LMDZ.GENERIC/libf/phystd/largescale.F90
r786 r787 1 subroutine largescale( ptimestep, pplev, pplay, pt, pq, &1 subroutine largescale(ngrid,nq,ptimestep, pplev, pplay, pt, pq, & 2 2 pdt, pdq, pdtlsc, pdqvaplsc, pdqliqlsc, rneb) 3 3 4 4 use watercommon_h, only : RLVTT, RCPD, RVTMP2, & 5 5 T_h2O_ice_clouds,T_h2O_ice_liq,Psat_water,Lcpdqsat_water 6 USE tracer_h 6 7 IMPLICIT none 7 8 … … 23 24 #include "comcstfi.h" 24 25 25 #include "fisice.h"26 26 #include "callkeys.h" 27 #include "tracer.h"28 27 29 28 INTEGER ngrid,nq 30 29 31 30 ! Arguments 32 31 REAL ptimestep ! intervalle du temps (s) 33 REAL pplev(ngrid mx,nlayermx+1) ! pression a inter-couche34 REAL pplay(ngrid mx,nlayermx) ! pression au milieu de couche35 REAL pt(ngrid mx,nlayermx) ! temperature (K)36 real pq(ngrid mx,nlayermx,nqmx) ! tracer mixing ratio (kg/kg)37 REAL pdt(ngrid mx,nlayermx) ! physical temperature tenedency (K/s)38 REAL pdq(ngrid mx,nlayermx,nqmx)! physical tracer tenedency (K/s)39 REAL pdtlsc(ngrid mx,nlayermx) ! incrementation de la temperature (K)40 REAL pdqvaplsc(ngrid mx,nlayermx) ! incrementation de la vapeur d'eau41 REAL pdqliqlsc(ngrid mx,nlayermx) ! incrementation de l'eau liquide42 REAL rneb(ngrid mx,nlayermx) ! fraction nuageuse32 REAL pplev(ngrid,nlayermx+1) ! pression a inter-couche 33 REAL pplay(ngrid,nlayermx) ! pression au milieu de couche 34 REAL pt(ngrid,nlayermx) ! temperature (K) 35 real pq(ngrid,nlayermx,nq) ! tracer mixing ratio (kg/kg) 36 REAL pdt(ngrid,nlayermx) ! physical temperature tenedency (K/s) 37 REAL pdq(ngrid,nlayermx,nq)! physical tracer tenedency (K/s) 38 REAL pdtlsc(ngrid,nlayermx) ! incrementation de la temperature (K) 39 REAL pdqvaplsc(ngrid,nlayermx) ! incrementation de la vapeur d'eau 40 REAL pdqliqlsc(ngrid,nlayermx) ! incrementation de l'eau liquide 41 REAL rneb(ngrid,nlayermx) ! fraction nuageuse 43 42 44 43 … … 53 52 INTEGER,PARAMETER :: nitermax=1000 54 53 REAL,PARAMETER :: alpha=.5,qthreshold=1.e-6 55 REAL zt(ngrid mx), zq(ngridmx)56 REAL zcond(ngrid mx),zcond_iter57 REAL zdelq(ngrid mx)58 REAL zqs(ngrid mx), zdqs(ngridmx)54 REAL zt(ngrid), zq(ngrid) 55 REAL zcond(ngrid),zcond_iter 56 REAL zdelq(ngrid) 57 REAL zqs(ngrid), zdqs(ngrid) 59 58 REAL psat_tmp 60 59 61 60 ! evaporation calculations 62 REAL dqevap(ngrid mx,nlayermx),dtevap(ngridmx,nlayermx)63 REAL qevap(ngrid mx,nlayermx,nqmx)64 REAL tevap(ngrid mx,nlayermx)61 REAL dqevap(ngrid,nlayermx),dtevap(ngrid,nlayermx) 62 REAL qevap(ngrid,nlayermx,nq) 63 REAL tevap(ngrid,nlayermx) 65 64 66 REAL zcor(ngrid mx), zdelta(ngridmx), zcvm5(ngridmx)67 REAL zx_q(ngrid mx)65 REAL zcor(ngrid), zdelta(ngrid), zcvm5(ngrid) 66 REAL zx_q(ngrid) 68 67 REAL Nmix_local,zfice 69 68 70 69 ! GCM -----> subroutine variables, initialisation of outputs 71 70 72 pdtlsc(1:ngrid mx,1:nlayermx) = 0.073 pdqvaplsc(1:ngrid mx,1:nlayermx) = 0.074 pdqliqlsc(1:ngrid mx,1:nlayermx) = 0.075 rneb(1:ngrid mx,1:nlayermx) = 0.071 pdtlsc(1:ngrid,1:nlayermx) = 0.0 72 pdqvaplsc(1:ngrid,1:nlayermx) = 0.0 73 pdqliqlsc(1:ngrid,1:nlayermx) = 0.0 74 rneb(1:ngrid,1:nlayermx) = 0.0 76 75 77 76 78 77 ! Evaporate cloud water/ice 79 call evap( ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap)78 call evap(ngrid,nq,ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap) 80 79 ! note: we use qevap but not tevap in largescale/moistadj 81 80 ! otherwise is a big mess … … 85 84 DO k = nlayermx, 1, -1 86 85 87 zt(1:ngrid mx)=pt(1:ngridmx,k)+(pdt(1:ngridmx,k)+dtevap(1:ngridmx,k))*ptimestep88 zq(1:ngrid mx)=qevap(1:ngridmx,k,igcm_h2o_vap) !liquid water is included in qevap86 zt(1:ngrid)=pt(1:ngrid,k)+(pdt(1:ngrid,k)+dtevap(1:ngrid,k))*ptimestep 87 zq(1:ngrid)=qevap(1:ngrid,k,igcm_h2o_vap) !liquid water is included in qevap 89 88 90 89 ! Calculer la vapeur d'eau saturante et 91 90 ! determiner la condensation partielle 92 DO i = 1, ngrid mx91 DO i = 1, ngrid 93 92 94 93 if(zt(i).le.15.) then … … 150 149 151 150 ! Tendances de t et q 152 pdqvaplsc(1:ngrid mx,k) = dqevap(1:ngridmx,k) - zcond(1:ngridmx)153 pdqliqlsc(1:ngrid mx,k) = - pdqvaplsc(1:ngridmx,k)154 pdtlsc(1:ngrid mx,k) = pdqliqlsc(1:ngridmx,k)*RLVTT/RCPD151 pdqvaplsc(1:ngrid,k) = dqevap(1:ngrid,k) - zcond(1:ngrid) 152 pdqliqlsc(1:ngrid,k) = - pdqvaplsc(1:ngrid,k) 153 pdtlsc(1:ngrid,k) = pdqliqlsc(1:ngrid,k)*RLVTT/RCPD 155 154 156 155 Enddo ! k= nlayermx, 1, -1 -
trunk/LMDZ.GENERIC/libf/phystd/mass_redistribution.F90
r786 r787 5 5 6 6 USE watercommon_h, Only: Tsat_water,RLVTT 7 use surfdat_h 8 USE comgeomfi_h 9 USE tracer_h 7 10 8 11 IMPLICIT NONE … … 49 52 #include "dimphys.h" 50 53 #include "comcstfi.h" 51 #include "surfdat.h"52 #include "comgeomfi.h"53 54 #include "comvert.h" 54 55 #include "paramet.h" 55 56 #include "callkeys.h" 56 #include "tracer.h"57 57 58 58 !----------------------------------------------------------------------- … … 61 61 INTEGER ngrid, nlayer, nq 62 62 REAL ptimestep 63 REAL pcapcal(ngrid mx)64 INTEGER rnat(ngrid mx)63 REAL pcapcal(ngrid) 64 INTEGER rnat(ngrid) 65 65 REAL pplay(ngrid,nlayer),pplev(ngrid,nlayer+1) 66 66 REAL pt(ngrid,nlayer),pdt(ngrid,nlayer) … … 71 71 REAL pdmassmr(ngrid,nlayer) 72 72 REAL pdumr(ngrid,nlayer) , pdvmr(ngrid,nlayer) 73 REAL pq(ngrid mx,nlayer,nq),pdq(ngrid,nlayer,nq)74 REAL pqs(ngrid mx,nq)73 REAL pq(ngrid,nlayer,nq),pdq(ngrid,nlayer,nq) 74 REAL pqs(ngrid,nq) 75 75 REAL pdqmr(ngrid,nlayer,nq),pdqsmr(ngrid,nq) 76 76 REAL pdpsrfmr(ngrid),pdtsrfmr(ngrid) … … 80 80 81 81 ! Boiling/sublimation 82 REAL Tsat(ngrid mx),zmassboil(ngridmx)82 REAL Tsat(ngrid),zmassboil(ngrid) 83 83 84 84 ! vertical reorganization of sigma levels … … 87 87 ! Dummy variables 88 88 INTEGER n,l,ig,iq 89 REAL zdtsig(ngrid mx,nlayermx)90 REAL zmass(ngrid mx,nlayermx),zzmass(nlayermx),w(nlayermx+1)91 REAL zdmass_sum(ngrid mx,nlayermx+1)89 REAL zdtsig(ngrid,nlayermx) 90 REAL zmass(ngrid,nlayermx),zzmass(nlayermx),w(nlayermx+1) 91 REAL zdmass_sum(ngrid,nlayermx+1) 92 92 REAL zmflux(nlayermx+1) 93 93 REAL zq1(nlayermx) 94 REAL ztsrf(ngrid mx)94 REAL ztsrf(ngrid) 95 95 REAL ztm(nlayermx+1) 96 96 REAL zum(nlayermx+1) , zvm(nlayermx+1) 97 REAL zqm(nlayermx+1,nq mx),zqm1(nlayermx+1)97 REAL zqm(nlayermx+1,nq),zqm1(nlayermx+1) 98 98 99 99 ! local saved variables … … 120 120 ! Surface tracer Tendencies set to 0 121 121 ! ------------------------------------- 122 pdqsmr(1:ngrid mx,1:nqmx)=0.123 124 ztsrf(1:ngrid mx) = ptsrf(1:ngridmx) + pdtsrf(1:ngridmx)*ptimestep122 pdqsmr(1:ngrid,1:nq)=0. 123 124 ztsrf(1:ngrid) = ptsrf(1:ngrid) + pdtsrf(1:ngrid)*ptimestep 125 125 126 126 … … 135 135 136 136 if (water) then 137 do ig=1,ngrid mx137 do ig=1,ngrid 138 138 call Tsat_water(pplev(ig,1)+zdmass_sum(ig,1)*g*ptimestep,Tsat(ig)) 139 139 enddo 140 140 call writediagfi(ngrid,'Tsat','saturation temperature at surface','',2,Tsat) 141 141 142 do ig=1,ngrid mx142 do ig=1,ngrid 143 143 if (ztsrf(ig).gt.Tsat(ig)) then 144 144 zmassboil(ig)=(ptsrf(ig)-Tsat(ig))*pcapcal(ig)/RLVTT/ptimestep … … 163 163 ! """""""""""""""""""""""""""""""""""" 164 164 165 pdpsrfmr(1:ngrid mx) = (zdmass_sum(1:ngridmx,1)+zmassboil(1:ngridmx))*g166 167 do ig = 1, ngrid mx165 pdpsrfmr(1:ngrid) = (zdmass_sum(1:ngrid,1)+zmassboil(1:ngrid))*g 166 167 do ig = 1, ngrid 168 168 IF(ABS(pdpsrfmr(ig)*ptimestep).GT.pplev(ig,1)) THEN 169 169 PRINT*,'STOP in condens' … … 187 187 zzu(1:nlayermx) = pu(ig,1:nlayermx) + pdu(ig,1:nlayermx) * ptimestep 188 188 zzv(1:nlayermx) = pv(ig,1:nlayermx) + pdv(ig,1:nlayermx) * ptimestep 189 zzq(1:nlayermx,1:nq mx)=pq(ig,1:nlayermx,1:nqmx)+pdq(ig,1:nlayermx,1:nqmx)*ptimestep ! must add the water that has fallen???189 zzq(1:nlayermx,1:nq)=pq(ig,1:nlayermx,1:nq)+pdq(ig,1:nlayermx,1:nq)*ptimestep ! must add the water that has fallen??? 190 190 191 191 ! Mass fluxes of air through the sigma levels (kg.m-2.s-1) (>0 when up) … … 214 214 zum(1) = 0. 215 215 zvm(1) = 0. 216 zqm(1,1:nq mx)=0. ! most tracer do not condense !216 zqm(1,1:nq)=0. ! most tracer do not condense ! 217 217 if (water) zqm(1,igcm_h2o_vap)=1. ! flux is 100% h2o at surface 218 218 … … 222 222 call vl1d(zzu ,2.,zzmass,w,zum) 223 223 call vl1d(zzv ,2.,zzmass,w,zvm) 224 do iq=1,nq mx224 do iq=1,nq 225 225 zq1(1:nlayermx)=zzq(1:nlayermx,iq) 226 226 zqm1(1)=zqm(1,iq) … … 247 247 zum(nlayer+1)= zzu(nlayer) ! should not be used, but... 248 248 zvm(nlayer+1)= zzv(nlayer) ! should not be used, but... 249 zqm(nlayer+1,1:nq mx)= zzq(nlayer,1:nqmx)249 zqm(nlayer+1,1:nq)= zzq(nlayer,1:nq) 250 250 251 251 ! Tendencies on T, U, V, Q … … 267 267 268 268 ! Tendencies on Q 269 do iq=1,nq mx269 do iq=1,nq 270 270 DO l=1,nlayer 271 271 pdqmr(ig,l,iq)= (1/zzmass(l)) * & -
trunk/LMDZ.GENERIC/libf/phystd/moistadj.F90
r773 r787 1 subroutine moistadj( pt, pq, pdq, pplev, pplay, pdtmana, pdqmana, ptimestep, rneb)1 subroutine moistadj(ngrid, nq, pt, pq, pdq, pplev, pplay, pdtmana, pdqmana, ptimestep, rneb) 2 2 3 3 use watercommon_h, only: T_h2O_ice_liq, RLVTT, RCPD, Psat_water, Lcpdqsat_water 4 USE tracer_h 4 5 5 6 implicit none … … 21 22 #include "dimensions.h" 22 23 #include "dimphys.h" 23 #include "tracer.h"24 24 #include "comcstfi.h" 25 25 26 REAL pt(ngridmx,nlayermx) ! temperature (K) 27 REAL pq(ngridmx,nlayermx,nqmx) ! tracer (kg/kg) 28 REAL pdq(ngridmx,nlayermx,nqmx) 29 30 REAL pdqmana(ngridmx,nlayermx,nqmx) ! tendency of tracers (kg/kg.s-1) 31 REAL pdtmana(ngridmx,nlayermx) ! temperature increment 26 INTEGER ngrid, nq 27 28 REAL pt(ngrid,nlayermx) ! temperature (K) 29 REAL pq(ngrid,nlayermx,nq) ! tracer (kg/kg) 30 REAL pdq(ngrid,nlayermx,nq) 31 32 REAL pdqmana(ngrid,nlayermx,nq) ! tendency of tracers (kg/kg.s-1) 33 REAL pdtmana(ngrid,nlayermx) ! temperature increment 32 34 33 35 ! local variables 34 REAL zt(ngrid mx,nlayermx) ! temperature (K)35 REAL zq(ngrid mx,nlayermx) ! humidite specifique (kg/kg)36 REAL pplev(ngrid mx,nlayermx+1) ! pression a inter-couche (Pa)37 REAL pplay(ngrid mx,nlayermx) ! pression au milieu de couche (Pa)38 39 REAL d_t(ngrid mx,nlayermx) ! temperature increment40 REAL d_q(ngrid mx,nlayermx) ! incrementation pour vapeur d'eau41 REAL d_ql(ngrid mx,nlayermx) ! incrementation pour l'eau liquide42 REAL rneb(ngrid mx,nlayermx) ! cloud fraction36 REAL zt(ngrid,nlayermx) ! temperature (K) 37 REAL zq(ngrid,nlayermx) ! humidite specifique (kg/kg) 38 REAL pplev(ngrid,nlayermx+1) ! pression a inter-couche (Pa) 39 REAL pplay(ngrid,nlayermx) ! pression au milieu de couche (Pa) 40 41 REAL d_t(ngrid,nlayermx) ! temperature increment 42 REAL d_q(ngrid,nlayermx) ! incrementation pour vapeur d'eau 43 REAL d_ql(ngrid,nlayermx) ! incrementation pour l'eau liquide 44 REAL rneb(ngrid,nlayermx) ! cloud fraction 43 45 REAL ptimestep 44 46 … … 52 54 INTEGER, PARAMETER :: niter = 1 53 55 INTEGER k1, k1p, k2, k2p 54 LOGICAL itest(ngrid mx)55 REAL delta_q(ngrid mx, nlayermx)56 LOGICAL itest(ngrid) 57 REAL delta_q(ngrid, nlayermx) 56 58 REAL cp_new_t(nlayermx) 57 59 REAL cp_delta_t(nlayermx) 58 60 REAL v_cptj(nlayermx), v_cptjk1, v_ssig 59 REAL v_cptt(ngrid mx,nlayermx), v_p, v_t, zpsat60 REAL zqs(ngrid mx,nlayermx), zdqs(ngridmx,nlayermx)61 REAL zq1(ngrid mx), zq2(ngridmx)62 REAL gamcpdz(ngrid mx,2:nlayermx)61 REAL v_cptt(ngrid,nlayermx), v_p, v_t, zpsat 62 REAL zqs(ngrid,nlayermx), zdqs(ngrid,nlayermx) 63 REAL zq1(ngrid), zq2(ngrid) 64 REAL gamcpdz(ngrid,2:nlayermx) 63 65 REAL zdp, zdpm 64 66 … … 66 68 REAL zflo ! flotabilite 67 69 68 REAL local_q(ngrid mx,nlayermx),local_t(ngridmx,nlayermx)70 REAL local_q(ngrid,nlayermx),local_t(ngrid,nlayermx) 69 71 70 72 REAL zdelta, zcor, zcvm5 … … 94 96 95 97 ! GCM -----> subroutine variables 96 zq(1:ngrid mx,1:nlayermx) = pq(1:ngridmx,1:nlayermx,i_h2o)+ pdq(1:ngridmx,1:nlayermx,i_h2o)*ptimestep97 zt(1:ngrid mx,1:nlayermx) = pt(1:ngridmx,1:nlayermx)98 pdqmana(1:ngrid mx,1:nlayermx,1:nqmx)=0.099 100 DO k = 1, nlayermx 101 DO i = 1, ngrid mx98 zq(1:ngrid,1:nlayermx) = pq(1:ngrid,1:nlayermx,i_h2o)+ pdq(1:ngrid,1:nlayermx,i_h2o)*ptimestep 99 zt(1:ngrid,1:nlayermx) = pt(1:ngrid,1:nlayermx) 100 pdqmana(1:ngrid,1:nlayermx,1:nq)=0.0 101 102 DO k = 1, nlayermx 103 DO i = 1, ngrid 102 104 if(zq(i,k).lt.0.)then 103 105 zq(i,k)=0.0 … … 106 108 ENDDO 107 109 108 local_q(1:ngrid mx,1:nlayermx) = zq(1:ngridmx,1:nlayermx)109 local_t(1:ngrid mx,1:nlayermx) = zt(1:ngridmx,1:nlayermx)110 rneb(1:ngrid mx,1:nlayermx) = 0.0111 d_ql(1:ngrid mx,1:nlayermx) = 0.0112 d_t(1:ngrid mx,1:nlayermx) = 0.0113 d_q(1:ngrid mx,1:nlayermx) = 0.0110 local_q(1:ngrid,1:nlayermx) = zq(1:ngrid,1:nlayermx) 111 local_t(1:ngrid,1:nlayermx) = zt(1:ngrid,1:nlayermx) 112 rneb(1:ngrid,1:nlayermx) = 0.0 113 d_ql(1:ngrid,1:nlayermx) = 0.0 114 d_t(1:ngrid,1:nlayermx) = 0.0 115 d_q(1:ngrid,1:nlayermx) = 0.0 114 116 115 117 ! Calculate v_cptt 116 118 DO k = 1, nlayermx 117 DO i = 1, ngrid mx119 DO i = 1, ngrid 118 120 v_cptt(i,k) = RCPD * local_t(i,k) 119 121 v_t = MAX(local_t(i,k),15.) … … 127 129 ! Calculate Gamma * Cp * dz: (gamma is the critical gradient) 128 130 DO k = 2, nlayermx 129 DO i = 1, ngrid mx131 DO i = 1, ngrid 130 132 zdp = pplev(i,k)-pplev(i,k+1) 131 133 zdpm = pplev(i,k-1)-pplev(i,k) … … 138 140 139 141 !------------------------------------ modification of unstable profile 140 DO 9999 i = 1, ngridmx 142 DO 9999 i = 1, ngrid 143 141 144 itest(i) = .FALSE. 142 145 … … 266 269 267 270 DO k = 1, nlayermx 268 DO i = 1, ngrid mx271 DO i = 1, ngrid 269 272 IF (itest(i)) THEN 270 273 delta_q(i,k) = local_q(i,k) - zq(i,k) … … 278 281 ! diminue et d'une maniere proportionnelle a cet diminution): 279 282 280 DO i = 1, ngrid mx283 DO i = 1, ngrid 281 284 IF (itest(i)) THEN 282 285 zq1(i) = 0.0 … … 285 288 ENDDO 286 289 DO k = 1, nlayermx 287 DO i = 1, ngrid mx290 DO i = 1, ngrid 288 291 IF (itest(i)) THEN 289 292 zdp = pplev(i,k)-pplev(i,k+1) … … 294 297 ENDDO 295 298 DO k = 1, nlayermx 296 DO i = 1, ngrid mx299 DO i = 1, ngrid 297 300 IF (itest(i)) THEN 298 301 IF (zq2(i).NE.0.0) d_ql(i,k) = - MIN(0.0,delta_q(i,k))*zq1(i)/zq2(i) … … 304 307 305 308 DO k = 1, nlayermx 306 DO i = 1, ngrid mx309 DO i = 1, ngrid 307 310 local_q(i, k) = MAX(local_q(i, k), seuil_vap) 308 311 ENDDO … … 310 313 311 314 DO k = 1, nlayermx 312 DO i = 1, ngrid mx315 DO i = 1, ngrid 313 316 d_t(i,k) = local_t(i,k) - zt(i,k) 314 317 d_q(i,k) = local_q(i,k) - zq(i,k) … … 318 321 ! now subroutine -----> GCM variables 319 322 DO k = 1, nlayermx 320 DO i = 1, ngrid mx323 DO i = 1, ngrid 321 324 322 325 pdtmana(i,k) = d_t(i,k)/ptimestep -
trunk/LMDZ.GENERIC/libf/phystd/newsedim.F
r486 r787 35 35 c Traceurs : 36 36 real pqi(ngrid,nlay) ! traceur (e.g. ?/kg) 37 real wq(ngrid mx,nlay+1) ! flux de traceur durant timestep (?/m-2)37 real wq(ngrid,nlay+1) ! flux de traceur durant timestep (?/m-2) 38 38 39 39 c local: … … 48 48 c Traceurs : 49 49 c ~~~~~~~~ 50 real traversee (ngrid mx,nlayermx)51 real vstokes(ngrid mx,nlayermx)52 real w(ngrid mx,nlayermx)50 real traversee (ngrid,nlayermx) 51 real vstokes(ngrid,nlayermx) 52 real w(ngrid,nlayermx) 53 53 real ptop, dztop, Ep, Stra 54 54 … … 74 74 75 75 IF (firstcall) THEN 76 IF(ngrid.NE.ngridmx) THEN77 PRINT*,'STOP dans newsedim'78 PRINT*,'probleme de dimensions :'79 PRINT*,'ngrid =',ngrid80 PRINT*,'ngridmx =',ngridmx81 STOP82 ENDIF83 76 firstcall=.false. 84 77 -
trunk/LMDZ.GENERIC/libf/phystd/newtrelax.F90
r253 r787 1 subroutine newtrelax( mu0,sinlat,popsk,temp,pplay,pplev,dtrad,firstcall)1 subroutine newtrelax(ngrid,mu0,sinlat,popsk,temp,pplay,pplev,dtrad,firstcall) 2 2 3 3 implicit none … … 20 20 ! 21 21 !================================================================== 22 22 23 integer ngrid 24 23 25 ! Input 24 real mu0(ngrid mx) ! cosine of sun incident angle25 real sinlat(ngrid mx) ! sine of latitude26 real temp(ngrid mx,nlayermx) ! temperature at each layer (K)27 real pplay(ngrid mx,nlayermx) ! pressure at each layer (Pa)28 real pplev(ngrid mx,nlayermx+1) ! pressure at each level (Pa)29 real popsk(ngrid mx,nlayermx) ! pot. T to T converter26 real mu0(ngrid) ! cosine of sun incident angle 27 real sinlat(ngrid) ! sine of latitude 28 real temp(ngrid,nlayermx) ! temperature at each layer (K) 29 real pplay(ngrid,nlayermx) ! pressure at each layer (Pa) 30 real pplev(ngrid,nlayermx+1) ! pressure at each level (Pa) 31 real popsk(ngrid,nlayermx) ! pot. T to T converter 30 32 31 33 ! Output 32 real dtrad(ngrid mx,nlayermx)34 real dtrad(ngrid,nlayermx) 33 35 34 36 ! Internal 35 real Trelax (ngridmx,nlayermx), Trelax_V, Trelax_H36 saveTrelax37 real Trelax_V, Trelax_H 38 real,allocatable,dimension(:,:),save :: Trelax 37 39 38 40 real T_trop ! relaxation temperature at tropopause (K) … … 51 53 if(firstcall) then 52 54 55 ALLOCATE(Trelax(ngrid,nlayermx)) 56 53 57 print*,'-----------------------------------------------------' 54 58 print*,'| ATTENTION: You are using a Newtonian cooling scheme' … … 58 62 59 63 if(tidallocked)then 60 do ig=1,ngrid mx64 do ig=1,ngrid 61 65 62 66 T_surf = 126. + 239.*mu0(ig) … … 83 87 84 88 do l=1,nlayermx 85 do ig=1,ngrid mx89 do ig=1,ngrid 86 90 87 91 ! vertically varying component … … 111 115 ! Calculate radiative forcing 112 116 do l=1,nlayermx 113 do ig=1,ngrid mx117 do ig=1,ngrid 114 118 dtrad(ig,l) = -(temp(ig,l) - Trelax(ig,l)) / tau_relax 115 119 if(temp(ig,l).gt.500.)then ! Trelax(ig,l))then … … 122 126 enddo 123 127 124 call writediagfi(ngrid mx,'Tref','rad forc temp','K',3,Trelax)125 !call writediagfi(ngrid mx,'ThetaZ','stellar zenith angle','deg',2,mu0)128 call writediagfi(ngrid,'Tref','rad forc temp','K',3,Trelax) 129 !call writediagfi(ngrid,'ThetaZ','stellar zenith angle','deg',2,mu0) 126 130 127 131 return -
trunk/LMDZ.GENERIC/libf/phystd/phyetat0.F
r728 r787 1 SUBROUTINE phyetat0 ( fichnom,tab0,Lmodif,nsoil,nq,1 SUBROUTINE phyetat0 (ngrid,fichnom,tab0,Lmodif,nsoil,nq, 2 2 . day_ini,time, 3 3 . tsurf,tsoil,emis,q2,qsurf,cloudfrac,totcloudfrac,hice) 4 5 USE surfdat_h 6 USE comgeomfi_h 7 USE tracer_h 8 4 9 implicit none 10 5 11 c====================================================================== 6 12 c Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818 … … 11 17 #include "dimensions.h" 12 18 #include "dimphys.h" 13 #include "comgeomfi.h"14 #include "surfdat.h"15 19 #include "planete.h" 16 20 #include "comcstfi.h" 17 #include"advtrac.h" 18 21 22 INTEGER ngrid 19 23 c====================================================================== 20 24 INTEGER nbsrf !Mars nbsrf a 1 au lieu de 4 … … 33 37 34 38 ! outputs: 35 real tsurf(ngridmx,nbsrf) ! surface temperature 36 real tsoil(ngridmx,nsoil,nbsrf) ! soil temperature 37 real emis(ngridmx) ! surface emissivity 38 real q2(ngridmx, llm+1) ! 39 real qsurf(ngridmx,nq) ! tracers on surface 40 ! real co2ice(ngridmx) ! co2 ice cover 41 real cloudfrac(ngridmx,nlayermx) 42 real hice(ngridmx), totcloudfrac(ngridmx) 43 39 real tsurf(ngrid,nbsrf) ! surface temperature 40 real tsoil(ngrid,nsoil,nbsrf) ! soil temperature 41 real emis(ngrid) ! surface emissivity 42 real q2(ngrid, llm+1) ! 43 real qsurf(ngrid,nq) ! tracers on surface 44 ! real co2ice(ngrid) ! co2 ice cover 45 real cloudfrac(ngrid,nlayermx) 46 real hice(ngrid), totcloudfrac(ngrid) 44 47 45 48 … … 71 74 character(len=30) :: txt ! to store some text 72 75 73 76 !! added variables by AS to allow to read only slices of startfi 77 real :: toto(ngrid) 78 integer :: sta !! subscript in starti where we start to read 79 integer, dimension(2) :: sta2d 80 integer, dimension(2) :: siz2d 81 82 c AS: get the cursor that is stored in dimphys.h 83 c ... this allows to read only a part of startfi horiz grid 84 sta = cursor 85 86 c 87 c ALLOCATE ARRAYS IN surfdat_h 88 c 89 IF (.not. ALLOCATED(albedodat)) ALLOCATE(albedodat(ngrid)) 90 IF (.not. ALLOCATED(phisfi)) ALLOCATE(phisfi(ngrid)) 91 IF (.not. ALLOCATED(zmea)) ALLOCATE(zmea(ngrid)) 92 IF (.not. ALLOCATED(zstd)) ALLOCATE(zstd(ngrid)) 93 IF (.not. ALLOCATED(zsig)) ALLOCATE(zsig(ngrid)) 94 IF (.not. ALLOCATED(zgam)) ALLOCATE(zgam(ngrid)) 95 IF (.not. ALLOCATED(zthe)) ALLOCATE(zthe(ngrid)) 96 74 97 c 75 98 c Ouvrir le fichier contenant l etat initial: … … 85 108 ! qsurf02, ...) 86 109 count=0 87 do iq=1,nq mx110 do iq=1,nq 88 111 txt= " " 89 112 write(txt,'(a5,i2.2)')'qsurf',iq … … 97 120 endif 98 121 enddo 99 if (count.eq.nq mx) then122 if (count.eq.nq) then 100 123 write(*,*) "phyetat0:tracers seem to follow old naming ", 101 124 & "convention (qsurf01,qsurf02,...)" … … 106 129 107 130 c modifications possibles des variables de tab_cntrl 108 PRINT*109 131 write(*,*) 'TABFI de phyeta0',Lmodif,tab0 110 call tabfi (n id,Lmodif,tab0,day_ini,lmax,p_rad,132 call tabfi (ngrid,nid,Lmodif,tab0,day_ini,lmax,p_rad, 111 133 . p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time) 134 112 135 c 113 136 c Lecture des latitudes (coordonnees): … … 119 142 ENDIF 120 143 #ifdef NC_DOUBLE 121 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,lati)122 #else 123 ierr = NF_GET_VAR _REAL(nid, nvarid,lati)144 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,lati) 145 #else 146 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,lati) 124 147 #endif 125 148 IF (ierr.NE.NF_NOERR) THEN … … 136 159 ENDIF 137 160 #ifdef NC_DOUBLE 138 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,long)139 #else 140 ierr = NF_GET_VAR _REAL(nid, nvarid,long)161 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,long) 162 #else 163 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,long) 141 164 #endif 142 165 IF (ierr.NE.NF_NOERR) THEN … … 153 176 ENDIF 154 177 #ifdef NC_DOUBLE 155 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,area)156 #else 157 ierr = NF_GET_VAR _REAL(nid, nvarid,area)178 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,area) 179 #else 180 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,area) 158 181 #endif 159 182 IF (ierr.NE.NF_NOERR) THEN … … 175 198 ENDIF 176 199 #ifdef NC_DOUBLE 177 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,phisfi)178 #else 179 ierr = NF_GET_VAR _REAL(nid, nvarid,phisfi)200 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,phisfi) 201 #else 202 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,phisfi) 180 203 #endif 181 204 IF (ierr.NE.NF_NOERR) THEN … … 197 220 ENDIF 198 221 #ifdef NC_DOUBLE 199 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,albedodat)200 #else 201 ierr = NF_GET_VAR _REAL(nid, nvarid,albedodat)222 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,albedodat) 223 #else 224 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,albedodat) 202 225 #endif 203 226 IF (ierr.NE.NF_NOERR) THEN … … 211 234 PRINT*,'Albedo du sol nu <albedodat>:', xmin, xmax 212 235 c 213 c Lecture de l''inertie thermique du sol:214 c215 ! ierr = NF_INQ_VARID (nid, "inertiedat", nvarid)216 ! IF (ierr.NE.NF_NOERR) THEN217 ! PRINT*, 'phyetat0: Le champ <inertiedat> est absent'218 ! CALL abort219 ! ENDIF220 !#ifdef NC_DOUBLE221 ! ierr = NF_GET_VAR_DOUBLE(nid, nvarid, inertiedat)222 !#else223 ! ierr = NF_GET_VAR_REAL(nid, nvarid, inertiedat)224 !#endif225 ! IF (ierr.NE.NF_NOERR) THEN226 ! PRINT*, 'phyetat0: Lecture echouee pour <inertiedat>'227 ! CALL abort228 ! ENDIF229 ! xmin = 1.0E+20230 ! xmax = -1.0E+20231 ! xmin = MINVAL(inertiedat)232 ! xmax = MAXVAL(inertiedat)233 ! PRINT*,'Inertie thermique du sol <inertiedat>:', xmin, xmax234 c235 236 c ZMEA 236 237 c … … 241 242 ENDIF 242 243 #ifdef NC_DOUBLE 243 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,zmea)244 #else 245 ierr = NF_GET_VAR _REAL(nid, nvarid,zmea)244 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,zmea) 245 #else 246 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,zmea) 246 247 #endif 247 248 IF (ierr.NE.NF_NOERR) THEN … … 251 252 xmin = 1.0E+20 252 253 xmax = -1.0E+20 253 DO i = 1, ngrid mx254 DO i = 1, ngrid 254 255 xmin = MIN(zmea(i),xmin) 255 256 xmax = MAX(zmea(i),xmax) … … 265 266 ENDIF 266 267 #ifdef NC_DOUBLE 267 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,zstd)268 #else 269 ierr = NF_GET_VAR _REAL(nid, nvarid,zstd)268 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,zstd) 269 #else 270 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,zstd) 270 271 #endif 271 272 IF (ierr.NE.NF_NOERR) THEN … … 275 276 xmin = 1.0E+20 276 277 xmax = -1.0E+20 277 DO i = 1, ngrid mx278 DO i = 1, ngrid 278 279 xmin = MIN(zstd(i),xmin) 279 280 xmax = MAX(zstd(i),xmax) … … 289 290 ENDIF 290 291 #ifdef NC_DOUBLE 291 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,zsig)292 #else 293 ierr = NF_GET_VAR _REAL(nid, nvarid,zsig)292 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,zsig) 293 #else 294 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,zsig) 294 295 #endif 295 296 IF (ierr.NE.NF_NOERR) THEN … … 299 300 xmin = 1.0E+20 300 301 xmax = -1.0E+20 301 DO i = 1, ngrid mx302 DO i = 1, ngrid 302 303 xmin = MIN(zsig(i),xmin) 303 304 xmax = MAX(zsig(i),xmax) … … 313 314 ENDIF 314 315 #ifdef NC_DOUBLE 315 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,zgam)316 #else 317 ierr = NF_GET_VAR _REAL(nid, nvarid,zgam)316 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,zgam) 317 #else 318 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,zgam) 318 319 #endif 319 320 IF (ierr.NE.NF_NOERR) THEN … … 323 324 xmin = 1.0E+20 324 325 xmax = -1.0E+20 325 DO i = 1, ngrid mx326 DO i = 1, ngrid 326 327 xmin = MIN(zgam(i),xmin) 327 328 xmax = MAX(zgam(i),xmax) … … 337 338 ENDIF 338 339 #ifdef NC_DOUBLE 339 ierr = NF_GET_VAR _DOUBLE(nid, nvarid,zthe)340 #else 341 ierr = NF_GET_VAR _REAL(nid, nvarid,zthe)340 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,zthe) 341 #else 342 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,zthe) 342 343 #endif 343 344 IF (ierr.NE.NF_NOERR) THEN … … 347 348 xmin = 1.0E+20 348 349 xmax = -1.0E+20 349 DO i = 1, ngrid mx350 DO i = 1, ngrid 350 351 xmin = MIN(zthe(i),xmin) 351 352 xmax = MAX(zthe(i),xmax) … … 413 414 PRINT*, ' J ignore donc les autres temperatures TS**' 414 415 #ifdef NC_DOUBLE 415 ierr = NF_GET_VAR _DOUBLE(nid, nvarid, tsurf(1,1))416 #else 417 ierr = NF_GET_VAR _REAL(nid, nvarid, tsurf(1,1))416 ierr = NF_GET_VARA_DOUBLE(nid, nvarid, sta, ngrid, tsurf) 417 #else 418 ierr = NF_GET_VARA_REAL(nid, nvarid, sta, ngrid, tsurf) 418 419 #endif 419 420 IF (ierr.NE.NF_NOERR) THEN … … 428 429 IF (nbsrf >= 2) THEN 429 430 DO nsrf = 2, nbsrf 430 DO i = 1, ngrid mx431 DO i = 1, ngrid 431 432 tsurf(i,nsrf) = tsurf(i,1) 432 433 ENDDO … … 448 449 ! PRINT*, "phyetat0: Le champ <tsoil> est absent" 449 450 ! PRINT*, " Il prend donc la valeur de surface" 450 ! DO i=1, ngrid mx451 ! DO i=1, ngrid 451 452 ! tsoil(i,isoil,nsrf)=tsurf(i,nsrf) 452 453 ! ENDDO … … 478 479 ENDIF 479 480 #ifdef NC_DOUBLE 480 ierr = NF_GET_VAR _DOUBLE(nid, nvarid, emis)481 #else 482 ierr = NF_GET_VAR _REAL(nid, nvarid, emis)481 ierr = NF_GET_VARA_DOUBLE(nid, nvarid, sta,ngrid, emis) 482 #else 483 ierr = NF_GET_VARA_REAL(nid, nvarid,sta,ngrid, emis) 483 484 #endif 484 485 IF (ierr.NE.NF_NOERR) THEN … … 501 502 ! CALL abort 502 503 ENDIF 503 #ifdef NC_DOUBLE 504 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, cloudfrac) 505 #else 506 ierr = NF_GET_VAR_REAL(nid, nvarid, cloudfrac) 504 sta2d = (/sta,1/) 505 siz2d = (/ngrid, nlayermx/) 506 #ifdef NC_DOUBLE 507 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta2d,siz2d,cloudfrac) 508 #else 509 ierr = NF_GET_VARA_REAL(nid,nvarid,sta2d,siz2d,cloudfrac) 507 510 #endif 508 511 IF (ierr.NE.NF_NOERR) THEN … … 528 531 ENDIF 529 532 #ifdef NC_DOUBLE 530 ierr = NF_GET_VAR _DOUBLE(nid, nvarid, totcloudfrac)531 #else 532 ierr = NF_GET_VAR _REAL(nid, nvarid, totcloudfrac)533 ierr = NF_GET_VARA_DOUBLE(nid, nvarid,sta,ngrid, totcloudfrac) 534 #else 535 ierr = NF_GET_VARA_REAL(nid, nvarid,sta,ngrid, totcloudfrac) 533 536 #endif 534 537 IF (ierr.NE.NF_NOERR) THEN … … 553 556 ENDIF 554 557 #ifdef NC_DOUBLE 555 ierr = NF_GET_VAR _DOUBLE(nid, nvarid, hice)556 #else 557 ierr = NF_GET_VAR _REAL(nid, nvarid, hice)558 ierr = NF_GET_VARA_DOUBLE(nid, nvarid,sta,ngrid, hice) 559 #else 560 ierr = NF_GET_VARA_REAL(nid, nvarid,sta,ngrid, hice) 558 561 #endif 559 562 IF (ierr.NE.NF_NOERR) THEN … … 576 579 CALL abort 577 580 ENDIF 578 #ifdef NC_DOUBLE 579 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, q2) 580 #else 581 ierr = NF_GET_VAR_REAL(nid, nvarid, q2) 581 sta2d = (/sta,1/) 582 siz2d = (/ngrid, llm+1/) 583 #ifdef NC_DOUBLE 584 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta2d,siz2d,q2) 585 #else 586 ierr = NF_GET_VARA_REAL(nid,nvarid,sta2d,siz2d,q2) 582 587 #endif 583 588 IF (ierr.NE.NF_NOERR) THEN … … 604 609 write(txt,'(a5,i2.2)')'qsurf',iq 605 610 ELSE 606 txt= tnom(iq)611 txt=noms(iq) 607 612 ! if (txt.eq."h2o_vap") then 608 613 ! There is no surface tracer for h2o_vap; … … 618 623 & ' not found in file' 619 624 write(*,*) trim(txt), ' set to 0' 620 do ig=1,ngrid mx625 do ig=1,ngrid 621 626 qsurf(ig,iq)=0. 622 627 end do 623 628 nqold=min(iq-1,nqold) 624 629 ELSE 625 #ifdef NC_DOUBLE 626 ierr = NF_GET_VAR_DOUBLE(nid, nvarid,qsurf(1,iq)) 627 #else 628 ierr = NF_GET_VAR_REAL(nid, nvarid,qsurf(1,iq)) 630 toto(:) = 0. 631 #ifdef NC_DOUBLE 632 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta,ngrid,toto) 633 #else 634 ierr = NF_GET_VARA_REAL(nid,nvarid,sta,ngrid,toto) 629 635 #endif 630 636 IF (ierr.NE.NF_NOERR) THEN … … 632 638 CALL abort 633 639 ENDIF 640 qsurf(1:ngrid,iq) = toto(1:ngrid) 634 641 ENDIF 635 642 xmin = 1.0E+20 636 643 xmax = -1.0E+20 637 xmin = MINVAL(qsurf(1:ngrid mx,iq))638 xmax = MAXVAL(qsurf(1:ngrid mx,iq))644 xmin = MINVAL(qsurf(1:ngrid,iq)) 645 xmax = MAXVAL(qsurf(1:ngrid,iq)) 639 646 PRINT*,'tracer on surface <',trim(txt),'>:',xmin,xmax 640 647 ENDDO … … 642 649 c case when new tracer are added in addition to old ones 643 650 write(*,*)'qsurf 1 to ', nqold,'were already present' 644 write(*,*)'qsurf ', nqold+1,' to ', nq mx,'are new'651 write(*,*)'qsurf ', nqold+1,' to ', nq,'are new' 645 652 write(*,*)' and initialized to zero' 646 qsurf(:,nqold+1:nq mx)=0.0653 qsurf(:,nqold+1:nq)=0.0 647 654 ! yes=' ' 648 655 ! do while ((yes.ne.'y').and.(yes.ne.'n')) 649 656 ! write(*,*) 'Would you like to reindex qsurf # 1 ->',nqold 650 ! write(*,*) 'to #',nq mx-nqold+1,'->', nqmx,' (y or n) ?'657 ! write(*,*) 'to #',nq-nqold+1,'->', nq,' (y or n) ?' 651 658 ! read(*,fmt='(a)') yes 652 659 ! end do 653 660 ! if (yes.eq.'y') then 654 661 ! write(*,*) 'OK, let s reindex qsurf' 655 ! do ig=1,ngrid mx656 ! do iq=nq mx,nqmx-nqold+1,-1657 ! qsurf(ig,iq)=qsurf(ig,iq-nq mx+nqold)662 ! do ig=1,ngrid 663 ! do iq=nq,nq-nqold+1,-1 664 ! qsurf(ig,iq)=qsurf(ig,iq-nq+nqold) 658 665 ! end do 659 ! do iq=nq mx-nqold,1,-1666 ! do iq=nq-nqold,1,-1 660 667 ! qsurf(ig,iq)= 0. 661 668 ! end do … … 668 675 ! as well as thermal inertia and volumetric heat capacity 669 676 670 call soil_settings(nid,ngridmx,nsoil,tsurf,tsoil) 677 PRINT*,'SOIL INIT' 678 call soil_settings(nid,ngrid,nsoil,tsurf,tsoil) 671 679 c 672 680 c Fermer le fichier: … … 674 682 ierr = NF_CLOSE(nid) 675 683 c 684 676 685 RETURN 677 686 END -
trunk/LMDZ.GENERIC/libf/phystd/physdem1.F
r726 r787 1 subroutine physdem1( filename,lonfi,latfi,nsoil,nq,1 subroutine physdem1(ngrid,filename,lonfi,latfi,nsoil,nq, 2 2 . phystep,day_ini, 3 3 . time,tsurf,tsoil,emis,q2,qsurf, 4 4 . airefi,alb,ith,pzmea,pzstd,pzsig,pzgam,pzthe, 5 . cloudfrac,totcloudfrac,hice) 6 5 . cloudfrac,totcloudfrac,hice,nametrac) 6 7 use surfdat_h 8 use comsoil_h 9 USE comgeomfi_h 7 10 8 11 implicit none … … 36 39 #include "netcdf.inc" 37 40 #include "dimphys.h" 38 #include"advtrac.h"39 41 #include"callkeys.h" 42 43 INTEGER :: ngrid 40 44 41 45 INTEGER nid,iq … … 50 54 51 55 REAL phystep,time 52 REAL latfi(ngrid mx), lonfi(ngridmx)53 ! REAL champhys(ngrid mx)54 REAL tsurf(ngrid mx)56 REAL latfi(ngrid), lonfi(ngrid) 57 ! REAL champhys(ngrid) 58 REAL tsurf(ngrid) 55 59 INTEGER length 56 60 PARAMETER (length=100) … … 58 62 59 63 ! added by BC 60 REAL hice(ngridmx),cloudfrac(ngridmx,nlayermx) 61 REAL totcloudfrac(ngridmx) 64 REAL hice(ngrid),cloudfrac(ngrid,nlayermx) 65 REAL totcloudfrac(ngrid) 66 67 ! AS: name of tracers added as an argument to avoid using nqmx in commons (i.e. adv trac) 68 ! nota: physdem1 is used both in physiq and newstart. 69 character*20 nametrac(nq) ! name of the tracer 62 70 63 71 … … 68 76 #include "clesph0.h" 69 77 #include "fxyprim.h" 70 #include "comgeomfi.h"71 #include "surfdat.h"72 #include "comsoil.h"73 78 #include "planete.h" 74 79 #include "comcstfi.h" 75 80 76 real tsoil(ngrid mx,nsoil),emis(ngridmx)77 real q2(ngrid mx, llm+1),qsurf(ngridmx,nq)78 real airefi(ngrid mx)79 real alb(ngrid mx),ith(ngridmx,nsoil)80 real pzmea(ngrid mx),pzstd(ngridmx)81 real pzsig(ngrid mx),pzgam(ngridmx),pzthe(ngridmx)81 real tsoil(ngrid,nsoil),emis(ngrid) 82 real q2(ngrid, llm+1),qsurf(ngrid,nq) 83 real airefi(ngrid) 84 real alb(ngrid),ith(ngrid,nsoil) 85 real pzmea(ngrid),pzstd(ngrid) 86 real pzsig(ngrid),pzgam(ngrid),pzthe(ngrid) 82 87 integer ig 83 88 … … 92 97 93 98 ! copy airefi(:) to area(:) 94 CALL SCOPY(ngrid mx,airefi,1,area,1)99 CALL SCOPY(ngrid,airefi,1,area,1) 95 100 ! note: area() is defined in comgeomfi.h 96 101 97 DO ig=1,ngrid mx102 DO ig=1,ngrid 98 103 albedodat(ig)=alb(ig) ! note: albedodat() is defined in surfdat.h 99 104 zmea(ig)=pzmea(ig) ! note: zmea() is defined in surfdat.h … … 127 132 endif 128 133 c 129 ierr = NF_DEF_DIM (nid,"physical_points",ngrid mx,idim2)134 ierr = NF_DEF_DIM (nid,"physical_points",ngrid,idim2) 130 135 if (ierr.ne.NF_NOERR) then 131 136 WRITE(6,*)'physdem1: Problem defining physical_points dimension' … … 169 174 ENDDO 170 175 171 write(*,*) "physdem1: ngrid mx: ",ngridmx176 write(*,*) "physdem1: ngrid: ",ngrid 172 177 173 178 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc … … 175 180 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 176 181 c Informations on the physics grid 177 tab_cntrl(1) = float(ngrid mx) ! number of nodes on physics grid182 tab_cntrl(1) = float(ngrid) ! number of nodes on physics grid 178 183 tab_cntrl(2) = float(nlayermx) ! number of atmospheric layers 179 184 tab_cntrl(3) = day_ini + int(time) ! initial day … … 618 623 ! qsurf02, ...) 619 624 count=0 620 do iq=1,nq mx625 do iq=1,nq 621 626 txt= " " 622 627 write(txt,'(a1,i2.2)')'q',iq 623 if (txt.ne. tnom(iq)) then ! use tracer names stored in dynamics628 if (txt.ne.nametrac(iq)) then ! use tracer names stored in dynamics 624 629 ! did not find old tracer name 625 630 exit ! might as well stop here … … 629 634 endif 630 635 enddo 631 if (count.eq.nq mx) then636 if (count.eq.nq) then 632 637 write(*,*) "physdem1:tracers seem to follow old naming ", 633 638 & "convention (qsurf01,qsurf02,...)" … … 638 643 !oldtracernames=.true. 639 644 ! Moreover, if computing water cycle with ice, move surface ice 640 ! back to qsurf(nq mx)645 ! back to qsurf(nq) 641 646 !IF (iceparty) THEN 642 ! write(*,*)'physdem1: moving surface water ice to index ',nq mx643 ! qsurf(1:ngrid mx,nqmx)=qsurf(1:ngridmx,nqmx-1)644 ! qsurf(1:ngrid mx,nqmx-1)=0647 ! write(*,*)'physdem1: moving surface water ice to index ',nq 648 ! qsurf(1:ngrid,nq)=qsurf(1:ngrid,nq-1) 649 ! qsurf(1:ngrid,nq-1)=0 645 650 !ENDIF 646 endif ! of if (count.eq.nq mx)651 endif ! of if (count.eq.nq) 647 652 648 653 IF(nq.GE.1) THEN … … 650 655 if (.not.oldtracernames) then 651 656 do iq=1,nq 652 if ( tnom(iq).eq."h2o_vap") then657 if (nametrac(iq).eq."h2o_vap") then 653 658 i_h2o_vap=iq 654 659 endif 655 if ( tnom(iq).eq."h2o_ice") then660 if (nametrac(iq).eq."h2o_ice") then 656 661 i_h2o_ice=iq 657 662 endif … … 671 676 write(txt,'(a5,i2.2)')'qsurf',iq 672 677 ELSE 673 txt= tnom(iq)678 txt=nametrac(iq) 674 679 675 680 -
trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
r775 r787 1 1 subroutine physiq(ngrid,nlayer,nq, & 2 nametrac, & 2 3 firstcall,lastcall, & 3 4 pday,ptime,ptimestep, & … … 13 14 use radii_mod, only: h2o_reffrad, co2_reffrad 14 15 use aerosol_mod 16 use surfdat_h 17 use comdiurn_h 18 use comsaison_h 19 use comsoil_h 20 USE comgeomfi_h 21 USE tracer_h 22 15 23 implicit none 16 24 … … 103 111 ! New turbulent diffusion scheme: J. Leconte (2012) 104 112 ! Loops converted to F90 matrix format: J. Leconte (2012) 113 ! No more ngridmx/nqmx, F90 commons and adaptation to parallel: A. Spiga (2012) 105 114 ! 106 115 !================================================================== … … 112 121 #include "dimensions.h" 113 122 #include "dimphys.h" 114 #include "comgeomfi.h"115 #include "surfdat.h"116 #include "comsoil.h"117 #include "comdiurn.h"118 123 #include "callkeys.h" 119 124 #include "comcstfi.h" 120 125 #include "planete.h" 121 #include "comsaison.h"122 126 #include "control.h" 123 #include "tracer.h"124 #include "watercap.h"125 127 #include "netcdf.inc" 126 128 … … 132 134 integer ngrid,nlayer,nq 133 135 real ptimestep 134 real pplev(ngrid mx,nlayer+1),pplay(ngridmx,nlayer)135 real pphi(ngrid mx,nlayer)136 real pu(ngrid mx,nlayer),pv(ngridmx,nlayer)137 real pt(ngrid mx,nlayer),pq(ngridmx,nlayer,nq)138 real pw(ngrid mx,nlayer) ! pvervel transmitted by dyn3d139 real zh(ngrid mx,nlayermx) ! potential temperature (K)136 real pplev(ngrid,nlayer+1),pplay(ngrid,nlayer) 137 real pphi(ngrid,nlayer) 138 real pu(ngrid,nlayer),pv(ngrid,nlayer) 139 real pt(ngrid,nlayer),pq(ngrid,nlayer,nq) 140 real pw(ngrid,nlayer) ! pvervel transmitted by dyn3d 141 real zh(ngrid,nlayermx) ! potential temperature (K) 140 142 logical firstcall,lastcall 141 143 … … 144 146 logical tracerdyn 145 147 148 character*20 nametrac(nq) ! name of the tracer from dynamics 149 146 150 ! outputs: 147 151 ! -------- 148 152 ! physical tendencies 149 real pdu(ngrid mx,nlayer),pdv(ngridmx,nlayer)150 real pdt(ngrid mx,nlayer),pdq(ngridmx,nlayer,nq)151 real pdpsrf(ngrid mx) ! surface pressure tendency153 real pdu(ngrid,nlayer),pdv(ngrid,nlayer) 154 real pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq) 155 real pdpsrf(ngrid) ! surface pressure tendency 152 156 153 157 … … 157 161 ! "longrefvis" set in dimradmars.h , for one of the "naerkind" kind of 158 162 ! aerosol optical properties: 159 ! real aerosol(ngrid mx,nlayermx,naerkind)163 ! real aerosol(ngrid,nlayermx,naerkind) 160 164 ! this is now internal to callcorrk and hence no longer needed here 161 165 162 166 integer day_ini ! Initial date of the run (sol since Ls=0) 163 167 integer icount ! counter of calls to physiq during the run. 164 real tsurf(ngridmx) ! Surface temperature (K) 165 real tsoil(ngridmx,nsoilmx) ! sub-surface temperatures (K) 166 real albedo(ngridmx) ! Surface albedo 167 168 real albedo0(ngridmx) ! Surface albedo 169 integer rnat(ngridmx) ! added by BC 170 save rnat 171 172 real emis(ngridmx) ! Thermal IR surface emissivity 173 real dtrad(ngridmx,nlayermx) ! Net atm. radiative heating rate (K.s-1) 174 real fluxrad_sky(ngridmx) ! rad. flux from sky absorbed by surface (W.m-2) 175 real fluxrad(ngridmx) ! Net radiative surface flux (W.m-2) 176 real capcal(ngridmx) ! surface heat capacity (J m-2 K-1) 177 real fluxgrd(ngridmx) ! surface conduction flux (W.m-2) 178 real qsurf(ngridmx,nqmx) ! tracer on surface (e.g. kg.m-2) 179 real q2(ngridmx,nlayermx+1) ! Turbulent Kinetic Energy 168 real, dimension(:),allocatable,save :: tsurf ! Surface temperature (K) 169 real, dimension(:,:),allocatable,save :: tsoil ! sub-surface temperatures (K) 170 real, dimension(:),allocatable,save :: albedo ! Surface albedo 171 172 real,dimension(:),allocatable,save :: albedo0 ! Surface albedo 173 integer,dimension(:),allocatable,save :: rnat ! added by BC 174 175 real,dimension(:),allocatable,save :: emis ! Thermal IR surface emissivity 176 real,dimension(:,:),allocatable,save :: dtrad ! Net atm. radiative heating rate (K.s-1) 177 real,dimension(:),allocatable,save :: fluxrad_sky ! rad. flux from sky absorbed by surface (W.m-2) 178 real,dimension(:),allocatable,save :: fluxrad ! Net radiative surface flux (W.m-2) 179 real,dimension(:),allocatable,save :: capcal ! surface heat capacity (J m-2 K-1) 180 real,dimension(:),allocatable,save :: fluxgrd ! surface conduction flux (W.m-2) 181 real,dimension(:,:),allocatable,save :: qsurf ! tracer on surface (e.g. kg.m-2) 182 real,dimension(:,:),allocatable,save :: q2 ! Turbulent Kinetic Energy 180 183 181 184 save day_ini, icount 182 save tsurf,tsoil183 save albedo0,albedo,emis,q2184 save capcal,fluxgrd,dtrad,fluxrad,fluxrad_sky,qsurf185 185 186 186 ! Local variables : … … 189 189 ! aerosol (dust or ice) extinction optical depth at reference wavelength 190 190 ! for the "naerkind" optically active aerosols: 191 real aerosol(ngrid mx,nlayermx,naerkind)191 real aerosol(ngrid,nlayermx,naerkind) 192 192 193 193 character*80 fichier 194 194 integer l,ig,ierr,iq,iaer 195 195 196 real fluxsurf_lw(ngridmx) ! incident LW (IR) surface flux (W.m-2) 197 real fluxsurf_sw(ngridmx) ! incident SW (stellar) surface flux (W.m-2) 198 real fluxtop_lw(ngridmx) ! Outgoing LW (IR) flux to space (W.m-2) 199 real fluxabs_sw(ngridmx) ! Absorbed SW (stellar) flux (W.m-2) 200 201 real fluxtop_dn(ngridmx) 202 real fluxdyn(ngridmx) ! horizontal heat transport by dynamics 203 real OLR_nu(ngridmx,L_NSPECTI)! Outgoing LW radition in each band (Normalized to the band width (W/m2/cm-1) 204 real OSR_nu(ngridmx,L_NSPECTV)! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1) 205 206 real,save :: sensibFlux(ngridmx) ! turbulent flux given by the atm to the surface 207 208 save fluxsurf_lw,fluxsurf_sw,fluxtop_lw,fluxabs_sw,fluxtop_dn,fluxdyn,OLR_nu,OSR_nu 209 196 !!! this is saved for diagnostic 197 real,dimension(:),allocatable,save :: fluxsurf_lw ! incident LW (IR) surface flux (W.m-2) 198 real,dimension(:),allocatable,save :: fluxsurf_sw ! incident SW (stellar) surface flux (W.m-2) 199 real,dimension(:),allocatable,save :: fluxtop_lw ! Outgoing LW (IR) flux to space (W.m-2) 200 real,dimension(:),allocatable,save :: fluxabs_sw ! Absorbed SW (stellar) flux (W.m-2) 201 real,dimension(:),allocatable,save :: fluxtop_dn 202 real,dimension(:),allocatable,save :: fluxdyn ! horizontal heat transport by dynamics 203 real,dimension(:,:),allocatable,save :: OLR_nu ! Outgoing LW radition in each band (Normalized to the band width (W/m2/cm-1) 204 real,dimension(:,:),allocatable,save :: OSR_nu ! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1) 205 real,dimension(:,:),allocatable,save :: zdtlw ! (K/s) 206 real,dimension(:,:),allocatable,save :: zdtsw ! (K/s) 207 real,dimension(:),allocatable,save :: sensibFlux ! turbulent flux given by the atm to the surface 210 208 211 209 real zls ! solar longitude (rad) 212 210 real zday ! date (time since Ls=0, in martian days) 213 real zzlay(ngrid mx,nlayermx) ! altitude at the middle of the layers214 real zzlev(ngrid mx,nlayermx+1) ! altitude at layer boundaries211 real zzlay(ngrid,nlayermx) ! altitude at the middle of the layers 212 real zzlev(ngrid,nlayermx+1) ! altitude at layer boundaries 215 213 real latvl1,lonvl1 ! Viking Lander 1 point (for diagnostic) 216 214 217 215 ! Tendencies due to various processes: 218 real dqsurf(ngridmx,nqmx) 219 real,save :: zdtlw(ngridmx,nlayermx) ! (K/s) 220 real,save :: zdtsw(ngridmx,nlayermx) ! (K/s) 221 222 real cldtlw(ngridmx,nlayermx) ! (K/s) LW heating rate for clear areas 223 real cldtsw(ngridmx,nlayermx) ! (K/s) SW heating rate for clear areas 224 real zdtsurf(ngridmx) ! (K/s) 225 real dtlscale(ngridmx,nlayermx) 226 real zdvdif(ngridmx,nlayermx),zdudif(ngridmx,nlayermx) ! (m.s-2) 227 real zdhdif(ngridmx,nlayermx), zdtsdif(ngridmx) ! (K/s) 228 real zdtdif(ngridmx,nlayermx) ! (K/s) 229 real zdvadj(ngridmx,nlayermx),zduadj(ngridmx,nlayermx) ! (m.s-2) 230 real zdhadj(ngridmx,nlayermx) ! (K/s) 231 real zdtgw(ngridmx,nlayermx) ! (K/s) 232 real zdtmr(ngridmx,nlayermx) 233 real zdugw(ngridmx,nlayermx),zdvgw(ngridmx,nlayermx) ! (m.s-2) 234 real zdtc(ngridmx,nlayermx),zdtsurfc(ngridmx) 235 real zdvc(ngridmx,nlayermx),zduc(ngridmx,nlayermx) 236 real zdumr(ngridmx,nlayermx),zdvmr(ngridmx,nlayermx) 237 real zdtsurfmr(ngridmx) 216 real dqsurf(ngrid,nq) 217 real cldtlw(ngrid,nlayermx) ! (K/s) LW heating rate for clear areas 218 real cldtsw(ngrid,nlayermx) ! (K/s) SW heating rate for clear areas 219 real zdtsurf(ngrid) ! (K/s) 220 real dtlscale(ngrid,nlayermx) 221 real zdvdif(ngrid,nlayermx),zdudif(ngrid,nlayermx) ! (m.s-2) 222 real zdhdif(ngrid,nlayermx), zdtsdif(ngrid) ! (K/s) 223 real zdtdif(ngrid,nlayermx) ! (K/s) 224 real zdvadj(ngrid,nlayermx),zduadj(ngrid,nlayermx) ! (m.s-2) 225 real zdhadj(ngrid,nlayermx) ! (K/s) 226 real zdtgw(ngrid,nlayermx) ! (K/s) 227 real zdtmr(ngrid,nlayermx) 228 real zdugw(ngrid,nlayermx),zdvgw(ngrid,nlayermx) ! (m.s-2) 229 real zdtc(ngrid,nlayermx),zdtsurfc(ngrid) 230 real zdvc(ngrid,nlayermx),zduc(ngrid,nlayermx) 231 real zdumr(ngrid,nlayermx),zdvmr(ngrid,nlayermx) 232 real zdtsurfmr(ngrid) 238 233 239 real zdmassmr(ngrid mx,nlayermx),zdpsrfmr(ngridmx)240 241 real zdqdif(ngrid mx,nlayermx,nqmx), zdqsdif(ngridmx,nqmx)242 real zdqevap(ngrid mx,nlayermx)243 real zdqsed(ngrid mx,nlayermx,nqmx), zdqssed(ngridmx,nqmx)244 real zdqdev(ngrid mx,nlayermx,nqmx), zdqsdev(ngridmx,nqmx)245 real zdqadj(ngrid mx,nlayermx,nqmx)246 real zdqc(ngrid mx,nlayermx,nqmx)247 real zdqmr(ngrid mx,nlayermx,nqmx),zdqsurfmr(ngridmx,nqmx)248 real zdqlscale(ngrid mx,nlayermx,nqmx)249 real zdqslscale(ngrid mx,nqmx)250 real zdqchim(ngrid mx,nlayermx,nqmx)251 real zdqschim(ngrid mx,nqmx)252 253 real zdteuv(ngrid mx,nlayermx) ! (K/s)254 real zdtconduc(ngrid mx,nlayermx) ! (K/s)255 real zdumolvis(ngrid mx,nlayermx)256 real zdvmolvis(ngrid mx,nlayermx)257 real zdqmoldiff(ngrid mx,nlayermx,nqmx)234 real zdmassmr(ngrid,nlayermx),zdpsrfmr(ngrid) 235 236 real zdqdif(ngrid,nlayermx,nq), zdqsdif(ngrid,nq) 237 real zdqevap(ngrid,nlayermx) 238 real zdqsed(ngrid,nlayermx,nq), zdqssed(ngrid,nq) 239 real zdqdev(ngrid,nlayermx,nq), zdqsdev(ngrid,nq) 240 real zdqadj(ngrid,nlayermx,nq) 241 real zdqc(ngrid,nlayermx,nq) 242 real zdqmr(ngrid,nlayermx,nq),zdqsurfmr(ngrid,nq) 243 real zdqlscale(ngrid,nlayermx,nq) 244 real zdqslscale(ngrid,nq) 245 real zdqchim(ngrid,nlayermx,nq) 246 real zdqschim(ngrid,nq) 247 248 real zdteuv(ngrid,nlayermx) ! (K/s) 249 real zdtconduc(ngrid,nlayermx) ! (K/s) 250 real zdumolvis(ngrid,nlayermx) 251 real zdvmolvis(ngrid,nlayermx) 252 real zdqmoldiff(ngrid,nlayermx,nq) 258 253 259 254 ! Local variables for local calculations: 260 real zflubid(ngrid mx)261 real zplanck(ngrid mx),zpopsk(ngridmx,nlayermx)262 real zdum1(ngrid mx,nlayermx)263 real zdum2(ngrid mx,nlayermx)255 real zflubid(ngrid) 256 real zplanck(ngrid),zpopsk(ngrid,nlayermx) 257 real zdum1(ngrid,nlayermx) 258 real zdum2(ngrid,nlayermx) 264 259 real ztim1,ztim2,ztim3, z1,z2 265 260 real ztime_fin 266 real zdh(ngrid mx,nlayermx)261 real zdh(ngrid,nlayermx) 267 262 integer length 268 263 parameter (length=100) … … 270 265 ! local variables only used for diagnostics (output in file "diagfi" or "stats") 271 266 ! ------------------------------------------------------------------------------ 272 real ps(ngrid mx), zt(ngridmx,nlayermx)273 real zu(ngrid mx,nlayermx),zv(ngridmx,nlayermx)274 real zq(ngrid mx,nlayermx,nqmx)267 real ps(ngrid), zt(ngrid,nlayermx) 268 real zu(ngrid,nlayermx),zv(ngrid,nlayermx) 269 real zq(ngrid,nlayermx,nq) 275 270 character*2 str2 276 271 character*5 str5 277 real zdtadj(ngrid mx,nlayermx)278 real zdtdyn(ngrid mx,nlayermx),ztprevious(ngridmx,nlayermx)279 save ztprevious280 real reff(ngrid mx,nlayermx) ! effective dust radius (used if doubleq=T)272 real zdtadj(ngrid,nlayermx) 273 real zdtdyn(ngrid,nlayermx) 274 real,allocatable,dimension(:,:),save :: ztprevious 275 real reff(ngrid,nlayermx) ! effective dust radius (used if doubleq=T) 281 276 real qtot1,qtot2 ! total aerosol mass 282 277 integer igmin, lmin … … 285 280 real zplev(ngrid,nlayermx+1),zplay(ngrid,nlayermx) 286 281 real zstress(ngrid), cd 287 real hco2(nq mx), tmean, zlocal(nlayermx)288 real vmr(ngrid mx,nlayermx) ! volume mixing ratio282 real hco2(nq), tmean, zlocal(nlayermx) 283 real vmr(ngrid,nlayermx) ! volume mixing ratio 289 284 290 285 real time_phys 291 286 292 287 ! reinstated by RW for diagnostic 293 real tau_col(ngridmx) 294 save tau_col 288 real,allocatable,dimension(:),save :: tau_col 295 289 296 290 ! included by RW to reduce insanity of code … … 298 292 299 293 ! included by RW to compute tracer column densities 300 real qcol(ngrid mx,nqmx)294 real qcol(ngrid,nq) 301 295 302 296 ! included by RW for H2O precipitation 303 real zdtrain(ngrid mx,nlayermx)304 real zdqrain(ngrid mx,nlayermx,nqmx)305 real zdqsrain(ngrid mx)306 real zdqssnow(ngrid mx)307 real rainout(ngrid mx)297 real zdtrain(ngrid,nlayermx) 298 real zdqrain(ngrid,nlayermx,nq) 299 real zdqsrain(ngrid) 300 real zdqssnow(ngrid) 301 real rainout(ngrid) 308 302 309 303 ! included by RW for H2O Manabe scheme 310 real dtmoist(ngrid mx,nlayermx)311 real dqmoist(ngrid mx,nlayermx,nqmx)312 313 real qvap(ngrid mx,nlayermx)314 real dqvaplscale(ngrid mx,nlayermx)315 real dqcldlscale(ngrid mx,nlayermx)316 real rneb_man(ngrid mx,nlayermx)317 real rneb_lsc(ngrid mx,nlayermx)304 real dtmoist(ngrid,nlayermx) 305 real dqmoist(ngrid,nlayermx,nq) 306 307 real qvap(ngrid,nlayermx) 308 real dqvaplscale(ngrid,nlayermx) 309 real dqcldlscale(ngrid,nlayermx) 310 real rneb_man(ngrid,nlayermx) 311 real rneb_lsc(ngrid,nlayermx) 318 312 319 313 ! included by RW to account for surface cooling by evaporation 320 real dtsurfh2olat(ngrid mx)314 real dtsurfh2olat(ngrid) 321 315 322 316 323 317 ! to test energy conservation (RW+JL) 324 real mass(ngrid mx,nlayermx),massarea(ngridmx,nlayermx)318 real mass(ngrid,nlayermx),massarea(ngrid,nlayermx) 325 319 real dEtot, dEtots, AtmToSurf_TurbFlux 326 320 real dEtotSW, dEtotsSW, dEtotLW, dEtotsLW 327 real dEzRadsw(ngrid mx,nlayermx),dEzRadlw(ngridmx,nlayermx),dEzdiff(ngridmx,nlayermx)328 real dEdiffs(ngrid mx),dEdiff(ngridmx)329 real madjdE(ngrid mx), lscaledE(ngridmx)321 real dEzRadsw(ngrid,nlayermx),dEzRadlw(ngrid,nlayermx),dEzdiff(ngrid,nlayermx) 322 real dEdiffs(ngrid),dEdiff(ngrid) 323 real madjdE(ngrid), lscaledE(ngrid) 330 324 !JL12 conservation test for mean flow kinetic energy has been disabled temporarily 331 325 … … 333 327 334 328 ! included by BC for evaporation 335 real qevap(ngrid mx,nlayermx,nqmx)336 real tevap(ngrid mx,nlayermx)337 real dqevap1(ngrid mx,nlayermx)338 real dtevap1(ngrid mx,nlayermx)329 real qevap(ngrid,nlayermx,nq) 330 real tevap(ngrid,nlayermx) 331 real dqevap1(ngrid,nlayermx) 332 real dtevap1(ngrid,nlayermx) 339 333 340 334 ! included by BC for hydrology 341 real hice(ngrid mx)335 real hice(ngrid) 342 336 343 337 ! included by RW to test water conservation (by routine) … … 349 343 350 344 ! included by RW for RH diagnostic 351 real qsat(ngrid mx,nlayermx), RH(ngridmx,nlayermx), H2Omaxcol(ngridmx),psat_tmp345 real qsat(ngrid,nlayermx), RH(ngrid,nlayermx), H2Omaxcol(ngrid),psat_tmp 352 346 353 347 ! included by RW for hydrology 354 real dqs_hyd(ngrid mx,nqmx)355 real zdtsurf_hyd(ngrid mx)348 real dqs_hyd(ngrid,nq) 349 real zdtsurf_hyd(ngrid) 356 350 357 351 ! included by RW for water cycle conservation tests … … 360 354 ! included by BC for double radiative transfer call 361 355 logical clearsky 362 real zdtsw1(ngrid mx,nlayermx)363 real zdtlw1(ngrid mx,nlayermx)364 real fluxsurf_lw1(ngrid mx)365 real fluxsurf_sw1(ngrid mx)366 real fluxtop_lw1(ngrid mx)367 real fluxabs_sw1(ngrid mx)356 real zdtsw1(ngrid,nlayermx) 357 real zdtlw1(ngrid,nlayermx) 358 real fluxsurf_lw1(ngrid) 359 real fluxsurf_sw1(ngrid) 360 real fluxtop_lw1(ngrid) 361 real fluxabs_sw1(ngrid) 368 362 real tau_col1(ngrid) 369 363 real OLR_nu1(ngrid,L_NSPECTI) … … 372 366 373 367 ! included by BC for cloud fraction computations 374 real, save :: cloudfrac(ngridmx,nlayermx)375 real, save :: totcloudfrac(ngridmx)368 real,allocatable,dimension(:,:),save :: cloudfrac 369 real,allocatable,dimension(:),save :: totcloudfrac 376 370 377 371 ! included by RW for vdifc water conservation test 378 372 real nconsMAX 379 real vdifcncons(ngridmx) 380 real cadjncons(ngridmx) 381 382 ! double precision qsurf_hist(ngridmx,nqmx) 383 real qsurf_hist(ngridmx,nqmx) 384 save qsurf_hist 373 real vdifcncons(ngrid) 374 real cadjncons(ngrid) 375 376 ! double precision qsurf_hist(ngrid,nq) 377 real,allocatable,dimension(:,:),save :: qsurf_hist 385 378 386 379 ! included by RW for temp convadj conservation test … … 392 385 393 386 ! included by RW for runway greenhouse 1D study 394 real muvar(ngrid mx,nlayermx+1)387 real muvar(ngrid,nlayermx+1) 395 388 396 389 ! included by RW for variable H2O particle sizes 397 real,save :: reffrad(ngridmx,nlayermx,naerkind) ! aerosol effective radius (m) 398 real,save :: nueffrad(ngridmx,nlayermx,naerkind) ! aerosol effective radius variance 399 real :: reffh2oliq(ngridmx,nlayermx) ! liquid water particles effective radius (m) 400 real :: reffh2oice(ngridmx,nlayermx) ! water ice particles effective radius (m) 401 real reffH2O(ngridmx,nlayermx) 402 real reffcol(ngridmx,naerkind) 390 real,allocatable,dimension(:,:,:),save :: reffrad ! aerosol effective radius (m) 391 real,allocatable,dimension(:,:,:),save :: nueffrad ! aerosol effective radius variance 392 real :: nueffrad_dummy(ngrid,nlayermx,naerkind) !! AS. This is temporary. Check below why. 393 real :: reffh2oliq(ngrid,nlayermx) ! liquid water particles effective radius (m) 394 real :: reffh2oice(ngrid,nlayermx) ! water ice particles effective radius (m) 395 real reffH2O(ngrid,nlayermx) 396 real reffcol(ngrid,naerkind) 403 397 404 398 ! included by RW for sourceevol 405 real, save :: ice_initial(ngridmx)!, isoil399 real,allocatable,dimension(:),save :: ice_initial 406 400 real delta_ice,ice_tot 407 real, save :: ice_min(ngridmx)401 real,allocatable,dimension(:),save :: ice_min 408 402 409 403 integer num_run … … 411 405 412 406 !======================================================================= 413 407 408 !!! ALLOCATE SAVED ARRAYS 409 IF (.not. ALLOCATED(tsurf)) ALLOCATE(tsurf(ngrid)) 410 IF (.not. ALLOCATED(tsoil)) ALLOCATE(tsoil(ngrid,nsoilmx)) 411 IF (.not. ALLOCATED(albedo)) ALLOCATE(albedo(ngrid)) 412 IF (.not. ALLOCATED(albedo0)) ALLOCATE(albedo0(ngrid)) 413 IF (.not. ALLOCATED(rnat)) ALLOCATE(rnat(ngrid)) 414 IF (.not. ALLOCATED(emis)) ALLOCATE(emis(ngrid)) 415 IF (.not. ALLOCATED(dtrad)) ALLOCATE(dtrad(ngrid,nlayermx)) 416 IF (.not. ALLOCATED(fluxrad_sky)) ALLOCATE(fluxrad_sky(ngrid)) 417 IF (.not. ALLOCATED(fluxrad)) ALLOCATE(fluxrad(ngrid)) 418 IF (.not. ALLOCATED(capcal)) ALLOCATE(capcal(ngrid)) 419 IF (.not. ALLOCATED(fluxgrd)) ALLOCATE(fluxgrd(ngrid)) 420 IF (.not. ALLOCATED(qsurf)) ALLOCATE(qsurf(ngrid,nq)) 421 IF (.not. ALLOCATED(q2)) ALLOCATE(q2(ngrid,nlayermx+1)) 422 IF (.not. ALLOCATED(ztprevious)) ALLOCATE(ztprevious(ngrid,nlayermx)) 423 IF (.not. ALLOCATED(cloudfrac)) ALLOCATE(cloudfrac(ngrid,nlayermx)) 424 IF (.not. ALLOCATED(totcloudfrac)) ALLOCATE(totcloudfrac(ngrid)) 425 IF (.not. ALLOCATED(qsurf_hist)) ALLOCATE(qsurf_hist(ngrid,nq)) 426 IF (.not. ALLOCATED(reffrad)) ALLOCATE(reffrad(ngrid,nlayermx,naerkind)) 427 IF (.not. ALLOCATED(nueffrad)) ALLOCATE(nueffrad(ngrid,nlayermx,naerkind)) 428 IF (.not. ALLOCATED(ice_initial)) ALLOCATE(ice_initial(ngrid)) 429 IF (.not. ALLOCATED(ice_min)) ALLOCATE(ice_min(ngrid)) 430 431 IF (.not. ALLOCATED(fluxsurf_lw)) ALLOCATE(fluxsurf_lw(ngrid)) 432 IF (.not. ALLOCATED(fluxsurf_sw)) ALLOCATE(fluxsurf_sw(ngrid)) 433 IF (.not. ALLOCATED(fluxtop_lw)) ALLOCATE(fluxtop_lw(ngrid)) 434 IF (.not. ALLOCATED(fluxabs_sw)) ALLOCATE(fluxabs_sw(ngrid)) 435 IF (.not. ALLOCATED(fluxtop_dn)) ALLOCATE(fluxtop_dn(ngrid)) 436 IF (.not. ALLOCATED(fluxdyn)) ALLOCATE(fluxdyn(ngrid)) 437 IF (.not. ALLOCATED(OLR_nu)) ALLOCATE(OLR_nu(ngrid,L_NSPECTI)) 438 IF (.not. ALLOCATED(OSR_nu)) ALLOCATE(OSR_nu(ngrid,L_NSPECTV)) 439 IF (.not. ALLOCATED(sensibFlux)) ALLOCATE(sensibFlux(ngrid)) 440 IF (.not. ALLOCATED(zdtlw)) ALLOCATE(zdtlw(ngrid,nlayermx)) 441 IF (.not. ALLOCATED(zdtsw)) ALLOCATE(zdtsw(ngrid,nlayermx)) 442 IF (.not. ALLOCATED(tau_col)) ALLOCATE(tau_col(ngrid)) 443 444 !======================================================================= 414 445 415 446 ! 1. Initialisation … … 420 451 if (firstcall) then 421 452 453 print*,'FIRSTCALL INITIALIZATION' 454 455 !! this is defined in comsaison_h 456 ALLOCATE(mu0(ngrid)) 457 ALLOCATE(fract(ngrid)) 422 458 423 459 ! variables set to 0 … … 438 474 tracerdyn=tracer 439 475 if (tracer) then 440 call initracer( )476 call initracer(ngrid,nq,nametrac) 441 477 endif ! end tracer 442 478 … … 445 481 ! read startfi (initial parameters) 446 482 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 447 call phyetat0( "startfi.nc",0,0,nsoilmx,nq,&483 call phyetat0(ngrid,"startfi.nc",0,0,nsoilmx,nq, & 448 484 day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf, & 449 485 cloudfrac,totcloudfrac,hice) … … 461 497 ! Initialize albedo and orbital calculation 462 498 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 call surfini(ngrid, qsurf,albedo0)499 call surfini(ngrid,nq,qsurf,albedo0) 464 500 call iniorbit(apoastr,periastr,year_day,peri_day,obliquit) 465 501 … … 474 510 ! ~~~~~~~~~~~~~~~ 475 511 if (callsoil) then 476 call soil(ngrid,nsoilmx,firstcall, inertiedat,&512 call soil(ngrid,nsoilmx,firstcall,lastcall,inertiedat, & 477 513 ptimestep,tsurf,tsoil,capcal,fluxgrd) 478 514 else … … 506 542 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 543 rnat(:)=1 508 do ig=1,ngrid mx544 do ig=1,ngrid 509 545 ! if(iceball.or.oceanball.or.(inertiedat(ig,1).gt.1.E4))then 510 546 if(inertiedat(ig,1).gt.1.E4)then … … 562 598 ! need epsi for the wvp definitions in callcorrk.F 563 599 600 print*,'end FIRSTCALL INITIALIZATION' 601 564 602 endif ! (end of "if firstcall") 565 603 … … 568 606 ! --------------------------------------------------- 569 607 570 if (ngrid.NE.ngridmx) then 571 print*,'STOP in PHYSIQ' 572 print*,'Probleme de dimensions :' 573 print*,'ngrid = ',ngrid 574 print*,'ngridmx = ',ngridmx 575 stop 576 endif 608 print*,'ALL INITIALIZATION' 577 609 578 610 ! Initialize various variables 579 611 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 612 581 pdu(1:ngrid mx,1:nlayermx) = 0.0582 pdv(1:ngrid mx,1:nlayermx) = 0.0613 pdu(1:ngrid,1:nlayermx) = 0.0 614 pdv(1:ngrid,1:nlayermx) = 0.0 583 615 if ( .not.nearco2cond ) then 584 pdt(1:ngrid mx,1:nlayermx) = 0.0616 pdt(1:ngrid,1:nlayermx) = 0.0 585 617 endif 586 pdq(1:ngrid mx,1:nlayermx,1:nqmx) = 0.0587 pdpsrf(1:ngrid mx) = 0.0588 zflubid(1:ngrid mx) = 0.0589 zdtsurf(1:ngrid mx) = 0.0590 dqsurf(1:ngrid mx,1:nqmx)= 0.0618 pdq(1:ngrid,1:nlayermx,1:nq) = 0.0 619 pdpsrf(1:ngrid) = 0.0 620 zflubid(1:ngrid) = 0.0 621 zdtsurf(1:ngrid) = 0.0 622 dqsurf(1:ngrid,1:nq)= 0.0 591 623 592 624 zday=pday+ptime ! compute time, in sols (and fraction thereof) … … 603 635 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 604 636 605 zzlay(1:ngrid mx,1:nlayermx)=pphi(1:ngridmx,1:nlayermx)/g606 607 zzlev(1:ngrid mx,1)=0.608 zzlev(1:ngrid mx,nlayer+1)=1.e7 ! dummy top of last layer above 10000 km...637 zzlay(1:ngrid,1:nlayermx)=pphi(1:ngrid,1:nlayermx)/g 638 639 zzlev(1:ngrid,1)=0. 640 zzlev(1:ngrid,nlayer+1)=1.e7 ! dummy top of last layer above 10000 km... 609 641 610 642 do l=2,nlayer … … 621 653 622 654 do l=1,nlayer 623 do ig=1,ngrid 655 do ig=1,ngrid 624 656 zpopsk(ig,l)=(pplay(ig,l)/pplev(ig,1))**rcp 625 657 zh(ig,l)=pt(ig,l)/zpopsk(ig,l) … … 628 660 enddo 629 661 enddo 662 663 print*,'end ALL INITIALIZATION' 630 664 631 665 !----------------------------------------------------------------------- … … 684 718 zdtlw,zdtsw,fluxsurf_lw,fluxsurf_sw,fluxtop_lw, & 685 719 fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu, & 686 reffrad, tau_col,cloudfrac,totcloudfrac,&720 reffrad,nueffrad,tau_col,cloudfrac,totcloudfrac, & 687 721 clearsky,firstcall,lastcall) 688 722 … … 698 732 zdtlw1,zdtsw1,fluxsurf_lw1,fluxsurf_sw1,fluxtop_lw1, & 699 733 fluxabs_sw1,fluxtop_dn,OLR_nu1,OSR_nu1, & 700 reffrad, tau_col1,cloudfrac,totcloudfrac,&734 reffrad,nueffrad,tau_col1,cloudfrac,totcloudfrac, & 701 735 clearsky,firstcall,lastcall) 702 736 clearsky = .false. ! just in case. … … 725 759 ! Radiative flux from the sky absorbed by the surface (W.m-2) 726 760 GSR=0.0 727 fluxrad_sky(1:ngrid mx)=emis(1:ngridmx)*fluxsurf_lw(1:ngridmx)+fluxsurf_sw(1:ngridmx)*(1.-albedo(1:ngridmx))761 fluxrad_sky(1:ngrid)=emis(1:ngrid)*fluxsurf_lw(1:ngrid)+fluxsurf_sw(1:ngrid)*(1.-albedo(1:ngrid)) 728 762 729 763 if(noradsurf)then ! no lower surface; SW flux just disappears 730 GSR = SUM(fluxsurf_sw(1:ngrid mx)*area(1:ngridmx))/totarea731 fluxrad_sky(1:ngrid mx)=emis(1:ngridmx)*fluxsurf_lw(1:ngridmx)764 GSR = SUM(fluxsurf_sw(1:ngrid)*area(1:ngrid))/totarea 765 fluxrad_sky(1:ngrid)=emis(1:ngrid)*fluxsurf_lw(1:ngrid) 732 766 print*,'SW lost in deep atmosphere = ',GSR,' W m^-2' 733 767 endif 734 768 735 769 ! Net atmospheric radiative heating rate (K.s-1) 736 dtrad(1:ngrid mx,1:nlayermx)=zdtsw(1:ngridmx,1:nlayermx)+zdtlw(1:ngridmx,1:nlayermx)770 dtrad(1:ngrid,1:nlayermx)=zdtsw(1:ngrid,1:nlayermx)+zdtlw(1:ngrid,1:nlayermx) 737 771 738 772 elseif(newtonian)then … … 740 774 ! b) Call Newtonian cooling scheme 741 775 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 742 call newtrelax( mu0,sinlat,zpopsk,pt,pplay,pplev,dtrad,firstcall)743 744 zdtsurf(1:ngrid mx) = +(pt(1:ngridmx,1)-tsurf(1:ngridmx))/ptimestep776 call newtrelax(ngrid,mu0,sinlat,zpopsk,pt,pplay,pplev,dtrad,firstcall) 777 778 zdtsurf(1:ngrid) = +(pt(1:ngrid,1)-tsurf(1:ngrid))/ptimestep 745 779 ! e.g. surface becomes proxy for 1st atmospheric layer ? 746 780 … … 749 783 ! c) Atmosphere has no radiative effect 750 784 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 fluxtop_dn(1:ngrid mx) = fract(1:ngridmx)*mu0(1:ngridmx)*Fat1AU/dist_star**2785 fluxtop_dn(1:ngrid) = fract(1:ngrid)*mu0(1:ngrid)*Fat1AU/dist_star**2 752 786 if(ngrid.eq.1)then ! / by 4 globally in 1D case... 753 787 fluxtop_dn(1) = fract(1)*Fat1AU/dist_star**2/2.0 754 788 endif 755 fluxsurf_sw(1:ngrid mx) = fluxtop_dn(1:ngridmx)756 fluxrad_sky(1:ngrid mx) = fluxtop_dn(1:ngridmx)*(1.-albedo(1:ngridmx))757 fluxtop_lw(1:ngrid mx) = emis(1:ngridmx)*sigma*tsurf(1:ngridmx)**4789 fluxsurf_sw(1:ngrid) = fluxtop_dn(1:ngrid) 790 fluxrad_sky(1:ngrid) = fluxtop_dn(1:ngrid)*(1.-albedo(1:ngrid)) 791 fluxtop_lw(1:ngrid) = emis(1:ngrid)*sigma*tsurf(1:ngrid)**4 758 792 ! radiation skips the atmosphere entirely 759 793 760 794 761 dtrad(1:ngrid mx,1:nlayermx)=0.0795 dtrad(1:ngrid,1:nlayermx)=0.0 762 796 ! hence no atmospheric radiative heating 763 797 … … 765 799 766 800 endif ! of if(mod(icount-1,iradia).eq.0) 767 801 768 802 769 803 ! Transformation of the radiative tendencies 770 804 ! ------------------------------------------ 771 805 772 zplanck(1:ngrid mx)=tsurf(1:ngridmx)*tsurf(1:ngridmx)773 zplanck(1:ngrid mx)=emis(1:ngridmx)*sigma*zplanck(1:ngridmx)*zplanck(1:ngridmx)774 fluxrad(1:ngrid mx)=fluxrad_sky(1:ngridmx)-zplanck(1:ngridmx)775 pdt(1:ngrid mx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)+dtrad(1:ngridmx,1:nlayermx)806 zplanck(1:ngrid)=tsurf(1:ngrid)*tsurf(1:ngrid) 807 zplanck(1:ngrid)=emis(1:ngrid)*sigma*zplanck(1:ngrid)*zplanck(1:ngrid) 808 fluxrad(1:ngrid)=fluxrad_sky(1:ngrid)-zplanck(1:ngrid) 809 pdt(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)+dtrad(1:ngrid,1:nlayermx) 776 810 777 811 !------------------------- … … 794 828 !------------------------- 795 829 830 print*,'end RADIATIVE TRANSFER' 796 831 endif ! of if (callrad) 797 832 … … 802 837 if (calldifv) then 803 838 804 zflubid(1:ngrid mx)=fluxrad(1:ngridmx)+fluxgrd(1:ngridmx)805 806 zdum1(1:ngrid mx,1:nlayermx)=0.0807 zdum2(1:ngrid mx,1:nlayermx)=0.0839 zflubid(1:ngrid)=fluxrad(1:ngrid)+fluxgrd(1:ngrid) 840 841 zdum1(1:ngrid,1:nlayermx)=0.0 842 zdum2(1:ngrid,1:nlayermx)=0.0 808 843 809 844 … … 821 856 else 822 857 823 zdh(1:ngrid mx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)/zpopsk(1:ngridmx,1:nlayermx)858 zdh(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)/zpopsk(1:ngrid,1:nlayermx) 824 859 825 860 call vdifc(ngrid,nlayer,nq,rnat,zpopsk, & … … 831 866 sensibFlux,q2,zdqdif,zdqsdif,lastcall) 832 867 833 zdtdif(1:ngrid mx,1:nlayermx)=zdhdif(1:ngridmx,1:nlayermx)*zpopsk(1:ngridmx,1:nlayermx) ! for diagnostic only834 zdqevap(1:ngrid mx,1:nlayermx)=0.868 zdtdif(1:ngrid,1:nlayermx)=zdhdif(1:ngrid,1:nlayermx)*zpopsk(1:ngrid,1:nlayermx) ! for diagnostic only 869 zdqevap(1:ngrid,1:nlayermx)=0. 835 870 836 871 end if !turbdiff 837 872 838 pdv(1:ngrid mx,1:nlayermx)=pdv(1:ngridmx,1:nlayermx)+zdvdif(1:ngridmx,1:nlayermx)839 pdu(1:ngrid mx,1:nlayermx)=pdu(1:ngridmx,1:nlayermx)+zdudif(1:ngridmx,1:nlayermx)840 pdt(1:ngrid mx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)+zdtdif(1:ngridmx,1:nlayermx)841 zdtsurf(1:ngrid mx)=zdtsurf(1:ngridmx)+zdtsdif(1:ngridmx)873 pdv(1:ngrid,1:nlayermx)=pdv(1:ngrid,1:nlayermx)+zdvdif(1:ngrid,1:nlayermx) 874 pdu(1:ngrid,1:nlayermx)=pdu(1:ngrid,1:nlayermx)+zdudif(1:ngrid,1:nlayermx) 875 pdt(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)+zdtdif(1:ngrid,1:nlayermx) 876 zdtsurf(1:ngrid)=zdtsurf(1:ngrid)+zdtsdif(1:ngrid) 842 877 if (tracer) then 843 pdq(1:ngrid mx,1:nlayermx,1:nqmx)=pdq(1:ngridmx,1:nlayermx,1:nqmx)+ zdqdif(1:ngridmx,1:nlayermx,1:nqmx)844 dqsurf(1:ngrid mx,1:nqmx)=dqsurf(1:ngridmx,1:nqmx) + zdqsdif(1:ngridmx,1:nqmx)878 pdq(1:ngrid,1:nlayermx,1:nq)=pdq(1:ngrid,1:nlayermx,1:nq)+ zdqdif(1:ngrid,1:nlayermx,1:nq) 879 dqsurf(1:ngrid,1:nq)=dqsurf(1:ngrid,1:nq) + zdqsdif(1:ngrid,1:nq) 845 880 end if ! of if (tracer) 846 881 … … 899 934 if(.not.newtonian)then 900 935 901 zdtsurf(1:ngridmx) = zdtsurf(1:ngridmx) + (fluxrad(1:ngridmx) + fluxgrd(1:ngridmx))/capcal(1:ngridmx) 902 903 endif 904 936 zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + (fluxrad(1:ngrid) + fluxgrd(1:ngrid))/capcal(1:ngrid) 937 938 endif 939 940 print*,'end TURBULENCE' 905 941 endif ! of if (calldifv) 906 942 … … 912 948 if(calladj) then 913 949 914 zdh(1:ngrid mx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)/zpopsk(1:ngridmx,1:nlayermx)915 zduadj(1:ngrid mx,1:nlayermx)=0.0916 zdvadj(1:ngrid mx,1:nlayermx)=0.0917 zdhadj(1:ngrid mx,1:nlayermx)=0.0950 zdh(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)/zpopsk(1:ngrid,1:nlayermx) 951 zduadj(1:ngrid,1:nlayermx)=0.0 952 zdvadj(1:ngrid,1:nlayermx)=0.0 953 zdhadj(1:ngrid,1:nlayermx)=0.0 918 954 919 955 … … 925 961 zdqadj) 926 962 927 pdu(1:ngrid mx,1:nlayermx) = pdu(1:ngridmx,1:nlayermx) + zduadj(1:ngridmx,1:nlayermx)928 pdv(1:ngrid mx,1:nlayermx) = pdv(1:ngridmx,1:nlayermx) + zdvadj(1:ngridmx,1:nlayermx)929 pdt(1:ngrid mx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx) + zdhadj(1:ngridmx,1:nlayermx)*zpopsk(1:ngridmx,1:nlayermx)930 zdtadj(1:ngrid mx,1:nlayermx) = zdhadj(1:ngridmx,1:nlayermx)*zpopsk(1:ngridmx,1:nlayermx) ! for diagnostic only963 pdu(1:ngrid,1:nlayermx) = pdu(1:ngrid,1:nlayermx) + zduadj(1:ngrid,1:nlayermx) 964 pdv(1:ngrid,1:nlayermx) = pdv(1:ngrid,1:nlayermx) + zdvadj(1:ngrid,1:nlayermx) 965 pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx) + zdhadj(1:ngrid,1:nlayermx)*zpopsk(1:ngrid,1:nlayermx) 966 zdtadj(1:ngrid,1:nlayermx) = zdhadj(1:ngrid,1:nlayermx)*zpopsk(1:ngrid,1:nlayermx) ! for diagnostic only 931 967 932 968 if(tracer) then 933 pdq(1:ngrid mx,1:nlayermx,1:nqmx) = pdq(1:ngridmx,1:nlayermx,1:nqmx) + zdqadj(1:ngridmx,1:nlayermx,1:nqmx)969 pdq(1:ngrid,1:nlayermx,1:nq) = pdq(1:ngrid,1:nlayermx,1:nq) + zdqadj(1:ngrid,1:nlayermx,1:nq) 934 970 end if 935 971 … … 959 995 endif 960 996 !------------------------- 961 997 998 print*,'end CONVADJ' 962 999 endif ! of if(calladj) 963 1000 … … 980 1017 981 1018 982 pdt(1:ngrid mx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)+zdtc(1:ngridmx,1:nlayermx)983 pdv(1:ngrid mx,1:nlayermx)=pdv(1:ngridmx,1:nlayermx)+zdvc(1:ngridmx,1:nlayermx)984 pdu(1:ngrid mx,1:nlayermx)=pdu(1:ngridmx,1:nlayermx)+zduc(1:ngridmx,1:nlayermx)985 zdtsurf(1:ngrid mx) = zdtsurf(1:ngridmx) + zdtsurfc(1:ngridmx)986 987 pdq(1:ngrid mx,1:nlayermx,1:nqmx)=pdq(1:ngridmx,1:nlayermx,1:nqmx)+ zdqc(1:ngridmx,1:nlayermx,1:nqmx)1019 pdt(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)+zdtc(1:ngrid,1:nlayermx) 1020 pdv(1:ngrid,1:nlayermx)=pdv(1:ngrid,1:nlayermx)+zdvc(1:ngrid,1:nlayermx) 1021 pdu(1:ngrid,1:nlayermx)=pdu(1:ngrid,1:nlayermx)+zduc(1:ngrid,1:nlayermx) 1022 zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurfc(1:ngrid) 1023 1024 pdq(1:ngrid,1:nlayermx,1:nq)=pdq(1:ngrid,1:nlayermx,1:nq)+ zdqc(1:ngrid,1:nlayermx,1:nq) 988 1025 ! Note: we do not add surface co2ice tendency 989 1026 ! because qsurf(:,igcm_co2_ice) is updated in condens_co2cloud … … 1021 1058 ! ---------------- 1022 1059 1023 dqmoist(1:ngrid mx,1:nlayermx,1:nqmx)=0.1024 dtmoist(1:ngrid mx,1:nlayermx)=0.1025 1026 call moistadj( pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man)1027 1028 pdq(1:ngrid mx,1:nlayermx,igcm_h2o_vap) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) &1029 +dqmoist(1:ngrid mx,1:nlayermx,igcm_h2o_vap)1030 pdq(1:ngrid mx,1:nlayermx,igcm_h2o_ice) =pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) &1031 +dqmoist(1:ngrid mx,1:nlayermx,igcm_h2o_ice)1032 pdt(1:ngrid mx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)+dtmoist(1:ngridmx,1:nlayermx)1060 dqmoist(1:ngrid,1:nlayermx,1:nq)=0. 1061 dtmoist(1:ngrid,1:nlayermx)=0. 1062 1063 call moistadj(ngrid,nq,pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) 1064 1065 pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) = pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) & 1066 +dqmoist(1:ngrid,1:nlayermx,igcm_h2o_vap) 1067 pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) =pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) & 1068 +dqmoist(1:ngrid,1:nlayermx,igcm_h2o_ice) 1069 pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)+dtmoist(1:ngrid,1:nlayermx) 1033 1070 1034 1071 !------------------------- … … 1036 1073 if(enertest)then 1037 1074 dEtot=cpp*SUM(massarea(:,:)*dtmoist(:,:))/totarea 1038 do ig = 1,ngrid1075 do ig=1,ngrid 1039 1076 madjdE(ig) = cpp*SUM(mass(:,:)*dtmoist(:,:)) 1040 1077 enddo … … 1055 1092 ! -------------------------------- 1056 1093 1057 call largescale( ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc)1058 1059 pdt(1:ngrid mx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)+dtlscale(1:ngridmx,1:nlayermx)1060 pdq(1:ngrid mx,1:nlayermx,igcm_h2o_vap) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap)+dqvaplscale(1:ngridmx,1:nlayermx)1061 pdq(1:ngrid mx,1:nlayermx,igcm_h2o_ice) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice)+dqcldlscale(1:ngridmx,1:nlayermx)1094 call largescale(ngrid,nq,ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc) 1095 1096 pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)+dtlscale(1:ngrid,1:nlayermx) 1097 pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) = pdq(1:ngrid,1:nlayermx,igcm_h2o_vap)+dqvaplscale(1:ngrid,1:nlayermx) 1098 pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) = pdq(1:ngrid,1:nlayermx,igcm_h2o_ice)+dqcldlscale(1:ngrid,1:nlayermx) 1062 1099 1063 1100 !------------------------- 1064 1101 ! test energy conservation 1065 1102 if(enertest)then 1066 do ig = 1,ngrid1103 do ig=1,ngrid 1067 1104 lscaledE(ig) = cpp*SUM(mass(:,:)*dtlscale(:,:)) 1068 1105 enddo … … 1083 1120 ! compute cloud fraction 1084 1121 do l = 1, nlayer 1085 do ig =1,ngrid1122 do ig=1,ngrid 1086 1123 cloudfrac(ig,l)=MAX(rneb_lsc(ig,l),rneb_man(ig,l)) 1087 1124 enddo … … 1096 1133 if(waterrain)then 1097 1134 1098 zdqrain(1:ngrid mx,1:nlayermx,1:nqmx) = 0.01099 zdqsrain(1:ngrid mx) = 0.01100 zdqssnow(1:ngrid mx) = 0.01101 1102 call rain( ptimestep,pplev,pplay,pt,pdt,pq,pdq, &1135 zdqrain(1:ngrid,1:nlayermx,1:nq) = 0.0 1136 zdqsrain(1:ngrid) = 0.0 1137 zdqssnow(1:ngrid) = 0.0 1138 1139 call rain(ngrid,nq,ptimestep,pplev,pplay,pt,pdt,pq,pdq, & 1103 1140 zdtrain,zdqrain,zdqsrain,zdqssnow,cloudfrac) 1104 1141 1105 pdq(1:ngrid mx,1:nlayermx,igcm_h2o_vap) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) &1106 +zdqrain(1:ngrid mx,1:nlayermx,igcm_h2o_vap)1107 pdq(1:ngrid mx,1:nlayermx,igcm_h2o_ice) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) &1108 +zdqrain(1:ngrid mx,1:nlayermx,igcm_h2o_ice)1109 pdt(1:ngrid mx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)+zdtrain(1:ngridmx,1:nlayermx)1110 dqsurf(1:ngrid mx,igcm_h2o_vap) = dqsurf(1:ngridmx,igcm_h2o_vap)+zdqsrain(1:ngridmx) ! a bug was here1111 dqsurf(1:ngrid mx,igcm_h2o_ice) = dqsurf(1:ngridmx,igcm_h2o_ice)+zdqssnow(1:ngridmx)1112 rainout(1:ngrid mx) = zdqsrain(1:ngridmx)+zdqssnow(1:ngridmx) ! diagnostic1142 pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) = pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) & 1143 +zdqrain(1:ngrid,1:nlayermx,igcm_h2o_vap) 1144 pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) = pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) & 1145 +zdqrain(1:ngrid,1:nlayermx,igcm_h2o_ice) 1146 pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)+zdtrain(1:ngrid,1:nlayermx) 1147 dqsurf(1:ngrid,igcm_h2o_vap) = dqsurf(1:ngrid,igcm_h2o_vap)+zdqsrain(1:ngrid) ! a bug was here 1148 dqsurf(1:ngrid,igcm_h2o_ice) = dqsurf(1:ngrid,igcm_h2o_ice)+zdqssnow(1:ngrid) 1149 rainout(1:ngrid) = zdqsrain(1:ngrid)+zdqssnow(1:ngrid) ! diagnostic 1113 1150 1114 1151 … … 1147 1184 ! ------------- 1148 1185 if (sedimentation) then 1149 zdqsed(1:ngrid mx,1:nlayermx,1:nqmx) = 0.01150 zdqssed(1:ngrid mx,1:nqmx) = 0.01186 zdqsed(1:ngrid,1:nlayermx,1:nq) = 0.0 1187 zdqssed(1:ngrid,1:nq) = 0.0 1151 1188 1152 1189 … … 1179 1216 ! and as in rain.F90, whether it falls as rain or snow depends 1180 1217 ! only on the surface temperature 1181 pdq(1:ngrid mx,1:nlayermx,1:nqmx) = pdq(1:ngridmx,1:nlayermx,1:nqmx) + zdqsed(1:ngridmx,1:nlayermx,1:nqmx)1182 dqsurf(1:ngrid mx,1:nqmx) = dqsurf(1:ngridmx,1:nqmx) + zdqssed(1:ngridmx,1:nqmx)1218 pdq(1:ngrid,1:nlayermx,1:nq) = pdq(1:ngrid,1:nlayermx,1:nq) + zdqsed(1:ngrid,1:nlayermx,1:nq) 1219 dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + zdqssed(1:ngrid,1:nq) 1183 1220 1184 1221 !------------------------- … … 1205 1242 if(mass_redistrib) then 1206 1243 1207 zdmassmr(1:ngrid mx,1:nlayermx) = mass(1:ngridmx,1:nlayermx) * &1208 ( zdqevap(1:ngrid mx,1:nlayermx) &1209 + zdqrain(1:ngrid mx,1:nlayermx,igcm_h2o_vap) &1210 + dqmoist(1:ngrid mx,1:nlayermx,igcm_h2o_vap) &1211 + dqvaplscale(1:ngrid mx,1:nlayermx) )1244 zdmassmr(1:ngrid,1:nlayermx) = mass(1:ngrid,1:nlayermx) * & 1245 ( zdqevap(1:ngrid,1:nlayermx) & 1246 + zdqrain(1:ngrid,1:nlayermx,igcm_h2o_vap) & 1247 + dqmoist(1:ngrid,1:nlayermx,igcm_h2o_vap) & 1248 + dqvaplscale(1:ngrid,1:nlayermx) ) 1212 1249 1213 1250 1214 call writediagfi(ngrid mx,"mass_evap","mass gain"," ",3,zdmassmr)1215 call writediagfi(ngrid mx,"mass","mass"," ",3,mass)1251 call writediagfi(ngrid,"mass_evap","mass gain"," ",3,zdmassmr) 1252 call writediagfi(ngrid,"mass","mass"," ",3,mass) 1216 1253 1217 1254 call mass_redistribution(ngrid,nlayer,nq,ptimestep, & … … 1221 1258 1222 1259 1223 pdq(1:ngrid mx,1:nlayermx,1:nqmx) = pdq(1:ngridmx,1:nlayermx,1:nqmx) + zdqmr(1:ngridmx,1:nlayermx,1:nqmx)1224 dqsurf(1:ngrid mx,1:nqmx) = dqsurf(1:ngridmx,1:nqmx) + zdqsurfmr(1:ngridmx,1:nqmx)1225 pdt(1:ngrid mx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx) + zdtmr(1:ngridmx,1:nlayermx)1226 pdu(1:ngrid mx,1:nlayermx) = pdu(1:ngridmx,1:nlayermx) + zdumr(1:ngridmx,1:nlayermx)1227 pdv(1:ngrid mx,1:nlayermx) = pdv(1:ngridmx,1:nlayermx) + zdvmr(1:ngridmx,1:nlayermx)1228 pdpsrf(1:ngrid mx) = pdpsrf(1:ngridmx) + zdpsrfmr(1:ngridmx)1229 zdtsurf(1:ngrid mx) = zdtsurf(1:ngridmx) + zdtsurfmr(1:ngridmx)1260 pdq(1:ngrid,1:nlayermx,1:nq) = pdq(1:ngrid,1:nlayermx,1:nq) + zdqmr(1:ngrid,1:nlayermx,1:nq) 1261 dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + zdqsurfmr(1:ngrid,1:nq) 1262 pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx) + zdtmr(1:ngrid,1:nlayermx) 1263 pdu(1:ngrid,1:nlayermx) = pdu(1:ngrid,1:nlayermx) + zdumr(1:ngrid,1:nlayermx) 1264 pdv(1:ngrid,1:nlayermx) = pdv(1:ngrid,1:nlayermx) + zdvmr(1:ngrid,1:nlayermx) 1265 pdpsrf(1:ngrid) = pdpsrf(1:ngrid) + zdpsrfmr(1:ngrid) 1266 zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurfmr(1:ngrid) 1230 1267 1231 1268 ! print*,'after mass redistrib, q=',pq(211,1:nlayermx,igcm_h2o_vap)+ptimestep*pdq(211,1:nlayermx,igcm_h2o_vap) … … 1240 1277 if(hydrology)then 1241 1278 1242 call hydrol( ptimestep,rnat,tsurf,qsurf,dqsurf,dqs_hyd, &1279 call hydrol(ngrid,nq,ptimestep,rnat,tsurf,qsurf,dqsurf,dqs_hyd, & 1243 1280 capcal,albedo0,albedo,mu0,zdtsurf,zdtsurf_hyd,hice) 1244 1281 ! note: for now, also changes albedo in the subroutine 1245 1282 1246 zdtsurf(1:ngrid mx) = zdtsurf(1:ngridmx) + zdtsurf_hyd(1:ngridmx)1247 qsurf(1:ngrid mx,1:nqmx) = qsurf(1:ngridmx,1:nqmx) + ptimestep*dqs_hyd(1:ngridmx,1:nqmx)1283 zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurf_hyd(1:ngrid) 1284 qsurf(1:ngrid,1:nq) = qsurf(1:ngrid,1:nq) + ptimestep*dqs_hyd(1:ngrid,1:nq) 1248 1285 ! when hydrology is used, other dqsurf tendencies are all added to dqs_hyd inside 1249 1286 … … 1269 1306 ELSE ! of if (hydrology) 1270 1307 1271 qsurf(1:ngrid mx,1:nqmx)=qsurf(1:ngridmx,1:nqmx)+ptimestep*dqsurf(1:ngridmx,1:nqmx)1308 qsurf(1:ngrid,1:nq)=qsurf(1:ngrid,1:nq)+ptimestep*dqsurf(1:ngrid,1:nq) 1272 1309 1273 1310 END IF ! of if (hydrology) … … 1280 1317 1281 1318 if(ice_update)then 1282 ice_min(1:ngrid mx)=min(ice_min(1:ngridmx),qsurf(1:ngridmx,igcm_h2o_ice))1319 ice_min(1:ngrid)=min(ice_min(1:ngrid),qsurf(1:ngrid,igcm_h2o_ice)) 1283 1320 endif 1284 1321 … … 1291 1328 1292 1329 ! Increment surface temperature 1293 tsurf(1:ngrid mx)=tsurf(1:ngridmx)+ptimestep*zdtsurf(1:ngridmx)1330 tsurf(1:ngrid)=tsurf(1:ngrid)+ptimestep*zdtsurf(1:ngrid) 1294 1331 1295 1332 ! Compute soil temperatures and subsurface heat flux 1296 1333 if (callsoil) then 1297 call soil(ngrid,nsoilmx,.false., inertiedat,&1334 call soil(ngrid,nsoilmx,.false.,lastcall,inertiedat, & 1298 1335 ptimestep,tsurf,tsoil,capcal,fluxgrd) 1299 1336 endif … … 1317 1354 1318 1355 ! temperature, zonal and meridional wind 1319 zt(1:ngrid mx,1:nlayermx) = pt(1:ngridmx,1:nlayermx) + pdt(1:ngridmx,1:nlayermx)*ptimestep1320 zu(1:ngrid mx,1:nlayermx) = pu(1:ngridmx,1:nlayermx) + pdu(1:ngridmx,1:nlayermx)*ptimestep1321 zv(1:ngrid mx,1:nlayermx) = pv(1:ngridmx,1:nlayermx) + pdv(1:ngridmx,1:nlayermx)*ptimestep1356 zt(1:ngrid,1:nlayermx) = pt(1:ngrid,1:nlayermx) + pdt(1:ngrid,1:nlayermx)*ptimestep 1357 zu(1:ngrid,1:nlayermx) = pu(1:ngrid,1:nlayermx) + pdu(1:ngrid,1:nlayermx)*ptimestep 1358 zv(1:ngrid,1:nlayermx) = pv(1:ngrid,1:nlayermx) + pdv(1:ngrid,1:nlayermx)*ptimestep 1322 1359 1323 1360 ! diagnostic 1324 zdtdyn(1:ngrid mx,1:nlayermx) = pt(1:ngridmx,1:nlayermx)-ztprevious(1:ngridmx,1:nlayermx)1325 ztprevious(1:ngrid mx,1:nlayermx) = zt(1:ngridmx,1:nlayermx)1361 zdtdyn(1:ngrid,1:nlayermx) = pt(1:ngrid,1:nlayermx)-ztprevious(1:ngrid,1:nlayermx) 1362 ztprevious(1:ngrid,1:nlayermx) = zt(1:ngrid,1:nlayermx) 1326 1363 1327 1364 if(firstcall)then 1328 zdtdyn(1:ngrid mx,1:nlayermx)=0.01365 zdtdyn(1:ngrid,1:nlayermx)=0.0 1329 1366 endif 1330 1367 … … 1335 1372 1336 1373 ! tracers 1337 zq(1:ngrid mx,1:nlayermx,1:nqmx) = pq(1:ngridmx,1:nlayermx,1:nqmx) + pdq(1:ngridmx,1:nlayermx,1:nqmx)*ptimestep1374 zq(1:ngrid,1:nlayermx,1:nq) = pq(1:ngrid,1:nlayermx,1:nq) + pdq(1:ngrid,1:nlayermx,1:nq)*ptimestep 1338 1375 1339 1376 ! surface pressure 1340 ps(1:ngrid mx) = pplev(1:ngridmx,1) + pdpsrf(1:ngridmx)*ptimestep1377 ps(1:ngrid) = pplev(1:ngrid,1) + pdpsrf(1:ngrid)*ptimestep 1341 1378 1342 1379 ! pressure 1343 1380 do l=1,nlayer 1344 zplev(1:ngrid mx,l) = pplev(1:ngridmx,l)/pplev(1:ngridmx,1)*ps(:)1345 zplay(1:ngrid mx,l) = pplay(1:ngridmx,l)/pplev(1:ngridmx,1)*ps(1:ngridmx)1381 zplev(1:ngrid,l) = pplev(1:ngrid,l)/pplev(1:ngrid,1)*ps(:) 1382 zplay(1:ngrid,l) = pplay(1:ngrid,l)/pplev(1:ngrid,1)*ps(1:ngrid) 1346 1383 enddo 1347 1384 … … 1373 1410 GND = SUM(area(:)*fluxgrd(:))/totarea 1374 1411 DYN = SUM(area(:)*fluxdyn(:))/totarea 1375 do ig=1,ngrid 1412 do ig=1,ngrid 1376 1413 if(fluxtop_dn(ig).lt.0.0)then 1377 1414 print*,'fluxtop_dn has gone crazy' … … 1385 1422 end do 1386 1423 1387 if(ngrid mx.eq.1)then1424 if(ngrid.eq.1)then 1388 1425 DYN=0.0 1389 1426 endif … … 1399 1436 1400 1437 if(meanOLR)then 1401 if((ngrid mx.gt.1) .or. (mod(icount-1,nint(ecritphy)).eq.0))then1438 if((ngrid.gt.1) .or. (mod(icount-1,nint(ecritphy)).eq.0))then 1402 1439 ! to record global radiative balance 1403 1440 open(92,file="rad_bal.out",form='formatted',position='append') … … 1432 1469 ! --------------------------------------------------------- 1433 1470 if(tracer)then 1434 qcol(1:ngrid mx,1:nqmx)=0.01471 qcol(1:ngrid,1:nq)=0.0 1435 1472 do iq=1,nq 1436 do ig=1,ngrid mx1473 do ig=1,ngrid 1437 1474 qcol(ig,iq) = SUM( zq(ig,1:nlayermx,iq) * mass(ig,1:nlayermx)) 1438 1475 enddo … … 1440 1477 1441 1478 ! Generalised for arbitrary aerosols now. (LK) 1442 reffcol(1:ngrid mx,1:naerkind)=0.01479 reffcol(1:ngrid,1:naerkind)=0.0 1443 1480 if(co2cond.and.(iaero_co2.ne.0))then 1444 call co2_reffrad( zq,reffrad)1445 do ig=1,ngrid mx1481 call co2_reffrad(ngrid,nq,zq,reffrad) 1482 do ig=1,ngrid 1446 1483 reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayermx,igcm_co2_ice)*reffrad(ig,1:nlayermx,iaero_co2)*mass(ig,1:nlayermx)) 1447 1484 enddo 1448 1485 endif 1449 1486 if(water.and.(iaero_h2o.ne.0))then 1450 call h2o_reffrad(zq,zt,reffrad,nueffrad) 1451 do ig=1,ngridmx 1487 1488 !! AS: This modifies reffrad and nueffrad 1489 !! ... and those are saved in physiq 1490 !! To be conservative with previous versions, 1491 !! ... I put nueffrad_dummy so that nueffrad 1492 !! ... is not modified, but shouldn't it be modified actually? 1493 call h2o_reffrad(ngrid,nq,zq,zt,reffrad,nueffrad_dummy) 1494 do ig=1,ngrid 1452 1495 reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayermx,igcm_h2o_ice)*reffrad(ig,1:nlayermx,iaero_h2o)*mass(ig,1:nlayermx)) 1453 1496 enddo … … 1474 1517 1475 1518 if(meanOLR)then 1476 if((ngrid mx.gt.1) .or. (mod(icount-1,nint(ecritphy)).eq.0))then1519 if((ngrid.gt.1) .or. (mod(icount-1,nint(ecritphy)).eq.0))then 1477 1520 ! to record global water balance 1478 1521 open(98,file="h2o_bal.out",form='formatted',position='append') … … 1490 1533 if(water)then 1491 1534 do l = 1, nlayer 1492 do ig = 1,ngrid1535 do ig=1,ngrid 1493 1536 ! call watersat(pt(ig,l),pplay(ig,l),qsat(ig,l)) 1494 1537 call Psat_water(zt(ig,l),pplay(ig,l),psat_tmp,qsat(ig,l)) … … 1524 1567 if(ice_update)then 1525 1568 1526 do ig = 1,ngrid1569 do ig=1,ngrid 1527 1570 1528 1571 delta_ice = (qsurf(ig,igcm_h2o_ice)-ice_initial(ig)) … … 1550 1593 1551 1594 write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin 1552 call physdem1( "restartfi.nc",long,lati,nsoilmx,nq, &1595 call physdem1(ngrid,"restartfi.nc",long,lati,nsoilmx,nq, & 1553 1596 ptimestep,pday,ztime_fin,tsurf,tsoil,emis,q2,qsurf_hist, & 1554 1597 area,albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe, & 1555 cloudfrac,totcloudfrac,hice )1598 cloudfrac,totcloudfrac,hice,noms) 1556 1599 endif 1557 1600 … … 1594 1637 do iq=1,nq 1595 1638 call wstats(ngrid,noms(iq),noms(iq),'kg/kg',3,zq(1,1,iq)) 1596 call wstats(ngrid mx,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', &1639 call wstats(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', & 1597 1640 'kg m^-2',2,qsurf(1,iq) ) 1598 1641 1599 call wstats(ngrid mx,trim(noms(iq))//'_col',trim(noms(iq))//'_col', &1642 call wstats(ngrid,trim(noms(iq))//'_col',trim(noms(iq))//'_col', & 1600 1643 'kg m^-2',2,qcol(1,iq) ) 1601 ! call wstats(ngrid mx,trim(noms(iq))//'_reff', &1644 ! call wstats(ngrid,trim(noms(iq))//'_reff', & 1602 1645 ! trim(noms(iq))//'_reff', & 1603 1646 ! 'm',3,reffrad(1,1,iq)) 1604 1647 end do 1605 1648 if (water) then 1606 vmr=zq(1:ngrid mx,1:nlayermx,igcm_h2o_vap)*mugaz/mmol(igcm_h2o_vap)1649 vmr=zq(1:ngrid,1:nlayermx,igcm_h2o_vap)*mugaz/mmol(igcm_h2o_vap) 1607 1650 call wstats(ngrid,"vmr_h2ovapor", & 1608 1651 "H2O vapour volume mixing ratio","mol/mol", & … … 1647 1690 if(enertest) then 1648 1691 if (calldifv) then 1649 call writediagfi(ngrid mx,"q2","turbulent kinetic energy","J.kg^-1",3,q2)1650 ! call writediagfi(ngrid mx,"dEzdiff","turbulent diffusion heating (-sensible flux)","w.m^-2",3,dEzdiff)1651 ! call writediagfi(ngrid mx,"dEdiff","integrated turbulent diffusion heating (-sensible flux)","w.m^-2",2,dEdiff)1652 ! call writediagfi(ngrid mx,"dEdiffs","In TurbDiff (correc rad+latent heat) surf nrj change","w.m^-2",2,dEdiffs)1653 call writediagfi(ngrid mx,"sensibFlux","sensible heat flux","w.m^-2",2,sensibFlux)1692 call writediagfi(ngrid,"q2","turbulent kinetic energy","J.kg^-1",3,q2) 1693 ! call writediagfi(ngrid,"dEzdiff","turbulent diffusion heating (-sensible flux)","w.m^-2",3,dEzdiff) 1694 ! call writediagfi(ngrid,"dEdiff","integrated turbulent diffusion heating (-sensible flux)","w.m^-2",2,dEdiff) 1695 ! call writediagfi(ngrid,"dEdiffs","In TurbDiff (correc rad+latent heat) surf nrj change","w.m^-2",2,dEdiffs) 1696 call writediagfi(ngrid,"sensibFlux","sensible heat flux","w.m^-2",2,sensibFlux) 1654 1697 endif 1655 1698 if (corrk) then 1656 ! call writediagfi(ngrid mx,"dEzradsw","radiative heating","w.m^-2",3,dEzradsw)1657 ! call writediagfi(ngrid mx,"dEzradlw","radiative heating","w.m^-2",3,dEzradlw)1699 ! call writediagfi(ngrid,"dEzradsw","radiative heating","w.m^-2",3,dEzradsw) 1700 ! call writediagfi(ngrid,"dEzradlw","radiative heating","w.m^-2",3,dEzradlw) 1658 1701 endif 1659 1702 if(watercond) then 1660 1703 call writediagfi(ngrid,"lscaledE","heat from largescale","W m-2",2,lscaledE) 1661 1704 call writediagfi(ngrid,"madjdE","heat from moistadj","W m-2",2,madjdE) 1662 call writediagfi(ngrid mx,"RH","relative humidity"," ",3,RH)1663 ! call writediagfi(ngrid mx,"qsatatm","atm qsat"," ",3,qsat)1664 ! call writediagfi(ngrid mx,"h2o_max_col","maximum H2O column amount","kg.m^-2",2,H2Omaxcol)1705 call writediagfi(ngrid,"RH","relative humidity"," ",3,RH) 1706 ! call writediagfi(ngrid,"qsatatm","atm qsat"," ",3,qsat) 1707 ! call writediagfi(ngrid,"h2o_max_col","maximum H2O column amount","kg.m^-2",2,H2Omaxcol) 1665 1708 endif 1666 1709 endif … … 1678 1721 ! Output aerosols 1679 1722 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & 1680 call writediagfi(ngrid mx,'CO2ice_reff','CO2ice_reff','m',3,reffrad(1,1,iaero_co2))1723 call writediagfi(ngrid,'CO2ice_reff','CO2ice_reff','m',3,reffrad(1,1,iaero_co2)) 1681 1724 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & 1682 call writediagfi(ngrid mx,'H2Oice_reff','H2Oice_reff','m',3,reffrad(:,:,iaero_h2o))1725 call writediagfi(ngrid,'H2Oice_reff','H2Oice_reff','m',3,reffrad(:,:,iaero_h2o)) 1683 1726 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & 1684 call writediagfi(ngrid mx,'CO2ice_reffcol','CO2ice_reffcol','um kg m^-2',2,reffcol(1,iaero_co2))1727 call writediagfi(ngrid,'CO2ice_reffcol','CO2ice_reffcol','um kg m^-2',2,reffcol(1,iaero_co2)) 1685 1728 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & 1686 call writediagfi(ngrid mx,'H2Oice_reffcol','H2Oice_reffcol','um kg m^-2',2,reffcol(1,iaero_h2o))1729 call writediagfi(ngrid,'H2Oice_reffcol','H2Oice_reffcol','um kg m^-2',2,reffcol(1,iaero_h2o)) 1687 1730 1688 1731 ! Output tracers … … 1690 1733 do iq=1,nq 1691 1734 call writediagfi(ngrid,noms(iq),noms(iq),'kg/kg',3,zq(1,1,iq)) 1692 ! call writediagfi(ngrid mx,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', &1735 ! call writediagfi(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', & 1693 1736 ! 'kg m^-2',2,qsurf(1,iq) ) 1694 call writediagfi(ngrid mx,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', &1737 call writediagfi(ngrid,trim(noms(iq))//'_surf',trim(noms(iq))//'_surf', & 1695 1738 'kg m^-2',2,qsurf_hist(1,iq) ) 1696 call writediagfi(ngrid mx,trim(noms(iq))//'_col',trim(noms(iq))//'_col', &1739 call writediagfi(ngrid,trim(noms(iq))//'_col',trim(noms(iq))//'_col', & 1697 1740 'kg m^-2',2,qcol(1,iq) ) 1698 1741 … … 1705 1748 1706 1749 if(waterrain)then 1707 call writediagfi(ngrid mx,"rain","rainfall","kg m-2 s-1",2,zdqsrain)1708 call writediagfi(ngrid mx,"snow","snowfall","kg m-2 s-1",2,zdqssnow)1750 call writediagfi(ngrid,"rain","rainfall","kg m-2 s-1",2,zdqsrain) 1751 call writediagfi(ngrid,"snow","snowfall","kg m-2 s-1",2,zdqssnow) 1709 1752 endif 1710 1753 1711 1754 if(hydrology)then 1712 call writediagfi(ngrid mx,"hice","oceanic ice height","m",2,hice)1755 call writediagfi(ngrid,"hice","oceanic ice height","m",2,hice) 1713 1756 endif 1714 1757 1715 1758 if(ice_update)then 1716 call writediagfi(ngrid mx,"ice_min","min annual ice","m",2,ice_min)1717 call writediagfi(ngrid mx,"ice_ini","initial annual ice","m",2,ice_initial)1759 call writediagfi(ngrid,"ice_min","min annual ice","m",2,ice_min) 1760 call writediagfi(ngrid,"ice_ini","initial annual ice","m",2,ice_initial) 1718 1761 endif 1719 1762 … … 1725 1768 end do 1726 1769 1727 call writediagfi(ngrid mx,"tau_col","Total aerosol optical depth","[]",2,tau_col)1770 call writediagfi(ngrid,"tau_col","Total aerosol optical depth","[]",2,tau_col) 1728 1771 1729 1772 enddo … … 1739 1782 icount=icount+1 1740 1783 1741 ! deallocate gas variables1742 1784 if (lastcall) then 1785 1786 ! deallocate gas variables 1743 1787 IF ( ALLOCATED( gnom ) ) DEALLOCATE( gnom ) 1744 1788 IF ( ALLOCATED( gfrac ) ) DEALLOCATE( gfrac ) ! both allocated in su_gases.F90 1789 1790 ! deallocate saved arrays 1791 ! this is probably not that necessary 1792 ! ... but probably a good idea to clean the place before we leave 1793 IF ( ALLOCATED(tsurf)) DEALLOCATE(tsurf) 1794 IF ( ALLOCATED(tsoil)) DEALLOCATE(tsoil) 1795 IF ( ALLOCATED(albedo)) DEALLOCATE(albedo) 1796 IF ( ALLOCATED(albedo0)) DEALLOCATE(albedo0) 1797 IF ( ALLOCATED(rnat)) DEALLOCATE(rnat) 1798 IF ( ALLOCATED(emis)) DEALLOCATE(emis) 1799 IF ( ALLOCATED(dtrad)) DEALLOCATE(dtrad) 1800 IF ( ALLOCATED(fluxrad_sky)) DEALLOCATE(fluxrad_sky) 1801 IF ( ALLOCATED(fluxrad)) DEALLOCATE(fluxrad) 1802 IF ( ALLOCATED(capcal)) DEALLOCATE(capcal) 1803 IF ( ALLOCATED(fluxgrd)) DEALLOCATE(fluxgrd) 1804 IF ( ALLOCATED(qsurf)) DEALLOCATE(qsurf) 1805 IF ( ALLOCATED(q2)) DEALLOCATE(q2) 1806 IF ( ALLOCATED(ztprevious)) DEALLOCATE(ztprevious) 1807 IF ( ALLOCATED(cloudfrac)) DEALLOCATE(cloudfrac) 1808 IF ( ALLOCATED(totcloudfrac)) DEALLOCATE(totcloudfrac) 1809 IF ( ALLOCATED(qsurf_hist)) DEALLOCATE(qsurf_hist) 1810 IF ( ALLOCATED(reffrad)) DEALLOCATE(reffrad) 1811 IF ( ALLOCATED(nueffrad)) DEALLOCATE(nueffrad) 1812 IF ( ALLOCATED(ice_initial)) DEALLOCATE(ice_initial) 1813 IF ( ALLOCATED(ice_min)) DEALLOCATE(ice_min) 1814 1815 IF ( ALLOCATED(fluxsurf_lw)) DEALLOCATE(fluxsurf_lw) 1816 IF ( ALLOCATED(fluxsurf_sw)) DEALLOCATE(fluxsurf_sw) 1817 IF ( ALLOCATED(fluxtop_lw)) DEALLOCATE(fluxtop_lw) 1818 IF ( ALLOCATED(fluxabs_sw)) DEALLOCATE(fluxabs_sw) 1819 IF ( ALLOCATED(fluxtop_dn)) DEALLOCATE(fluxtop_dn) 1820 IF ( ALLOCATED(fluxdyn)) DEALLOCATE(fluxdyn) 1821 IF ( ALLOCATED(OLR_nu)) DEALLOCATE(OLR_nu) 1822 IF ( ALLOCATED(OSR_nu)) DEALLOCATE(OSR_nu) 1823 IF ( ALLOCATED(sensibFlux)) DEALLOCATE(sensibFlux) 1824 IF ( ALLOCATED(zdtlw)) DEALLOCATE(zdtlw) 1825 IF ( ALLOCATED(zdtsw)) DEALLOCATE(zdtsw) 1826 IF ( ALLOCATED(tau_col)) DEALLOCATE(tau_col) 1827 1828 !! this is defined in comsaison_h 1829 IF ( ALLOCATED(mu0)) DEALLOCATE(mu0) 1830 IF ( ALLOCATED(fract)) DEALLOCATE(fract) 1831 1832 !! this is defined in comsoil_h 1833 IF ( ALLOCATED(layer)) DEALLOCATE(layer) 1834 IF ( ALLOCATED(mlayer)) DEALLOCATE(mlayer) 1835 IF ( ALLOCATED(inertiedat)) DEALLOCATE(inertiedat) 1836 1837 !! this is defined in surfdat_h 1838 IF ( ALLOCATED(albedodat)) DEALLOCATE(albedodat) 1839 IF ( ALLOCATED(phisfi)) DEALLOCATE(phisfi) 1840 IF ( ALLOCATED(zmea)) DEALLOCATE(zmea) 1841 IF ( ALLOCATED(zstd)) DEALLOCATE(zstd) 1842 IF ( ALLOCATED(zsig)) DEALLOCATE(zsig) 1843 IF ( ALLOCATED(zgam)) DEALLOCATE(zgam) 1844 IF ( ALLOCATED(zthe)) DEALLOCATE(zthe) 1845 IF ( ALLOCATED(dryness)) DEALLOCATE(dryness) 1846 IF ( ALLOCATED(watercaptag)) DEALLOCATE(watercaptag) 1847 1848 !! this is defined in tracer_h 1849 IF ( ALLOCATED(noms)) DEALLOCATE(noms) 1850 IF ( ALLOCATED(mmol)) DEALLOCATE(mmol) 1851 IF ( ALLOCATED(radius)) DEALLOCATE(radius) 1852 IF ( ALLOCATED(rho_q)) DEALLOCATE(rho_q) 1853 IF ( ALLOCATED(qext)) DEALLOCATE(qext) 1854 IF ( ALLOCATED(alpha_lift)) DEALLOCATE(alpha_lift) 1855 IF ( ALLOCATED(alpha_devil)) DEALLOCATE(alpha_devil) 1856 IF ( ALLOCATED(qextrhor)) DEALLOCATE(qextrhor) 1857 IF ( ALLOCATED(igcm_dustbin)) DEALLOCATE(igcm_dustbin) 1858 1859 !! this is defined in comgeomfi_h 1860 IF ( ALLOCATED(lati)) DEALLOCATE(lati) 1861 IF ( ALLOCATED(long)) DEALLOCATE(long) 1862 IF ( ALLOCATED(area)) DEALLOCATE(area) 1863 IF ( ALLOCATED(sinlat)) DEALLOCATE(sinlat) 1864 IF ( ALLOCATED(coslat)) DEALLOCATE(coslat) 1865 IF ( ALLOCATED(sinlon)) DEALLOCATE(sinlon) 1866 IF ( ALLOCATED(coslon)) DEALLOCATE(coslon) 1867 1745 1868 endif 1746 1747 1869 1748 1870 return -
trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90
r728 r787 20 20 21 21 !================================================================== 22 subroutine su_aer_radii( reffrad,nueffrad)22 subroutine su_aer_radii(ngrid,reffrad,nueffrad) 23 23 !================================================================== 24 24 ! Purpose … … 35 35 use radinc_h, only: naerkind 36 36 use aerosol_mod 37 Implicit none 38 39 #include "callkeys.h" 40 #include "dimensions.h" 41 #include "dimphys.h" 42 #include "tracer.h" 43 44 real, intent(inout) :: reffrad(ngridmx,nlayermx,naerkind) !aerosols radii (K) 45 real, intent(inout) :: nueffrad(ngridmx,nlayermx,naerkind) !variance 37 USE tracer_h 38 Implicit none 39 40 #include "callkeys.h" 41 #include "dimensions.h" 42 #include "dimphys.h" 43 44 integer :: ngrid 45 46 real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind) !aerosols radii (K) 47 real, intent(inout) :: nueffrad(ngrid,nlayermx,naerkind) !variance 46 48 47 49 logical, save :: firstcall=.true. … … 56 58 57 59 if(iaer.eq.iaero_co2)then ! CO2 ice 58 reffrad(1:ngrid mx,1:nlayermx,iaer) = 1.e-459 nueffrad(1:ngrid mx,1:nlayermx,iaer) = 0.160 reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-4 61 nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1 60 62 endif 61 63 62 64 if(iaer.eq.iaero_h2o)then ! H2O ice 63 reffrad(1:ngrid mx,1:nlayermx,iaer) = 1.e-564 nueffrad(1:ngrid mx,1:nlayermx,iaer) = 0.165 reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-5 66 nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1 65 67 endif 66 68 67 69 if(iaer.eq.iaero_dust)then ! dust 68 reffrad(1:ngrid mx,1:nlayermx,iaer) = 1.e-569 nueffrad(1:ngrid mx,1:nlayermx,iaer) = 0.170 reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-5 71 nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1 70 72 endif 71 73 72 74 if(iaer.eq.iaero_h2so4)then ! H2O ice 73 reffrad(1:ngrid mx,1:nlayermx,iaer) = 1.e-674 nueffrad(1:ngrid mx,1:nlayermx,iaer) = 0.175 reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-6 76 nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1 75 77 endif 76 78 … … 117 119 118 120 !================================================================== 119 subroutine h2o_reffrad( pq,pt,reffrad,nueffrad)121 subroutine h2o_reffrad(ngrid,nq,pq,pt,reffrad,nueffrad) 120 122 !================================================================== 121 123 ! Purpose … … 131 133 use watercommon_h, Only: T_h2O_ice_liq,T_h2O_ice_clouds,rhowater,rhowaterice 132 134 use aerosol_mod, only : iaero_h2o 133 Implicit none134 135 #include "callkeys.h" 136 #include " dimensions.h"137 #include "dim phys.h"138 #include " tracer.h"135 USE tracer_h 136 Implicit none 137 138 #include "callkeys.h" 139 #include "dimensions.h" 140 #include "dimphys.h" 139 141 #include "comcstfi.h" 140 142 141 real, intent(in) :: pq(ngridmx,nlayermx,nqmx) !tracer mixing ratios (kg/kg) 142 real, intent(in) :: pt(ngridmx,nlayermx) !temperature (K) 143 real, intent(inout) :: reffrad(ngridmx,nlayermx,naerkind) !aerosols radii (K) 144 real, intent(inout) :: nueffrad(ngridmx,nlayermx,naerkind) ! dispersion 143 integer :: ngrid,nq 144 145 real, intent(in) :: pq(ngrid,nlayermx,nq) !tracer mixing ratios (kg/kg) 146 real, intent(in) :: pt(ngrid,nlayermx) !temperature (K) 147 real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind) !aerosols radii (K) 148 real, intent(inout) :: nueffrad(ngrid,nlayermx,naerkind) ! dispersion 145 149 146 150 integer :: ig,l … … 151 155 if (radfixed) then 152 156 do l=1,nlayermx 153 do ig=1,ngrid mx157 do ig=1,ngrid 154 158 zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds) 155 159 zfice = MIN(MAX(zfice,0.0),1.0) … … 160 164 else 161 165 do l=1,nlayermx 162 do ig=1,ngrid mx166 do ig=1,ngrid 163 167 zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds) 164 168 zfice = MIN(MAX(zfice,0.0),1.0) … … 177 181 178 182 !================================================================== 179 subroutine h2o_cloudrad( pql,reffliq,reffice)183 subroutine h2o_cloudrad(ngrid,pql,reffliq,reffice) 180 184 !================================================================== 181 185 ! Purpose … … 189 193 !================================================================== 190 194 use watercommon_h, Only: rhowater,rhowaterice 191 Implicit none192 193 #include "callkeys.h" 194 #include " dimensions.h"195 #include "dim phys.h"196 #include " tracer.h"195 USE tracer_h 196 Implicit none 197 198 #include "callkeys.h" 199 #include "dimensions.h" 200 #include "dimphys.h" 197 201 #include "comcstfi.h" 198 202 199 real, intent(in) :: pql(ngridmx,nlayermx) !condensed water mixing ratios (kg/kg) 200 real, intent(out) :: reffliq(ngridmx,nlayermx),reffice(ngridmx,nlayermx) !liquid and ice water particle radii (K) 203 integer :: ngrid 204 205 real, intent(in) :: pql(ngrid,nlayermx) !condensed water mixing ratios (kg/kg) 206 real, intent(out) :: reffliq(ngrid,nlayermx),reffice(ngrid,nlayermx) !liquid and ice water particle radii (K) 201 207 202 208 real,external :: CBRT … … 204 210 205 211 if (radfixed) then 206 reffliq(1:ngrid mx,1:nlayermx)= rad_h2o207 reffice(1:ngrid mx,1:nlayermx)= rad_h2o_ice212 reffliq(1:ngrid,1:nlayermx)= rad_h2o 213 reffice(1:ngrid,1:nlayermx)= rad_h2o_ice 208 214 else 209 reffliq(1:ngrid mx,1:nlayermx) = CBRT( 3*pql(1:ngridmx,1:nlayermx)/(4*Nmix_h2o*pi*rhowater) )210 reffliq(1:ngrid mx,1:nlayermx) = min(max(reffliq(1:ngridmx,1:nlayermx),1.e-6),100.e-6)211 reffice(1:ngrid mx,1:nlayermx) = CBRT( 3*pql(1:ngridmx,1:nlayermx)/(4*Nmix_h2o_ice*pi*rhowaterice) )212 reffice(1:ngrid mx,1:nlayermx) = min(max(reffice(1:ngridmx,1:nlayermx),1.e-6),100.e-6)215 reffliq(1:ngrid,1:nlayermx) = CBRT( 3*pql(1:ngrid,1:nlayermx)/(4*Nmix_h2o*pi*rhowater) ) 216 reffliq(1:ngrid,1:nlayermx) = min(max(reffliq(1:ngrid,1:nlayermx),1.e-6),100.e-6) 217 reffice(1:ngrid,1:nlayermx) = CBRT( 3*pql(1:ngrid,1:nlayermx)/(4*Nmix_h2o_ice*pi*rhowaterice) ) 218 reffice(1:ngrid,1:nlayermx) = min(max(reffice(1:ngrid,1:nlayermx),1.e-6),100.e-6) 213 219 end if 214 220 … … 219 225 220 226 !================================================================== 221 subroutine co2_reffrad( pq,reffrad)227 subroutine co2_reffrad(ngrid,nq,pq,reffrad) 222 228 !================================================================== 223 229 ! Purpose … … 232 238 use radinc_h, only: naerkind 233 239 use aerosol_mod, only : iaero_co2 234 Implicit none235 236 #include "callkeys.h" 237 #include " dimensions.h"238 #include "dim phys.h"239 #include " tracer.h"240 USE tracer_h 241 Implicit none 242 243 #include "callkeys.h" 244 #include "dimensions.h" 245 #include "dimphys.h" 240 246 #include "comcstfi.h" 241 247 242 real, intent(in) :: pq(ngridmx,nlayermx,nqmx) !tracer mixing ratios (kg/kg) 243 real, intent(inout) :: reffrad(ngridmx,nlayermx,naerkind) !aerosols radii (K) 248 integer :: ngrid,nq 249 250 real, intent(in) :: pq(ngrid,nlayermx,nq) !tracer mixing ratios (kg/kg) 251 real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind) !aerosols radii (K) 244 252 245 253 integer :: ig,l … … 250 258 251 259 if (radfixed) then 252 reffrad(1:ngrid mx,1:nlayermx,iaero_co2) = 5.e-5 ! CO2 ice260 reffrad(1:ngrid,1:nlayermx,iaero_co2) = 5.e-5 ! CO2 ice 253 261 else 254 262 do l=1,nlayermx 255 do ig=1,ngrid mx263 do ig=1,ngrid 256 264 zrad = CBRT( 3*pq(ig,l,igcm_co2_ice)/(4*Nmix_co2*pi*rho_co2) ) 257 265 reffrad(ig,l,iaero_co2) = min(max(zrad,1.e-6),100.e-6) … … 266 274 267 275 !================================================================== 268 subroutine dust_reffrad( reffrad)276 subroutine dust_reffrad(ngrid,reffrad) 269 277 !================================================================== 270 278 ! Purpose … … 285 293 #include "dimphys.h" 286 294 287 real, intent(inout) :: reffrad(ngridmx,nlayermx,naerkind) !aerosols radii (K) 295 integer :: ngrid 296 297 real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind) !aerosols radii (K) 288 298 289 reffrad(1:ngrid mx,1:nlayermx,iaero_dust) = 2.e-6 ! dust299 reffrad(1:ngrid,1:nlayermx,iaero_dust) = 2.e-6 ! dust 290 300 291 301 end subroutine dust_reffrad … … 294 304 295 305 !================================================================== 296 subroutine h2so4_reffrad( reffrad)306 subroutine h2so4_reffrad(ngrid,reffrad) 297 307 !================================================================== 298 308 ! Purpose … … 313 323 #include "dimphys.h" 314 324 315 real, intent(inout) :: reffrad(ngridmx,nlayermx,naerkind) !aerosols radii (K) 325 integer :: ngrid 326 327 real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind) !aerosols radii (K) 316 328 317 reffrad(1:ngrid mx,1:nlayermx,iaero_h2so4) = 1.e-6 ! h2so4329 reffrad(1:ngrid,1:nlayermx,iaero_h2so4) = 1.e-6 ! h2so4 318 330 319 331 end subroutine h2so4_reffrad -
trunk/LMDZ.GENERIC/libf/phystd/rain.F90
r731 r787 1 subroutine rain( ptimestep,pplev,pplay,t,pdt,pq,pdq,d_t,dqrain,dqsrain,dqssnow,rneb)1 subroutine rain(ngrid,nq,ptimestep,pplev,pplay,t,pdt,pq,pdq,d_t,dqrain,dqsrain,dqssnow,rneb) 2 2 3 3 … … 6 6 use watercommon_h, only: T_h2O_ice_liq,T_h2O_ice_clouds, RLVTT, RCPD, RCPV, RV, RVTMP2,Psat_water,Tsat_water,rhowater 7 7 use radii_mod, only: h2o_cloudrad 8 USE tracer_h 8 9 implicit none 9 10 … … 24 25 #include "dimensions.h" 25 26 #include "dimphys.h" 26 #include "tracer.h"27 27 #include "comcstfi.h" 28 28 #include "callkeys.h" 29 29 30 integer ngrid,nq 31 30 32 ! Pre-arguments (for universal model) 31 real pq(ngrid mx,nlayermx,nqmx) ! tracer (kg/kg)32 real qsurf(ngrid mx,nqmx) ! tracer at the surface (kg.m-2)33 REAL pdt(ngrid mx,nlayermx),pdq(ngridmx,nlayermx,nqmx)34 35 real dqrain(ngrid mx,nlayermx,nqmx) ! tendency of H2O precipitation (kg/kg.s-1)36 real dqsrain(ngrid mx) ! rain flux at the surface (kg.m-2.s-1)37 real dqssnow(ngrid mx) ! snow flux at the surface (kg.m-2.s-1)38 REAL d_t(ngrid mx,nlayermx) ! temperature increment33 real pq(ngrid,nlayermx,nq) ! tracer (kg/kg) 34 real qsurf(ngrid,nq) ! tracer at the surface (kg.m-2) 35 REAL pdt(ngrid,nlayermx),pdq(ngrid,nlayermx,nq) 36 37 real dqrain(ngrid,nlayermx,nq) ! tendency of H2O precipitation (kg/kg.s-1) 38 real dqsrain(ngrid) ! rain flux at the surface (kg.m-2.s-1) 39 real dqssnow(ngrid) ! snow flux at the surface (kg.m-2.s-1) 40 REAL d_t(ngrid,nlayermx) ! temperature increment 39 41 40 42 ! Arguments 41 43 REAL ptimestep ! time interval 42 REAL pplev(ngrid mx,nlayermx+1) ! inter-layer pressure43 REAL pplay(ngrid mx,nlayermx) ! mid-layer pressure44 REAL t(ngrid mx,nlayermx) ! input temperature (K)45 REAL zt(ngrid mx,nlayermx) ! working temperature (K)46 REAL ql(ngrid mx,nlayermx) ! liquid water (Kg/Kg)47 REAL q(ngrid mx,nlayermx) ! specific humidity (Kg/Kg)48 REAL rneb(ngrid mx,nlayermx) ! cloud fraction49 REAL d_q(ngrid mx,nlayermx) ! water vapor increment50 REAL d_ql(ngrid mx,nlayermx) ! liquid water / ice increment44 REAL pplev(ngrid,nlayermx+1) ! inter-layer pressure 45 REAL pplay(ngrid,nlayermx) ! mid-layer pressure 46 REAL t(ngrid,nlayermx) ! input temperature (K) 47 REAL zt(ngrid,nlayermx) ! working temperature (K) 48 REAL ql(ngrid,nlayermx) ! liquid water (Kg/Kg) 49 REAL q(ngrid,nlayermx) ! specific humidity (Kg/Kg) 50 REAL rneb(ngrid,nlayermx) ! cloud fraction 51 REAL d_q(ngrid,nlayermx) ! water vapor increment 52 REAL d_ql(ngrid,nlayermx) ! liquid water / ice increment 51 53 52 54 ! Subroutine options … … 78 80 ! Local variables 79 81 INTEGER i, k, n 80 REAL zqs(ngrid mx,nlayermx),Tsat(ngridmx,nlayermx), zdelta, zcor81 REAL zrfl(ngrid mx), zrfln(ngridmx), zqev, zqevt82 83 REAL zoliq(ngrid mx)84 REAL zdz(ngrid mx),zrho(ngridmx),ztot(ngridmx), zrhol(ngridmx)85 REAL zchau(ngrid mx),zfroi(ngridmx),zfrac(ngridmx),zneb(ngridmx)86 87 real reffh2oliq(ngrid mx,nlayermx),reffh2oice(ngridmx,nlayermx)82 REAL zqs(ngrid,nlayermx),Tsat(ngrid,nlayermx), zdelta, zcor 83 REAL zrfl(ngrid), zrfln(ngrid), zqev, zqevt 84 85 REAL zoliq(ngrid) 86 REAL zdz(ngrid),zrho(ngrid),ztot(ngrid), zrhol(ngrid) 87 REAL zchau(ngrid),zfroi(ngrid),zfrac(ngrid),zneb(ngrid) 88 89 real reffh2oliq(ngrid,nlayermx),reffh2oice(ngrid,nlayermx) 88 90 89 91 real ttemp, ptemp, psat_tmp 90 real tnext(ngrid mx,nlayermx)91 92 real l2c(ngrid mx,nlayermx)92 real tnext(ngrid,nlayermx) 93 94 real l2c(ngrid,nlayermx) 93 95 real dWtot 94 96 … … 154 156 ! GCM -----> subroutine variables 155 157 DO k = 1, nlayermx 156 DO i = 1, ngrid mx158 DO i = 1, ngrid 157 159 158 160 zt(i,k) = t(i,k)+pdt(i,k)*ptimestep ! a big fat bug was here … … 175 177 ! Initialise the outputs 176 178 DO k = 1, nlayermx 177 DO i = 1, ngrid mx179 DO i = 1, ngrid 178 180 d_t(i,k) = 0.0 179 181 d_q(i,k) = 0.0 … … 181 183 ENDDO 182 184 ENDDO 183 DO i = 1, ngrid mx185 DO i = 1, ngrid 184 186 zrfl(i) = 0.0 185 187 zrfln(i) = 0.0 … … 188 190 ! calculate saturation mixing ratio 189 191 DO k = 1, nlayermx 190 DO i = 1, ngrid mx192 DO i = 1, ngrid 191 193 ttemp = zt(i,k) 192 194 ptemp = pplay(i,k) … … 199 201 ! get column / layer conversion factor 200 202 DO k = 1, nlayermx 201 DO i = 1, ngrid mx203 DO i = 1, ngrid 202 204 l2c(i,k)=(pplev(i,k)-pplev(i,k+1))/g 203 205 ENDDO … … 211 213 212 214 IF (evap_prec) THEN ! note no rneb dependence! 213 DO i = 1, ngrid mx215 DO i = 1, ngrid 214 216 IF (zrfl(i) .GT.0.) THEN 215 217 … … 241 243 ENDIF 242 244 243 DO i = 1, ngrid mx245 DO i = 1, ngrid 244 246 zoliq(i) = 0.0 245 247 ENDDO … … 248 250 if(precip_scheme.eq.1)then 249 251 250 DO i = 1, ngrid mx252 DO i = 1, ngrid 251 253 ttemp = zt(i,k) 252 254 IF (ttemp .ge. T_h2O_ice_liq) THEN … … 271 273 elseif (precip_scheme.ge.2) then 272 274 273 DO i = 1, ngrid mx275 DO i = 1, ngrid 274 276 IF (rneb(i,k).GT.0.0) THEN 275 277 zoliq(i) = ql(i,k) … … 284 286 285 287 !recalculate liquid water particle radii 286 call h2o_cloudrad( ql,reffh2oliq,reffh2oice)288 call h2o_cloudrad(ngrid,ql,reffh2oliq,reffh2oice) 287 289 288 290 SELECT CASE(precip_scheme) … … 291 293 292 294 DO n = 1, ninter 293 DO i = 1, ngrid mx295 DO i = 1, ngrid 294 296 IF (rneb(i,k).GT.0.0) THEN 295 297 ! this is the ONLY place where zneb, precip_timescale and cloud_sat are used … … 314 316 315 317 DO n = 1, ninter 316 DO i = 1, ngrid mx318 DO i = 1, ngrid 317 319 IF (rneb(i,k).GT.0.0) THEN 318 320 ! this is the ONLY place where zneb, precip_timescale and cloud_sat are used … … 336 338 337 339 DO n = 1, ninter 338 DO i = 1, ngrid mx340 DO i = 1, ngrid 339 341 IF (rneb(i,k).GT.0.0) THEN 340 342 ! this is the ONLY place where zneb and c1 are used … … 358 360 359 361 ! Change in cloud density and surface H2O values 360 DO i = 1, ngrid mx362 DO i = 1, ngrid 361 363 IF (rneb(i,k).GT.0.0) THEN 362 364 d_ql(i,k) = (zoliq(i) - ql(i,k))!/ptimestep … … 371 373 372 374 ! Rain or snow on the ground 373 DO i = 1, ngrid mx375 DO i = 1, ngrid 374 376 if(zrfl(i).lt.0.0)then 375 377 print*,'Droplets of negative rain are falling...' … … 387 389 ! now subroutine -----> GCM variables 388 390 DO k = 1, nlayermx 389 DO i = 1, ngrid mx391 DO i = 1, ngrid 390 392 391 393 if(evap_prec)then -
trunk/LMDZ.GENERIC/libf/phystd/rcm1d.F
r773 r787 3 3 ! to use 'getin' 4 4 use ioipsl_getincom 5 use surfdat_h 6 use comdiurn_h 7 use comsaison_h 8 use comsoil_h 9 USE comgeomfi_h 5 10 6 11 implicit none … … 33 38 #include "paramet.h" 34 39 #include "dimphys.h" 35 #include "comgeomfi.h"36 #include "surfdat.h"37 #include "comsoil.h"38 #include "comdiurn.h"39 40 #include "callkeys.h" 40 41 #include "comcstfi.h" 41 42 #include "planete.h" 42 #include "comsaison.h"43 43 #include "control.h" 44 44 #include "comvert.h" 45 45 #include "netcdf.inc" 46 #include "watercap.h"47 #include "fisice.h"48 46 #include "logic.h" 49 #include "advtrac.h"50 47 #include "comgeom.h" 51 48 … … 95 92 REAL tmp1(0:nlayermx),tmp2(0:nlayermx) 96 93 Logical tracerdyn 97 integer :: nq =1 ! number of tracers94 integer :: nq !=1 ! number of tracers 98 95 99 96 character*2 str2 … … 110 107 111 108 ! added by BC 112 REAL cloudfrac( ngridmx,nlayermx)113 REAL hice( ngridmx),totcloudfrac(ngridmx)109 REAL cloudfrac(1,nlayermx) 110 REAL hice(1),totcloudfrac(1) 114 111 REAL qzero1D !initial water amount on the ground 112 113 ! added by AS to avoid the use of adv trac common 114 character*20 nametrac(nqmx) ! name of the tracer (no need for adv trac common) 115 115 116 116 117 c======================================================================= 117 118 c INITIALISATION 118 119 c======================================================================= 120 121 !! those are defined in surfdat_h.F90 122 IF (.not. ALLOCATED(albedodat)) ALLOCATE(albedodat(1)) 123 IF (.not. ALLOCATED(phisfi)) ALLOCATE(phisfi(1)) 124 IF (.not. ALLOCATED(zmea)) ALLOCATE(zmea(1)) 125 IF (.not. ALLOCATED(zstd)) ALLOCATE(zstd(1)) 126 IF (.not. ALLOCATED(zsig)) ALLOCATE(zsig(1)) 127 IF (.not. ALLOCATED(zgam)) ALLOCATE(zgam(1)) 128 IF (.not. ALLOCATED(zthe)) ALLOCATE(zthe(1)) 129 IF (.not. ALLOCATED(dryness)) ALLOCATE(dryness(1)) 130 IF (.not. ALLOCATED(watercaptag)) ALLOCATE(watercaptag(1)) 131 !! those are defined in comdiurn_h.F90 132 IF (.not.ALLOCATED(sinlat)) ALLOCATE(sinlat(1)) 133 IF (.not.ALLOCATED(coslat)) ALLOCATE(coslat(1)) 134 IF (.not.ALLOCATED(sinlon)) ALLOCATE(sinlon(1)) 135 IF (.not.ALLOCATED(coslon)) ALLOCATE(coslon(1)) 136 !! those are defined in comsoil_h.F90 137 IF (.not.ALLOCATED(layer)) ALLOCATE(layer(nsoilmx)) 138 IF (.not.ALLOCATED(mlayer)) ALLOCATE(mlayer(0:nsoilmx-1)) 139 IF (.not.ALLOCATED(inertiedat)) ALLOCATE(inertiedat(1,nsoilmx)) 140 !! those are defined in comgeomfi_h 141 IF (.not. ALLOCATED(lati)) ALLOCATE(lati(1)) 142 IF (.not. ALLOCATED(long)) ALLOCATE(long(1)) 143 IF (.not. ALLOCATED(area)) ALLOCATE(area(1)) 144 119 145 120 146 saveprofile=.false. … … 214 240 endif 215 241 216 ! initialize advection schemes to Van-Leer for all tracers217 do iq=1,nq218 iadv(iq)=3 ! Van-Leer219 enddo220 221 242 do iq=1,nq 222 243 ! minimal version, just read in the tracer names, 1 per line 223 read(90,*,iostat=ierr) tnom(iq)244 read(90,*,iostat=ierr) nametrac(iq) 224 245 if (ierr.ne.0) then 225 246 write(*,*) 'rcm1d: error reading tracer names...' … … 232 253 i_h2o_vap=0 233 254 do iq=1,nq 234 if ( tnom(iq)=="co2_ice") then255 if (nametrac(iq)=="co2_ice") then 235 256 i_co2_ice=iq 236 elseif ( tnom(iq)=="h2o_ice") then257 elseif (nametrac(iq)=="h2o_ice") then 237 258 i_h2o_ice=iq 238 elseif ( tnom(iq)=="h2o_vap") then259 elseif (nametrac(iq)=="h2o_vap") then 239 260 i_h2o_vap=iq 240 261 endif … … 258 279 do iq=1,nq 259 280 write(str7,'(a1,i2.2)')'q',iq 260 tnom(iq)=str7281 nametrac(iq)=str7 261 282 enddo 262 283 ! actually, we'll need at least one "co2_ice" tracer 263 284 ! (for surface CO2 ice) 264 tnom(1)="co2_ice"285 nametrac(1)="co2_ice" 265 286 i_co2_ice=1 266 287 endif ! of if (tracer) … … 482 503 c --------------------------- 483 504 484 DO iq=1,nq mx505 DO iq=1,nq 485 506 DO ilayer=1,nlayer 486 507 q(ilayer,iq) = 0. … … 488 509 ENDDO 489 510 490 DO iq=1,nq mx511 DO iq=1,nq 491 512 qsurf(iq) = 0. 492 513 ENDDO … … 683 704 c les variables purement physiques a "physiq"... 684 705 685 call physdem1( "startfi.nc",long,lati,nsoilmx,nqmx,706 call physdem1(1,"startfi.nc",long,lati,nsoilmx,nq, 686 707 & dtphys,float(day0), 687 708 & time,tsurf,tsoil,emis,q2,qsurf, 688 709 & area,albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe, 689 & cloudfrac,totcloudfrac,hice )710 & cloudfrac,totcloudfrac,hice,nametrac) 690 711 691 712 c======================================================================= … … 740 761 741 762 742 CALL physiq (1,llm,nqmx, 763 CALL physiq (1,llm,nq, 764 . nametrac, 743 765 , firstcall,lastcall, 744 766 , day,time,dtphys, … … 802 824 c -------------------------------------- 803 825 804 DO iq = 1, nq mx826 DO iq = 1, nq 805 827 DO ilayer=1,nlayer 806 828 q(ilayer,iq)=q(ilayer,iq)+dtphys*dq(ilayer,iq) -
trunk/LMDZ.GENERIC/libf/phystd/soil.F
r253 r787 1 subroutine soil(ngrid,nsoil,firstcall, 1 subroutine soil(ngrid,nsoil,firstcall,lastcall, 2 2 & therm_i, 3 3 & timestep,tsurf,tsoil, 4 4 & capcal,fluxgrd) 5 6 use comsoil_h 7 5 8 implicit none 6 9 … … 17 20 #include "dimphys.h" 18 21 19 #include"comsoil.h"20 22 21 23 c----------------------------------------------------------------------- … … 26 28 integer nsoil ! number of soil layers 27 29 logical firstcall ! identifier for initialization call 30 logical lastcall 28 31 real therm_i(ngrid,nsoil) ! thermal inertia 29 32 real timestep ! time step … … 35 38 36 39 ! local saved variables: 37 !real,save :: mthermdiff(ngridmx,0:nsoilmx-1) ! mid-layer thermal diffusivity 38 !real,save :: thermdiff(ngridmx,nsoilmx-1) ! inter-layer thermal diffusivity 39 !real,save :: coefq(0:nsoilmx-1) ! q_{k+1/2} coefficients 40 !real,save :: coefd(ngridmx,nsoilmx-1) ! d_k coefficients 41 !real,save :: alph(ngridmx,nsoilmx-1) ! alpha_k coefficients 42 !real,save :: beta(ngridmx,nsoilmx-1) ! beta_k coefficients 43 !real,save :: mu 44 45 real mthermdiff(ngridmx,0:nsoilmx-1) ! mid-layer thermal diffusivity 46 real thermdiff(ngridmx,nsoilmx-1) ! inter-layer thermal diffusivity 47 real coefq(0:nsoilmx-1) ! q_{k+1/2} coefficients 48 real coefd(ngridmx,nsoilmx-1) ! d_k coefficients 49 real alph(ngridmx,nsoilmx-1) ! alpha_k coefficients 50 real beta(ngridmx,nsoilmx-1) ! beta_k coefficients 51 real mu 40 real,dimension(:,:),save,allocatable :: mthermdiff ! mid-layer thermal diffusivity 41 real,dimension(:,:),save,allocatable :: thermdiff ! inter-layer thermal diffusivity 42 real,dimension(:),save,allocatable :: coefq ! q_{k+1/2} coefficients 43 real,dimension(:,:),save,allocatable :: coefd ! d_k coefficients 44 real,dimension(:,:),save,allocatable :: alph ! alpha_k coefficients 45 real,dimension(:,:),save,allocatable :: beta ! beta_k coefficients 46 real,save :: mu 52 47 53 save mthermdiff,thermdiff,coefq,coefd,alph,beta,mu54 55 48 ! local variables: 56 49 integer ig,ik … … 64 57 ! note: firstcall is set to .true. or .false. by the caller 65 58 ! and not changed by soil.F 59 60 ALLOCATE(mthermdiff(ngrid,0:nsoilmx-1)) ! mid-layer thermal diffusivity 61 ALLOCATE(thermdiff(ngrid,nsoilmx-1)) ! inter-layer thermal diffusivity 62 ALLOCATE(coefq(0:nsoilmx-1)) ! q_{k+1/2} coefficients 63 ALLOCATE(coefd(ngrid,nsoilmx-1)) ! d_k coefficients 64 ALLOCATE(alph(ngrid,nsoilmx-1)) ! alpha_k coefficients 65 ALLOCATE(beta(ngrid,nsoilmx-1)) ! beta_k coefficients 66 66 67 ! 0.1 Build mthermdiff(:), the mid-layer thermal diffusivities 67 68 do ig=1,ngrid … … 186 187 enddo 187 188 189 if (lastcall) then 190 IF ( ALLOCATED(mthermdiff)) DEALLOCATE(mthermdiff) 191 IF ( ALLOCATED(thermdiff)) DEALLOCATE(thermdiff) 192 IF ( ALLOCATED(coefq)) DEALLOCATE(coefq) 193 IF ( ALLOCATED(coefd)) DEALLOCATE(coefd) 194 IF ( ALLOCATED(alph)) DEALLOCATE(alph) 195 IF ( ALLOCATED(beta)) DEALLOCATE(beta) 196 endif 188 197 189 198 end -
trunk/LMDZ.GENERIC/libf/phystd/soil_settings.F
r786 r787 1 1 subroutine soil_settings(nid,ngrid,nsoil,tsurf,tsoil) 2 3 use comsoil_h 4 2 5 implicit none 3 6 … … 26 29 #include "dimphys.h" 27 30 28 #include "comsoil.h"29 31 #include "netcdf.inc" 30 32 !====================================================================== … … 35 37 integer ngrid ! # of horizontal grid points 36 38 integer nsoil ! # of soil layers 39 integer sta ! # at which reading starts 37 40 real tsurf(ngrid) ! surface temperature 38 41 ! output: 39 real tsoil(ngrid mx,nsoilmx) ! soil temperature42 real tsoil(ngrid,nsoilmx) ! soil temperature 40 43 41 44 !====================================================================== … … 67 70 real,parameter :: default_volcapa=1.e6 68 71 72 integer, dimension(2) :: sta2d 73 integer, dimension(2) :: siz2d 74 69 75 !====================================================================== 76 77 !! this is defined in comsoil_h 78 IF (.not.ALLOCATED(layer)) 79 . ALLOCATE(layer(nsoilmx)) 80 IF (.not.ALLOCATED(mlayer)) 81 . ALLOCATE(mlayer(0:nsoilmx-1)) 82 IF (.not.ALLOCATED(inertiedat)) 83 . ALLOCATE(inertiedat(ngrid,nsoilmx)) 84 85 !! this is defined in dimphys.h 86 sta = cursor 70 87 71 88 ! 1. Depth coordinate … … 94 111 interpol=.true. 95 112 endif 113 114 sta2d = (/sta,1/) 115 siz2d = (/ngrid,dimlen/) 116 96 117 97 118 ! 1.2 Find out the # of dimensions <inertiedat> was defined as using … … 231 252 allocate(surfinertia(ngrid)) 232 253 #ifdef NC_DOUBLE 233 ierr = NF_GET_VAR _DOUBLE(nid, nvarid, surfinertia)234 #else 235 ierr = NF_GET_VAR _REAL(nid, nvarid, surfinertia)254 ierr = NF_GET_VARA_DOUBLE(nid, nvarid, sta, ngrid, surfinertia) 255 #else 256 ierr = NF_GET_VARA_REAL(nid, nvarid, sta, ngrid, surfinertia) 236 257 #endif 237 258 if (ierr.NE.NF_NOERR) then … … 258 279 endif 259 280 #ifdef NC_DOUBLE 260 ierr = NF_GET_VAR _DOUBLE(nid,nvarid,oldinertiedat)261 #else 262 ierr = NF_GET_VAR _REAL(nid,nvarid,oldinertiedat)281 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta2d,siz2d,oldinertiedat) 282 #else 283 ierr = NF_GET_VARA_REAL(nid,nvarid,sta2d,siz2d,oldinertiedat) 263 284 #endif 264 285 if (ierr.NE.NF_NOERR) then … … 268 289 else ! put values in therm_i 269 290 #ifdef NC_DOUBLE 270 ierr = NF_GET_VAR _DOUBLE(nid,nvarid,inertiedat)271 #else 272 ierr = NF_GET_VAR _REAL(nid,nvarid,inertiedat)291 ierr = NF_GET_VARA_DOUBLE(nid,nvarid,sta2d,siz2d,inertiedat) 292 #else 293 ierr = NF_GET_VARA_REAL(nid,nvarid,sta2d,siz2d,inertiedat) 273 294 #endif 274 295 if (ierr.NE.NF_NOERR) then … … 300 321 endif 301 322 #ifdef NC_DOUBLE 302 ierr=NF_GET_VAR _DOUBLE(nid,nvarid,oldtsoil)303 #else 304 ierr=NF_GET_VAR _REAL(nid,nvarid,oldtsoil)323 ierr=NF_GET_VARA_DOUBLE(nid,nvarid,sta2d,siz2d,oldtsoil) 324 #else 325 ierr=NF_GET_VARA_REAL(nid,nvarid,sta2d,siz2d,oldtsoil) 305 326 #endif 306 327 if (ierr.ne.NF_NOERR) then … … 310 331 else ! put values in tsoil 311 332 #ifdef NC_DOUBLE 312 ierr=NF_GET_VAR _DOUBLE(nid,nvarid,tsoil)313 #else 314 ierr=NF_GET_VAR _REAL(nid,nvarid,tsoil)333 ierr=NF_GET_VARA_DOUBLE(nid,nvarid,sta2d,siz2d,tsoil) 334 #else 335 ierr=NF_GET_VARA_REAL(nid,nvarid,sta2d,siz2d,tsoil) 315 336 #endif 316 337 if (ierr.ne.NF_NOERR) then -
trunk/LMDZ.GENERIC/libf/phystd/surface_nature.F
r253 r787 1 SUBROUTINE surface_nature( obliquit,qsurf,qsurfliquid1 SUBROUTINE surface_nature(ngrid,nq,obliquit,qsurf,qsurfliquid 2 2 & ,qsurfsnow,rnat,oceanarea) 3 4 USE surfdat_h 5 USE comsoil_h 6 USE comgeomfi_h 7 USE tracer_h 8 3 9 IMPLICIT none 4 10 … … 31 37 #include "comcstfi.h" 32 38 #include "callkeys.h" 33 #include "tracer.h"34 #include "fisice.h"35 #include "comgeomfi.h"36 #include "surfdat.h"37 #include "comsoil.h"38 39 39 REAL qsurf(ngridmx,nqmx),ps(ngridmx) 40 REAL qsurfliquid(ngridmx) 41 REAL qsurfsnow(ngridmx) 40 integer ngrid,nq 41 42 REAL qsurf(ngrid,nq),ps(ngrid) 43 REAL qsurfliquid(ngrid) 44 REAL qsurfsnow(ngrid) 42 45 INTEGER iq, ig 43 INTEGER rnat(ngrid mx)46 INTEGER rnat(ngrid) 44 47 REAL oceanarea 45 48 REAL obliquit 46 49 47 do ig=1,ngrid mx50 do ig=1,ngrid 48 51 rnat(ig)=1 49 52 dryness(ig)=1 !(coefficient for evaporation) … … 56 59 57 60 oceanarea=0. 58 do ig=1,ngrid mx61 do ig=1,ngrid 59 62 if (rnat(ig).eq.0)then 60 63 oceanarea=oceanarea+area(ig) -
trunk/LMDZ.GENERIC/libf/phystd/surfini.F
r135 r787 1 SUBROUTINE surfini(ngrid,qsurf,psolaralb) 1 SUBROUTINE surfini(ngrid,nq,qsurf,psolaralb) 2 3 USE surfdat_h 4 USE tracer_h 5 2 6 IMPLICIT NONE 3 7 c======================================================================= … … 11 15 #include "dimensions.h" 12 16 #include "dimphys.h" 13 #include "surfdat.h"14 17 #include "callkeys.h" 15 #include "tracer.h"16 18 c 17 19 INTEGER ngrid,ig,icap 20 INTEGER nq 18 21 REAL piceco2(ngrid),psolaralb(ngrid) 19 REAL qsurf(ngrid,nq mx) !tracer on surface (kg/m2)22 REAL qsurf(ngrid,nq) !tracer on surface (kg/m2) 20 23 21 24 EXTERNAL ISMIN,ISMAX … … 42 45 ! DO ig=1,ngrid 43 46 c IF (water) THEN 44 c if (qsurf(ig,nq mx).gt.0.005) then47 c if (qsurf(ig,nq).gt.0.005) then 45 48 c psolaralb(ig,1) = 0.4 46 49 c psolaralb(ig,2) = 0.4 -
trunk/LMDZ.GENERIC/libf/phystd/tabfi.F
r726 r787 1 1 c======================================================================= 2 SUBROUTINE tabfi(n id,Lmodif,tab0,day_ini,lmax,p_rad,2 SUBROUTINE tabfi(ngrid,nid,Lmodif,tab0,day_ini,lmax,p_rad, 3 3 . p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time) 4 4 c======================================================================= … … 46 46 use ioipsl_getincom 47 47 48 USE surfdat_h 49 use comsoil_h 50 USE comgeomfi_h 51 48 52 implicit none 49 53 … … 51 55 #include "dimphys.h" 52 56 #include "comcstfi.h" 53 #include "comgeomfi.h"54 57 #include "planete.h" 55 #include "surfdat.h"56 #include "comsoil.h"57 58 #include "netcdf.inc" 58 59 #include "callkeys.h" … … 61 62 c Declarations 62 63 c----------------------------------------------------------------------- 64 65 INTEGER ngrid 63 66 64 67 c Arguments … … 104 107 c Initialization of some physical constants 105 108 c informations on physics grid 106 if(ngrid mx.ne.tab_cntrl(tab0+1)) then107 print*,'tabfi: WARNING !!! tab_cntrl(tab0+1).ne.ngrid mx'108 print*,tab_cntrl(tab0+1),ngrid mx109 if(ngrid.ne.tab_cntrl(tab0+1)) then 110 print*,'tabfi: WARNING !!! tab_cntrl(tab0+1).ne.ngrid' 111 print*,tab_cntrl(tab0+1),ngrid 109 112 endif 110 113 lmax = nint(tab_cntrl(tab0+2)) … … 168 171 write(*,*) 'Reading tab_cntrl when calling tabfi before changes' 169 172 write(*,*) '*****************************************************' 170 write(*,5) '(1) = ngridmx?',tab_cntrl(tab0+1),float(ngridmx)173 write(*,5) '(1) = ngrid?',tab_cntrl(tab0+1),float(ngrid) 171 174 write(*,5) '(2) lmax',tab_cntrl(tab0+2),float(lmax) 172 175 write(*,5) '(3) day_ini',tab_cntrl(tab0+3),float(day_ini) … … 490 493 write(*,*) 'Reading tab_cntrl when calling tabfi AFTER changes' 491 494 write(*,*) '*****************************************************' 492 write(*,5) '(1) = ngridmx?',tab_cntrl(tab0+1),float(ngridmx)495 write(*,5) '(1) = ngrid?',tab_cntrl(tab0+1),float(ngrid) 493 496 write(*,5) '(2) lmax',tab_cntrl(tab0+2),float(lmax) 494 497 write(*,5) '(3) day_ini',tab_cntrl(tab0+3),float(day_ini) -
trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90
r728 r787 1 subroutine totalcloudfrac( rneb,totalrneb,pplev,pq,tau)1 subroutine totalcloudfrac(ngrid,nq,rneb,totalrneb,pplev,pq,tau) 2 2 3 3 use watercommon_h 4 use comdiurn_h 5 USE comgeomfi_h 6 USE tracer_h 4 7 implicit none 5 8 … … 19 22 #include "dimphys.h" 20 23 #include "comcstfi.h" 21 #include "tracer.h"22 #include "fisice.h"23 #include "comgeomfi.h"24 #include "comdiurn.h"25 24 #include "callkeys.h" 26 25 26 integer ngrid, nq 27 27 28 real rneb(ngrid mx,nlayermx) ! cloud fraction29 real pplev(ngrid mx,nlayermx+1)30 real pq(ngrid mx,nlayermx,nqmx)31 real tau(ngrid mx,nlayermx)28 real rneb(ngrid,nlayermx) ! cloud fraction 29 real pplev(ngrid,nlayermx+1) 30 real pq(ngrid,nlayermx,nq) 31 real tau(ngrid,nlayermx) 32 32 33 real totalrneb(ngrid mx) ! total cloud fraction33 real totalrneb(ngrid) ! total cloud fraction 34 34 real, dimension(nlayermx+1) :: masse 35 35 integer, parameter :: recovery=7 … … 50 50 51 51 52 do ig=1,ngrid mx52 do ig=1,ngrid 53 53 totalrneb(ig) = 0. 54 54 -
trunk/LMDZ.GENERIC/libf/phystd/turbdiff.F90
r736 r787 9 9 use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol,Psat_water 10 10 use radcommon_h, only : sigma 11 USE surfdat_h 12 USE comgeomfi_h 13 USE tracer_h 11 14 12 15 implicit none … … 43 46 #include "comcstfi.h" 44 47 #include "callkeys.h" 45 #include "surfdat.h"46 #include "comgeomfi.h"47 #include "tracer.h"48 49 #include "watercap.h"50 48 51 49 ! arguments … … 84 82 integer ilev,ig,ilay,nlev 85 83 86 REAL z4st,zdplanck(ngrid mx)87 REAL zkv(ngrid mx,nlayermx+1),zkh(ngridmx,nlayermx+1)88 REAL zcdv(ngrid mx),zcdh(ngridmx)89 REAL zcdv_true(ngrid mx),zcdh_true(ngridmx)90 REAL zu(ngrid mx,nlayermx),zv(ngridmx,nlayermx)91 REAL zh(ngrid mx,nlayermx),zt(ngridmx,nlayermx)92 REAL ztsrf(ngrid mx)93 REAL z1(ngrid mx),z2(ngridmx)94 REAL zmass(ngrid mx,nlayermx)95 REAL zfluxv(ngrid mx,nlayermx),zfluxt(ngridmx,nlayermx),zfluxq(ngridmx,nlayermx)96 REAL zb0(ngrid mx,nlayermx)97 REAL zExner(ngrid mx,nlayermx),zovExner(ngridmx,nlayermx)98 REAL zcv(ngrid mx,nlayermx),zdv(ngridmx,nlayermx) !inversion coefficient for winds99 REAL zct(ngrid mx,nlayermx),zdt(ngridmx,nlayermx) !inversion coefficient for temperature100 REAL zcq(ngrid mx,nlayermx),zdq(ngridmx,nlayermx) !inversion coefficient for tracers84 REAL z4st,zdplanck(ngrid) 85 REAL zkv(ngrid,nlayermx+1),zkh(ngrid,nlayermx+1) 86 REAL zcdv(ngrid),zcdh(ngrid) 87 REAL zcdv_true(ngrid),zcdh_true(ngrid) 88 REAL zu(ngrid,nlayermx),zv(ngrid,nlayermx) 89 REAL zh(ngrid,nlayermx),zt(ngrid,nlayermx) 90 REAL ztsrf(ngrid) 91 REAL z1(ngrid),z2(ngrid) 92 REAL zmass(ngrid,nlayermx) 93 REAL zfluxv(ngrid,nlayermx),zfluxt(ngrid,nlayermx),zfluxq(ngrid,nlayermx) 94 REAL zb0(ngrid,nlayermx) 95 REAL zExner(ngrid,nlayermx),zovExner(ngrid,nlayermx) 96 REAL zcv(ngrid,nlayermx),zdv(ngrid,nlayermx) !inversion coefficient for winds 97 REAL zct(ngrid,nlayermx),zdt(ngrid,nlayermx) !inversion coefficient for temperature 98 REAL zcq(ngrid,nlayermx),zdq(ngrid,nlayermx) !inversion coefficient for tracers 101 99 REAL zcst1 102 100 REAL zu2!, a 103 REAL zcq0(ngrid mx),zdq0(ngridmx)104 REAL zx_alf1(ngrid mx),zx_alf2(ngridmx)101 REAL zcq0(ngrid),zdq0(ngrid) 102 REAL zx_alf1(ngrid),zx_alf2(ngrid) 105 103 106 104 LOGICAL firstcall … … 111 109 ! ------- 112 110 INTEGER iq 113 REAL zq(ngrid mx,nlayermx,nqmx)114 REAL zqnoevap(ngrid mx,nlayermx) !special for water case to compute where evaporated water goes.115 REAL pdqevap(ngrid mx,nlayermx) !special for water case to compute where evaporated water goes.116 REAL zdmassevap(ngrid mx)117 REAL rho(ngrid mx) ! near-surface air density118 REAL qsat(ngrid mx),psat(ngridmx)111 REAL zq(ngrid,nlayermx,nq) 112 REAL zqnoevap(ngrid,nlayermx) !special for water case to compute where evaporated water goes. 113 REAL pdqevap(ngrid,nlayermx) !special for water case to compute where evaporated water goes. 114 REAL zdmassevap(ngrid) 115 REAL rho(ngrid) ! near-surface air density 116 REAL qsat(ngrid),psat(ngrid) 119 117 DATA firstcall/.true./ 120 118 REAL kmixmin … … 122 120 ! Variables added for implicit latent heat inclusion 123 121 ! -------------------------------------------------- 124 real dqsat(ngrid mx), qsat_temp1, qsat_temp2,psat_temp122 real dqsat(ngrid), qsat_temp1, qsat_temp2,psat_temp 125 123 126 124 integer, save :: ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface... … … 241 239 ! ------------------------------------------------------ 242 240 243 call vdif_kc( ptimestep,g,pzlev,pzlay,pu,pv,zh,zcdv_true,pq2,zkv,zkh) !JL12 why not call vdif_kc with updated winds and temperature241 call vdif_kc(ngrid,ptimestep,g,pzlev,pzlay,pu,pv,zh,zcdv_true,pq2,zkv,zkh) !JL12 why not call vdif_kc with updated winds and temperature 244 242 245 243 ! Adding eddy mixing to mimic 3D general circulation in 1D … … 262 260 263 261 !JL12 calculate the flux coefficients (tables multiplied elements by elements) 264 zfluxv(1:ngrid mx,1:nlayermx)=zkv(1:ngridmx,1:nlayermx)*zb0(1:ngridmx,1:nlayermx)262 zfluxv(1:ngrid,1:nlayermx)=zkv(1:ngrid,1:nlayermx)*zb0(1:ngrid,1:nlayermx) 265 263 266 264 !----------------------------------------------------------------------- … … 358 356 ! JL12 calculate the flux coefficients (tables multiplied elements by elements) 359 357 ! --------------------------------------------------------------- 360 zfluxq(1:ngridmx,1:nlayermx)=zkh(1:ngridmx,1:nlayermx)*zb0(1:ngridmx,1:nlayermx) !JL12 we save zfluxq which doesn't need the Exner factor 361 zfluxt(1:ngridmx,1:nlayermx)=zfluxq(1:ngridmx,1:nlayermx)*zExner(1:ngridmx,1:nlayermx) 362 358 zfluxq(1:ngrid,1:nlayermx)=zkh(1:ngrid,1:nlayermx)*zb0(1:ngrid,1:nlayermx) !JL12 we save zfluxq which doesn't need the Exner factor 359 zfluxt(1:ngrid,1:nlayermx)=zfluxq(1:ngrid,1:nlayermx)*zExner(1:ngrid,1:nlayermx) 363 360 364 361 DO ig=1,ngrid … … 404 401 405 402 DO ig=1,ngrid 406 407 403 z1(ig)=pcapcal(ig)*ptsrf(ig)+cpp*zfluxt(ig,1)*zct(ig,1)*zovExner(ig,1) & 408 404 + pfluxsrf(ig)*ptimestep + zdplanck(ig)*ptsrf(ig) … … 434 430 ! Calculate vertical flux from the bottom to the first layer (dust) 435 431 ! ----------------------------------------------------------------- 436 do ig=1,ngrid mx432 do ig=1,ngrid 437 433 rho(ig) = zb0(ig,1) /ptimestep 438 434 end do … … 470 466 ENDDO 471 467 else ! general case 472 DOig=1,ngrid468 do ig=1,ngrid 473 469 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 474 470 zcq(ig,1)=(zmass(ig,1)*zq(ig,1,iq)+zfluxq(ig,2)*zcq(ig,2)+(-pdqsdif(ig,iq))*ptimestep)*z1(ig) … … 500 496 501 497 ! compute evaporation efficiency 502 do ig = 1,ngrid498 do ig=1,ngrid 503 499 if(rnat(ig).eq.1)then 504 500 dryness(ig)=pqsurf(ig,iliq_surf)+pqsurf(ig,iice_surf) … … 509 505 510 506 do ig=1,ngrid 511 512 507 ! Calculate the value of qsat at the surface (water) 513 508 call Psat_water(ptsrf(ig),pplev(ig,1),psat(ig),qsat(ig)) … … 526 521 zdq(ig,nlay)=zfluxq(ig,nlay)*z1(ig) 527 522 enddo 528 523 529 524 do ilay=nlay-1,2,-1 530 525 do ig=1,ngrid … … 658 653 ENDDO 659 654 660 DOig=1,ngrid655 do ig=1,ngrid 661 656 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 662 657 zcq(ig,1)=(zmass(ig,1)*zqnoevap(ig,1)+zfluxq(ig,2)*zcq(ig,2))*z1(ig) … … 692 687 enddo 693 688 694 DO ig=1,ngrid 689 DO ig=1,ngrid ! computing sensible heat flux (atm => surface) 695 690 sensibFlux(ig)=cpp*zfluxt(ig,1)/ptimestep*(zt(ig,1)*zovExner(ig,1)-ztsrf(ig)) 696 691 ENDDO … … 710 705 enddo 711 706 enddo 712 707 do ig=1,ngrid 713 708 zdmassevap(ig)=SUM(pdqevap(ig,:)*zmass(ig,:))*ptimestep 714 709 end do -
trunk/LMDZ.GENERIC/libf/phystd/vdif_kc.F
r135 r787 1 SUBROUTINE vdif_kc( dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn)1 SUBROUTINE vdif_kc(ngrid,dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn) 2 2 IMPLICIT NONE 3 3 c....................................................................... … … 27 27 c 28 28 c....................................................................... 29 INTEGER ngrid 29 30 REAL dt,g 30 REAL zlev(ngrid mx,nlayermx+1)31 REAL zlay(ngrid mx,nlayermx)32 REAL u(ngrid mx,nlayermx)33 REAL v(ngrid mx,nlayermx)34 REAL teta(ngrid mx,nlayermx)35 REAL cd(ngrid mx)36 REAL q2(ngrid mx,nlayermx+1)37 REAL km(ngrid mx,nlayermx+1)38 REAL kn(ngrid mx,nlayermx+1)31 REAL zlev(ngrid,nlayermx+1) 32 REAL zlay(ngrid,nlayermx) 33 REAL u(ngrid,nlayermx) 34 REAL v(ngrid,nlayermx) 35 REAL teta(ngrid,nlayermx) 36 REAL cd(ngrid) 37 REAL q2(ngrid,nlayermx+1) 38 REAL km(ngrid,nlayermx+1) 39 REAL kn(ngrid,nlayermx+1) 39 40 c....................................................................... 40 41 c … … 49 50 c 50 51 c....................................................................... 51 INTEGER nlay,nlev ,ngrid52 REAL unsdz(ngrid mx,nlayermx)53 REAL unsdzdec(ngrid mx,nlayermx+1)54 REAL q(ngrid mx,nlayermx+1)52 INTEGER nlay,nlev 53 REAL unsdz(ngrid,nlayermx) 54 REAL unsdzdec(ngrid,nlayermx+1) 55 REAL q(ngrid,nlayermx+1) 55 56 c....................................................................... 56 57 c … … 62 63 c 63 64 c....................................................................... 64 REAL kmpre(ngrid mx,nlayermx+1)65 REAL kmpre(ngrid,nlayermx+1) 65 66 REAL qcstat 66 67 REAL q2cstat … … 70 71 c 71 72 c....................................................................... 72 REAL long(ngrid mx,nlayermx+1)73 REAL long(ngrid,nlayermx+1) 73 74 c....................................................................... 74 75 c … … 93 94 REAL mcstat 94 95 REAL m2cstat 95 REAL m(ngrid mx,nlayermx+1)96 REAL mpre(ngrid mx,nlayermx+1)97 REAL m2(ngrid mx,nlayermx+1)98 REAL n2(ngrid mx,nlayermx+1)96 REAL m(ngrid,nlayermx+1) 97 REAL mpre(ngrid,nlayermx+1) 98 REAL m2(ngrid,nlayermx+1) 99 REAL n2(ngrid,nlayermx+1) 99 100 c....................................................................... 100 101 c … … 118 119 LOGICAL gnsup 119 120 REAL gm 120 c REAL ri(ngrid mx,nlayermx+1)121 REAL sn(ngrid mx,nlayermx+1)122 REAL snq2(ngrid mx,nlayermx+1)123 REAL sm(ngrid mx,nlayermx+1)124 REAL smq2(ngrid mx,nlayermx+1)121 c REAL ri(ngrid,nlayermx+1) 122 REAL sn(ngrid,nlayermx+1) 123 REAL snq2(ngrid,nlayermx+1) 124 REAL sm(ngrid,nlayermx+1) 125 REAL smq2(ngrid,nlayermx+1) 125 126 c....................................................................... 126 127 c … … 183 184 PARAMETER (nlay=nlayermx) 184 185 PARAMETER (nlev=nlayermx+1) 185 PARAMETER (ngrid=ngridmx)186 186 c 187 187 PARAMETER ( … … 209 209 c 210 210 DO ilev=1,nlev 211 211 DO igrid=1,ngrid 212 212 q2(igrid,ilev)=amax1(q2(igrid,ilev),q2min) 213 213 q(igrid,ilev)=sqrt(q2(igrid,ilev)) 214 214 ENDDO 215 215 ENDDO 216 216 c 217 DO igrid=1,ngrid217 DO igrid=1,ngrid 218 218 tmp1=cd(igrid)*(u(igrid,1)**2+v(igrid,1)**2) 219 219 q2(igrid,1)=b1**(2.E+0/3.E+0)*tmp1 220 220 q2(igrid,1)=amax1(q2(igrid,1),q2min) 221 221 q(igrid,1)=sqrt(q2(igrid,1)) 222 222 ENDDO 223 223 c 224 224 c....................................................................... … … 237 237 c 238 238 DO ilay=1,nlay 239 DO igrid=1,ngrid239 DO igrid=1,ngrid 240 240 unsdz(igrid,ilay)=1.E+0/(zlev(igrid,ilay+1)-zlev(igrid,ilay)) 241 241 ENDDO 242 242 ENDDO 243 DO igrid=1,ngrid243 DO igrid=1,ngrid 244 244 unsdzdec(igrid,1)=1.E+0/(zlay(igrid,1)-zlev(igrid,1)) 245 245 ENDDO 246 246 DO ilay=2,nlay 247 DO igrid=1,ngrid247 DO igrid=1,ngrid 248 248 unsdzdec(igrid,ilay)=1.E+0/(zlay(igrid,ilay)-zlay(igrid,ilay-1)) 249 249 ENDDO 250 250 ENDDO 251 DO igrid=1,ngrid251 DO igrid=1,ngrid 252 252 unsdzdec(igrid,nlay+1)=1.E+0/(zlev(igrid,nlay+1)-zlay(igrid,nlay)) 253 253 ENDDO 254 254 c 255 255 c....................................................................... … … 257 257 c....................................................................... 258 258 c 259 DO igrid=1,ngrid259 DO igrid=1,ngrid 260 260 m2(igrid,1)=(unsdzdec(igrid,1) 261 261 & *u(igrid,1))**2 … … 264 264 m(igrid,1)=sqrt(m2(igrid,1)) 265 265 mpre(igrid,1)=m(igrid,1) 266 266 ENDDO 267 267 c 268 268 c----------------------------------------------------------------------- 269 269 DO ilev=2,nlev-1 270 DO igrid=1,ngrid270 DO igrid=1,ngrid 271 271 c----------------------------------------------------------------------- 272 272 c … … 295 295 c 296 296 c----------------------------------------------------------------------- 297 297 ENDDO 298 298 ENDDO 299 299 c----------------------------------------------------------------------- 300 300 c 301 DO igrid=1,ngrid301 DO igrid=1,ngrid 302 302 m2(igrid,nlev)=m2(igrid,nlev-1) 303 303 m(igrid,nlev)=m(igrid,nlev-1) 304 304 mpre(igrid,nlev)=m(igrid,nlev) 305 305 ENDDO 306 306 c 307 307 c....................................................................... … … 311 311 c----------------------------------------------------------------------- 312 312 DO ilev=2,nlev-1 313 DO igrid=1,ngrid313 DO igrid=1,ngrid 314 314 c----------------------------------------------------------------------- 315 315 c … … 375 375 c 376 376 c----------------------------------------------------------------------- 377 377 ENDDO 378 378 ENDDO 379 379 c----------------------------------------------------------------------- … … 383 383 c....................................................................... 384 384 c 385 DO igrid=1,ngrid385 DO igrid=1,ngrid 386 386 kn(igrid,1)=knmin 387 387 km(igrid,1)=kmmin 388 388 kmpre(igrid,1)=km(igrid,1) 389 389 ENDDO 390 390 c 391 391 c----------------------------------------------------------------------- 392 392 DO ilev=2,nlev-1 393 DO igrid=1,ngrid393 DO igrid=1,ngrid 394 394 c----------------------------------------------------------------------- 395 395 c … … 401 401 c 402 402 c----------------------------------------------------------------------- 403 403 ENDDO 404 404 ENDDO 405 405 c----------------------------------------------------------------------- 406 406 c 407 DO igrid=1,ngrid407 DO igrid=1,ngrid 408 408 kn(igrid,nlev)=kn(igrid,nlev-1) 409 409 km(igrid,nlev)=km(igrid,nlev-1) 410 410 kmpre(igrid,nlev)=km(igrid,nlev) 411 411 ENDDO 412 412 c 413 413 c....................................................................... … … 418 418 DO 10001 ilev=2,nlev-1 419 419 c----> 420 DO 10002 igrid=1,ngrid 420 DO 10002 igrid=1,ngrid 421 421 c 422 422 c....................................................................... … … 539 539 c 540 540 c 541 DO igrid=1,ngrid541 DO igrid=1,ngrid 542 542 kn(igrid,1)=knmin 543 543 km(igrid,1)=kmmin … … 546 546 kn(igrid,nlev)=kn(igrid,nlev-1) 547 547 km(igrid,nlev)=km(igrid,nlev-1) 548 548 ENDDO 549 549 550 550 c -
trunk/LMDZ.GENERIC/libf/phystd/vdifc.F
r650 r787 9 9 use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol 10 10 use radcommon_h, only : sigma 11 USE surfdat_h 12 USE comgeomfi_h 13 USE tracer_h 11 14 12 15 implicit none … … 39 42 #include "comcstfi.h" 40 43 #include "callkeys.h" 41 #include "surfdat.h"42 #include "comgeomfi.h"43 #include "tracer.h"44 45 #include "watercap.h"46 44 47 45 ! arguments … … 78 76 integer ilev,ig,ilay,nlev 79 77 80 REAL z4st,zdplanck(ngrid mx)81 REAL zkv(ngrid mx,nlayermx+1),zkh(ngridmx,nlayermx+1)82 REAL zcdv(ngrid mx),zcdh(ngridmx)83 REAL zcdv_true(ngrid mx),zcdh_true(ngridmx)84 REAL zu(ngrid mx,nlayermx),zv(ngridmx,nlayermx)85 REAL zh(ngrid mx,nlayermx)86 REAL ztsrf2(ngrid mx)87 REAL z1(ngrid mx),z2(ngridmx)88 REAL za(ngrid mx,nlayermx),zb(ngridmx,nlayermx)89 REAL zb0(ngrid mx,nlayermx)90 REAL zc(ngrid mx,nlayermx),zd(ngridmx,nlayermx)78 REAL z4st,zdplanck(ngrid) 79 REAL zkv(ngrid,nlayermx+1),zkh(ngrid,nlayermx+1) 80 REAL zcdv(ngrid),zcdh(ngrid) 81 REAL zcdv_true(ngrid),zcdh_true(ngrid) 82 REAL zu(ngrid,nlayermx),zv(ngrid,nlayermx) 83 REAL zh(ngrid,nlayermx) 84 REAL ztsrf2(ngrid) 85 REAL z1(ngrid),z2(ngrid) 86 REAL za(ngrid,nlayermx),zb(ngrid,nlayermx) 87 REAL zb0(ngrid,nlayermx) 88 REAL zc(ngrid,nlayermx),zd(ngrid,nlayermx) 91 89 REAL zcst1 92 90 REAL zu2!, a 93 REAL zcq(ngrid mx,nlayermx),zdq(ngridmx,nlayermx)94 REAL evap(ngrid mx)95 REAL zcq0(ngrid mx),zdq0(ngridmx)96 REAL zx_alf1(ngrid mx),zx_alf2(ngridmx)91 REAL zcq(ngrid,nlayermx),zdq(ngrid,nlayermx) 92 REAL evap(ngrid) 93 REAL zcq0(ngrid),zdq0(ngrid) 94 REAL zx_alf1(ngrid),zx_alf2(ngrid) 97 95 98 96 LOGICAL firstcall … … 103 101 ! variables added for CO2 condensation 104 102 ! ------------------------------------ 105 REAL hh !, zhcond(ngrid mx,nlayermx)103 REAL hh !, zhcond(ngrid,nlayermx) 106 104 ! REAL latcond,tcond1mb 107 105 ! REAL acond,bcond … … 112 110 ! ------- 113 111 INTEGER iq 114 REAL zq(ngrid mx,nlayermx,nqmx)115 REAL zq1temp(ngrid mx)116 REAL rho(ngrid mx) ! near-surface air density117 REAL qsat(ngrid mx)112 REAL zq(ngrid,nlayermx,nq) 113 REAL zq1temp(ngrid) 114 REAL rho(ngrid) ! near-surface air density 115 REAL qsat(ngrid) 118 116 DATA firstcall/.true./ 119 117 REAL kmixmin … … 121 119 ! Variables added for implicit latent heat inclusion 122 120 ! -------------------------------------------------- 123 real latconst, dqsat(ngrid mx), qsat_temp1, qsat_temp2124 real z1_Tdry(ngrid mx), z2_Tdry(ngridmx)125 real z1_T(ngrid mx), z2_T(ngridmx)126 real zb_T(ngrid mx)127 real zc_T(ngrid mx,nlayermx)128 real zd_T(ngrid mx,nlayermx)129 real lat1(ngrid mx), lat2(ngridmx)121 real latconst, dqsat(ngrid), qsat_temp1, qsat_temp2 122 real z1_Tdry(ngrid), z2_Tdry(ngrid) 123 real z1_T(ngrid), z2_T(ngrid) 124 real zb_T(ngrid) 125 real zc_T(ngrid,nlayermx) 126 real zd_T(ngrid,nlayermx) 127 real lat1(ngrid), lat2(ngrid) 130 128 real surfh2otot 131 129 logical surffluxdiag … … 152 150 153 151 IF (firstcall) THEN 154 ! IF(ngrid.NE.ngridmx) THEN155 ! PRINT*,'STOP dans vdifc'156 ! PRINT*,'probleme de dimensions :'157 ! PRINT*,'ngrid =',ngrid158 ! PRINT*,'ngridmx =',ngridmx159 ! STOP160 ! ENDIF161 152 ! To compute: Tcond= 1./(bcond-acond*log(.0095*p)) (p in pascal) 162 153 ! bcond=1./tcond1mb … … 254 245 ! ------------------------------------------------------ 255 246 256 call vdif_kc( ptimestep,g,pzlev,pzlay247 call vdif_kc(ngrid,ptimestep,g,pzlev,pzlay 257 248 & ,pu,pv,ph,zcdv_true 258 249 & ,pq2,zkv,zkh) … … 442 433 ! Calculate vertical flux from the bottom to the first layer (dust) 443 434 ! ----------------------------------------------------------------- 444 do ig=1,ngrid mx435 do ig=1,ngrid 445 436 rho(ig) = zb0(ig,1) /ptimestep 446 437 end do -
trunk/LMDZ.GENERIC/libf/phystd/vlz_fi.F
r135 r787 35 35 c 36 36 37 real dzq(ngrid mx,llm),dzqw(ngridmx,llm),adzqw(ngridmx,llm),dzqmax37 real dzq(ngrid,llm),dzqw(ngrid,llm),adzqw(ngrid,llm),dzqmax 38 38 real newmasse 39 39 real sigw, Mtot, MQtot … … 90 90 91 91 do l = 1,llm ! loop different than when w<0 92 do ij =1,ngrid92 do ij=1,ngrid 93 93 94 94 if(w(ij,l).gt.0.)then … … 133 133 134 134 c Surface flux up: 135 do ij =1,ngrid135 do ij=1,ngrid 136 136 if(w(ij,1).lt.0.) wq(ij,1)=0. ! warning : not always valid 137 137 end do 138 138 139 139 do l = 1,llm-1 ! loop different than when w>0 140 do ij =1,ngrid140 do ij=1,ngrid 141 141 if(w(ij,l+1).le.0)then 142 142 -
trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
r526 r787 39 39 ! 40 40 !================================================================= 41 42 USE surfdat_h 41 43 42 44 implicit none … … 52 54 #include "netcdf.inc" 53 55 #include "temps.h" 54 #include "surfdat.h"55 56 56 57 ! Arguments on input: … … 95 96 character(len=20),save :: nom_def(n_nom_def_max) 96 97 logical,save :: firstcall=.true. 97 98 #ifndef MESOSCALE 98 99 99 !*************************************************************** 100 100 !Sortie des variables au rythme voulu … … 108 108 !*************************************************************** 109 109 110 #ifndef NOWRITEDIAGFI 111 110 112 ! At very first call, check if there is a "diagfi.def" to use and read it 111 113 ! ----------------------------------------------------------------------- … … 113 115 firstcall=.false. 114 116 115 117 ! Open diagfi.def definition file if there is one: 116 118 open(99,file="diagfi.def",status='old',form='formatted', 117 119 s iostat=ierr2) … … 192 194 endif ! if (firstnom.eq.'1234567890') 193 195 194 if (ngrid mx.eq.1) then196 if (ngrid.eq.1) then 195 197 ! in testphys1d, for the 1d version of the GCM, iphysiq and irythme 196 198 ! are undefined; so set them to 1 … … 448 450 449 451 #endif 452 450 453 end -
trunk/LMDZ.GENERIC/libf/phystd/writediagsoil.F90
r135 r787 10 10 ! (yielding the sought time series of the variable) 11 11 12 use comsoil_h 13 12 14 implicit none 13 15 … … 16 18 #include"paramet.h" 17 19 #include"control.h" 18 #include"comsoil.h"19 20 #include"netcdf.inc" 20 21 … … 78 79 79 80 ! Define dimensions and axis attributes 80 call iniwritesoil(nid )81 call iniwritesoil(nid,ngrid) 81 82 82 83 ! set zitau to -1 to be compatible with zitau incrementation step below -
trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F
r533 r787 43 43 ! Addition by RW (2010) to allow OLR to be saved in .nc format 44 44 use radinc_h, only : L_NSPECTI 45 USE surfdat_h 45 46 46 47 implicit none … … 56 57 #include "netcdf.inc" 57 58 #include "temps.h" 58 #include "surfdat.h"59 59 #include "callkeys.h" 60 60 -
trunk/LMDZ.GENERIC/libf/phystd/writediagspecVI.F
r533 r787 43 43 ! Addition by RW (2010) to allow OSR to be saved in .nc format 44 44 use radinc_h, only : L_NSPECTV 45 USE surfdat_h 45 46 46 47 implicit none … … 56 57 #include "netcdf.inc" 57 58 #include "temps.h" 58 #include "surfdat.h"59 59 #include "callkeys.h" 60 60
Note: See TracChangeset
for help on using the changeset viewer.