Changeset 2594 for LMDZ5/branches/testing/libf
- Timestamp:
- Jul 18, 2016, 9:41:10 PM (8 years ago)
- Location:
- LMDZ5/branches/testing
- Files:
-
- 44 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/branches/testing
- Property svn:mergeinfo changed
/LMDZ5/trunk merged: 2547-2567,2569,2571-2574,2576-2589
- Property svn:mergeinfo changed
-
LMDZ5/branches/testing/libf/dyn3d_common/infotrac.F90
r2408 r2594 86 86 INTEGER, ALLOCATABLE, DIMENSION(:) :: hadv ! index of horizontal trasport schema 87 87 INTEGER, ALLOCATABLE, DIMENSION(:) :: vadv ! index of vertical trasport schema 88 89 INTEGER, ALLOCATABLE, DIMENSION(:) :: hadv_inca ! index of horizontal trasport schema 90 INTEGER, ALLOCATABLE, DIMENSION(:) :: vadv_inca ! index of vertical trasport schema 88 91 89 92 CHARACTER(len=15), ALLOCATABLE, DIMENSION(:) :: tnom_0 ! tracer short name … … 205 208 #endif 206 209 nqtrue=nbtr+nqo 210 211 ALLOCATE(hadv_inca(nbtr), vadv_inca(nbtr)) 212 207 213 END IF ! type_trac 208 214 !>jyg … … 226 232 ! 227 233 ALLOCATE(tnom_0(nqtrue), hadv(nqtrue), vadv(nqtrue),tnom_transp(nqtrue)) 234 228 235 ! 229 236 !jyg< … … 375 382 !>jyg 376 383 ! le module de chimie fournit les noms des traceurs 377 ! et les schemas d'advection associes. 378 384 ! et les schemas d'advection associes. excepte pour ceux lus 385 ! dans traceur.def 386 IF (ierr .eq. 0) then 387 DO iq=1,nqo 388 389 write(*,*) 'infotrac 237: iq=',iq 390 ! CRisi: ajout du nom du fluide transporteur 391 ! mais rester retro compatible 392 READ(90,'(I2,X,I2,X,A)',IOSTAT=IOstatus) hadv(iq),vadv(iq),tchaine 393 write(lunout,*) 'iq,hadv(iq),vadv(iq)=',iq,hadv(iq),vadv(iq) 394 write(lunout,*) 'tchaine=',trim(tchaine) 395 write(*,*) 'infotrac 238: IOstatus=',IOstatus 396 if (IOstatus.ne.0) then 397 CALL abort_gcm('infotrac_init','Pb dans la lecture de traceur.def',1) 398 endif 399 ! Y-a-t-il 1 ou 2 noms de traceurs? -> On regarde s'il y a un 400 ! espace ou pas au milieu de la chaine. 401 continu=.true. 402 nouveau_traceurdef=.false. 403 iiq=1 404 do while (continu) 405 if (tchaine(iiq:iiq).eq.' ') then 406 nouveau_traceurdef=.true. 407 continu=.false. 408 else if (iiq.lt.LEN_TRIM(tchaine)) then 409 iiq=iiq+1 410 else 411 continu=.false. 412 endif 413 enddo 414 write(*,*) 'iiq,nouveau_traceurdef=',iiq,nouveau_traceurdef 415 if (nouveau_traceurdef) then 416 write(lunout,*) 'C''est la nouvelle version de traceur.def' 417 tnom_0(iq)=tchaine(1:iiq-1) 418 tnom_transp(iq)=tchaine(iiq+1:15) 419 else 420 write(lunout,*) 'C''est l''ancienne version de traceur.def' 421 write(lunout,*) 'On suppose que les traceurs sont tous d''air' 422 tnom_0(iq)=tchaine 423 tnom_transp(iq) = 'air' 424 endif 425 write(lunout,*) 'tnom_0(iq)=<',trim(tnom_0(iq)),'>' 426 write(lunout,*) 'tnom_transp(iq)=<',trim(tnom_transp(iq)),'>' 427 428 END DO !DO iq=1,nqtrue 429 CLOSE(90) 430 ELSE !! if traceur.def doesn't exist 431 tnom_0(1)='H2Ov' 432 tnom_transp(1) = 'air' 433 tnom_0(2)='H2Ol' 434 tnom_transp(2) = 'air' 435 hadv(1) = 10 436 hadv(2) = 10 437 vadv(1) = 10 438 vadv(2) = 10 439 ENDIF 440 379 441 #ifdef INCA 380 442 CALL init_transport( & 381 hadv , &382 vadv , &443 hadv_inca, & 444 vadv_inca, & 383 445 conv_flg, & 384 446 pbl_flg, & 385 447 solsym) 386 448 #endif 387 tnom_0(1)='H2Ov' 388 tnom_transp(1) = 'air' 389 tnom_0(2)='H2Ol' 390 tnom_transp(2) = 'air' 391 IF (nqo == 3) then 392 tnom_0(3)='H2Oi' !! jyg 393 tnom_transp(3) = 'air' 394 endif 449 395 450 396 451 !jyg< 397 452 DO iq = nqo+1, nqtrue 453 hadv(iq) = hadv_inca(iq-nqo) 454 vadv(iq) = vadv_inca(iq-nqo) 398 455 tnom_0(iq)=solsym(iq-nqo) 399 456 tnom_transp(iq) = 'air' 400 457 END DO 401 !! DO iq =3,nqtrue402 !! tnom_0(iq)=solsym(iq-2)403 !! END DO404 !! nqo = 2405 !>jyg406 458 407 459 END IF ! (type_trac == 'inca') -
LMDZ5/branches/testing/libf/dyn3dmem/dynredem_loc.F90
r2408 r2594 235 235 236 236 !--- Tracers in file "start_trac.nc" (added by Anne) 237 lread_inca=.FALSE. 237 238 !$OMP MASTER 238 lread_inca=.FALSE.;fil="start_trac.nc"239 fil="start_trac.nc" 239 240 IF(type_trac=='inca') INQUIRE(FILE=fil,EXIST=lread_inca) 240 241 IF(lread_inca) CALL err(NF90_OPEN(fil,NF90_NOWRITE,nid_trac),"open") -
LMDZ5/branches/testing/libf/dynphy_lonlat/phydev/iniphysiq_mod.F90
r2435 r2594 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE mod_grid_phy_lmdz, ONLY: klon_glo, & ! number of atmospheric columns (on full grid) 15 regular_lonlat ! regular longitude-latitude grid type 16 USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) 17 klon_omp_begin, & ! start index of local omp subgrid 18 klon_omp_end, & ! end index of local omp subgrid 19 klon_mpi_begin ! start indes of columns (on local mpi grid) 20 USE geometry_mod, ONLY : init_geometry 14 USE inigeomphy_mod, ONLY: inigeomphy 15 USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) 21 16 USE infotrac, ONLY: nqtot, type_trac 22 17 USE infotrac_phy, ONLY: init_infotrac_phy 23 ! USE comcstphy, ONLY: rradius, & ! planet radius (m)24 ! rr, & ! recuced gas constant: R/molar mass of atm25 ! rg, & ! gravity26 ! rcpp ! specific heat of the atmosphere27 18 USE inifis_mod, ONLY: inifis 28 19 USE phyaqua_mod, ONLY: iniaqua 29 USE physics_distribution_mod, ONLY : init_physics_distribution30 USE regular_lonlat_mod, ONLY : init_regular_lonlat, &31 east, west, north, south, &32 north_east, north_west, &33 south_west, south_east34 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys35 20 USE nrtype, ONLY: pi 36 21 IMPLICIT NONE … … 69 54 CHARACTER (LEN=20) :: modname='iniphysiq' 70 55 CHARACTER (LEN=80) :: abort_message 71 REAL :: total_area_phy, total_area_dyn72 56 73 ! boundaries, on global grid74 REAL,ALLOCATABLE :: boundslon_reg(:,:)75 REAL,ALLOCATABLE :: boundslat_reg(:,:)76 57 77 ! global array, on full physics grid: 78 REAL,ALLOCATABLE :: latfi_glo(:) 79 REAL,ALLOCATABLE :: lonfi_glo(:) 80 REAL,ALLOCATABLE :: cufi_glo(:) 81 REAL,ALLOCATABLE :: cvfi_glo(:) 82 REAL,ALLOCATABLE :: airefi_glo(:) 83 REAL,ALLOCATABLE :: boundslonfi_glo(:,:) 84 REAL,ALLOCATABLE :: boundslatfi_glo(:,:) 58 ! --> initialize physics distribution, global fields and geometry 59 ! (i.e. things in phy_common or dynphy_lonlat) 60 CALL inigeomphy(iim,jjm,nlayer, & 61 nbp, communicator, & 62 rlatu,rlatv, & 63 rlonu,rlonv, & 64 aire,cu,cv) 85 65 86 ! local arrays, on given MPI/OpenMP domain: 87 REAL,ALLOCATABLE,SAVE :: latfi(:) 88 REAL,ALLOCATABLE,SAVE :: lonfi(:) 89 REAL,ALLOCATABLE,SAVE :: cufi(:) 90 REAL,ALLOCATABLE,SAVE :: cvfi(:) 91 REAL,ALLOCATABLE,SAVE :: airefi(:) 92 REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:) 93 REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:) 94 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi) 95 96 ! Initialize Physics distibution and parameters and interface with dynamics 97 CALL init_physics_distribution(regular_lonlat,4, & 98 nbp,iim,jjm+1,nlayer,communicator) 99 CALL init_interface_dyn_phys 100 101 ! init regular global longitude-latitude grid points and boundaries 102 ALLOCATE(boundslon_reg(iim,2)) 103 ALLOCATE(boundslat_reg(jjm+1,2)) 104 105 DO i=1,iim 106 boundslon_reg(i,east)=rlonu(i) 107 boundslon_reg(i,west)=rlonu(i+1) 108 ENDDO 109 110 boundslat_reg(1,north)= PI/2 111 boundslat_reg(1,south)= rlatv(1) 112 DO j=2,jjm 113 boundslat_reg(j,north)=rlatv(j-1) 114 boundslat_reg(j,south)=rlatv(j) 115 ENDDO 116 boundslat_reg(jjm+1,north)= rlatv(jjm) 117 boundslat_reg(jjm+1,south)= -PI/2 118 119 ! Write values in module regular_lonlat_mod 120 CALL init_regular_lonlat(iim,jjm+1, rlonv(1:iim), rlatu, & 121 boundslon_reg, boundslat_reg) 122 123 ! Generate global arrays on full physics grid 124 ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo)) 125 ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo)) 126 ALLOCATE(airefi_glo(klon_glo)) 127 ALLOCATE(boundslonfi_glo(klon_glo,4)) 128 ALLOCATE(boundslatfi_glo(klon_glo,4)) 129 130 ! North pole 131 latfi_glo(1)=rlatu(1) 132 lonfi_glo(1)=0. 133 cufi_glo(1) = cu(1) 134 cvfi_glo(1) = cv(1) 135 boundslonfi_glo(1,north_east)=0 136 boundslatfi_glo(1,north_east)=PI/2 137 boundslonfi_glo(1,north_west)=2*PI 138 boundslatfi_glo(1,north_west)=PI/2 139 boundslonfi_glo(1,south_west)=2*PI 140 boundslatfi_glo(1,south_west)=rlatv(1) 141 boundslonfi_glo(1,south_east)=0 142 boundslatfi_glo(1,south_east)=rlatv(1) 143 DO j=2,jjm 144 DO i=1,iim 145 k=(j-2)*iim+1+i 146 latfi_glo(k)= rlatu(j) 147 lonfi_glo(k)= rlonv(i) 148 cufi_glo(k) = cu((j-1)*(iim+1)+i) 149 cvfi_glo(k) = cv((j-1)*(iim+1)+i) 150 boundslonfi_glo(k,north_east)=rlonu(i) 151 boundslatfi_glo(k,north_east)=rlatv(j-1) 152 boundslonfi_glo(k,north_west)=rlonu(i+1) 153 boundslatfi_glo(k,north_west)=rlatv(j-1) 154 boundslonfi_glo(k,south_west)=rlonu(i+1) 155 boundslatfi_glo(k,south_west)=rlatv(j) 156 boundslonfi_glo(k,south_east)=rlonu(i) 157 boundslatfi_glo(k,south_east)=rlatv(j) 158 ENDDO 159 ENDDO 160 ! South pole 161 latfi_glo(klon_glo)= rlatu(jjm+1) 162 lonfi_glo(klon_glo)= 0. 163 cufi_glo(klon_glo) = cu((iim+1)*jjm+1) 164 cvfi_glo(klon_glo) = cv((iim+1)*jjm-iim) 165 boundslonfi_glo(klon_glo,north_east)= 0 166 boundslatfi_glo(klon_glo,north_east)= rlatv(jjm) 167 boundslonfi_glo(klon_glo,north_west)= 2*PI 168 boundslatfi_glo(klon_glo,north_west)= rlatv(jjm) 169 boundslonfi_glo(klon_glo,south_west)= 2*PI 170 boundslatfi_glo(klon_glo,south_west)= -PI/2 171 boundslonfi_glo(klon_glo,south_east)= 0 172 boundslatfi_glo(klon_glo,south_east)= -Pi/2 173 174 ! build airefi(), mesh area on physics grid 175 CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi_glo) 176 ! Poles are single points on physics grid 177 airefi_glo(1)=sum(aire(1:iim,1)) 178 airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1)) 179 180 ! Sanity check: do total planet area match between physics and dynamics? 181 total_area_dyn=sum(aire(1:iim,1:jjm+1)) 182 total_area_phy=sum(airefi_glo(1:klon_glo)) 183 IF (total_area_dyn/=total_area_phy) THEN 184 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!' 185 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn 186 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy 187 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN 188 ! stop here if the relative difference is more than 0.001% 189 abort_message = 'planet total surface discrepancy' 190 CALL abort_gcm(modname, abort_message, 1) 191 ENDIF 192 ENDIF 66 ! --> now initialize things specific to the phydev physics package 193 67 194 68 !$OMP PARALLEL 195 ! Now generate local lon/lat/cu/cv/area/bounds arrays196 ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))197 ALLOCATE(airefi(klon_omp))198 ALLOCATE(boundslonfi(klon_omp,4))199 ALLOCATE(boundslatfi(klon_omp,4))200 201 202 offset = klon_mpi_begin - 1203 airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)204 cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)205 cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)206 lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)207 latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)208 boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)209 boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)210 211 ! copy over local grid longitudes and latitudes212 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &213 airefi,cufi,cvfi)214 69 215 70 ! Initialize physical constants in physics: -
LMDZ5/branches/testing/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90
r2471 r2594 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE mod_grid_phy_lmdz, ONLY: klon_glo, & ! number of atmospheric columns (on full grid) 15 regular_lonlat, & ! regular longitude-latitude grid type 16 nbp_lon, nbp_lat, nbp_lev 17 USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) 18 klon_omp_begin, & ! start index of local omp subgrid 19 klon_omp_end, & ! end index of local omp subgrid 20 klon_mpi_begin ! start indes of columns (on local mpi grid) 21 USE geometry_mod, ONLY : init_geometry 14 USE inigeomphy_mod, ONLY: inigeomphy 15 USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns (on full grid) 16 USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) 22 17 USE vertical_layers_mod, ONLY : init_vertical_layers 23 18 USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,& … … 39 34 USE phystokenc_mod, ONLY: init_phystokenc 40 35 USE phyaqua_mod, ONLY: iniaqua 41 USE physics_distribution_mod, ONLY : init_physics_distribution42 USE regular_lonlat_mod, ONLY : init_regular_lonlat, &43 east, west, north, south, &44 north_east, north_west, &45 south_west, south_east46 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys47 36 #ifdef INCA 48 37 USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic … … 92 81 CHARACTER (LEN=20) :: modname = 'iniphysiq' 93 82 CHARACTER (LEN=80) :: abort_message 94 REAL :: total_area_phy, total_area_dyn95 83 96 ! boundaries, on global grid97 REAL,ALLOCATABLE :: boundslon_reg(:,:)98 REAL,ALLOCATABLE :: boundslat_reg(:,:)99 100 ! global array, on full physics grid:101 REAL,ALLOCATABLE :: latfi_glo(:)102 REAL,ALLOCATABLE :: lonfi_glo(:)103 REAL,ALLOCATABLE :: cufi_glo(:)104 REAL,ALLOCATABLE :: cvfi_glo(:)105 REAL,ALLOCATABLE :: airefi_glo(:)106 REAL,ALLOCATABLE :: boundslonfi_glo(:,:)107 REAL,ALLOCATABLE :: boundslatfi_glo(:,:)108 109 ! local arrays, on given MPI/OpenMP domain:110 REAL,ALLOCATABLE,SAVE :: latfi(:)111 REAL,ALLOCATABLE,SAVE :: lonfi(:)112 REAL,ALLOCATABLE,SAVE :: cufi(:)113 REAL,ALLOCATABLE,SAVE :: cvfi(:)114 REAL,ALLOCATABLE,SAVE :: airefi(:)115 REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)116 REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)117 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)118 84 119 85 #ifndef CPP_PARA … … 123 89 #endif 124 90 125 ! Initialize Physics distibution and parameters and interface with dynamics126 IF (ii*jj>1) THEN ! general 3D case127 CALL init_physics_distribution(regular_lonlat,4, &128 nbp,ii,jj+1,nlayer,communicator)129 ELSE ! For 1D model130 CALL init_physics_distribution(regular_lonlat,4, &131 1,1,1,nlayer,communicator)132 ENDIF 133 CALL init_interface_dyn_phys91 ! --> initialize physics distribution, global fields and geometry 92 ! (i.e. things in phy_common or dynphy_lonlat) 93 CALL inigeomphy(ii,jj,nlayer, & 94 nbp, communicator, & 95 rlatu,rlatv, & 96 rlonu,rlonv, & 97 aire,cu,cv) 98 99 ! --> now initialize things specific to the phylmd physics package 134 100 135 ! init regular global longitude-latitude grid points and boundaries136 ALLOCATE(boundslon_reg(ii,2))137 ALLOCATE(boundslat_reg(jj+1,2))138 139 DO i=1,ii140 boundslon_reg(i,east)=rlonu(i)141 boundslon_reg(i,west)=rlonu(i+1)142 ENDDO143 144 boundslat_reg(1,north)= PI/2145 boundslat_reg(1,south)= rlatv(1)146 DO j=2,jj147 boundslat_reg(j,north)=rlatv(j-1)148 boundslat_reg(j,south)=rlatv(j)149 ENDDO150 boundslat_reg(jj+1,north)= rlatv(jj)151 boundslat_reg(jj+1,south)= -PI/2152 153 ! Write values in module regular_lonlat_mod154 CALL init_regular_lonlat(ii,jj+1, rlonv(1:ii), rlatu, &155 boundslon_reg, boundslat_reg)156 157 ! Generate global arrays on full physics grid158 ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))159 ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))160 ALLOCATE(airefi_glo(klon_glo))161 ALLOCATE(boundslonfi_glo(klon_glo,4))162 ALLOCATE(boundslatfi_glo(klon_glo,4))163 164 165 IF (klon_glo>1) THEN ! general case166 ! North pole167 latfi_glo(1)=rlatu(1)168 lonfi_glo(1)=0.169 cufi_glo(1) = cu(1)170 cvfi_glo(1) = cv(1)171 boundslonfi_glo(1,north_east)=0172 boundslatfi_glo(1,north_east)=PI/2173 boundslonfi_glo(1,north_west)=2*PI174 boundslatfi_glo(1,north_west)=PI/2175 boundslonfi_glo(1,south_west)=2*PI176 boundslatfi_glo(1,south_west)=rlatv(1)177 boundslonfi_glo(1,south_east)=0178 boundslatfi_glo(1,south_east)=rlatv(1)179 DO j=2,jj180 DO i=1,ii181 k=(j-2)*ii+1+i182 latfi_glo(k)= rlatu(j)183 lonfi_glo(k)= rlonv(i)184 cufi_glo(k) = cu((j-1)*(ii+1)+i)185 cvfi_glo(k) = cv((j-1)*(ii+1)+i)186 boundslonfi_glo(k,north_east)=rlonu(i)187 boundslatfi_glo(k,north_east)=rlatv(j-1)188 boundslonfi_glo(k,north_west)=rlonu(i+1)189 boundslatfi_glo(k,north_west)=rlatv(j-1)190 boundslonfi_glo(k,south_west)=rlonu(i+1)191 boundslatfi_glo(k,south_west)=rlatv(j)192 boundslonfi_glo(k,south_east)=rlonu(i)193 boundslatfi_glo(k,south_east)=rlatv(j)194 ENDDO195 ENDDO196 ! South pole197 latfi_glo(klon_glo)= rlatu(jj+1)198 lonfi_glo(klon_glo)= 0.199 cufi_glo(klon_glo) = cu((ii+1)*jj+1)200 cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)201 boundslonfi_glo(klon_glo,north_east)= 0202 boundslatfi_glo(klon_glo,north_east)= rlatv(jj)203 boundslonfi_glo(klon_glo,north_west)= 2*PI204 boundslatfi_glo(klon_glo,north_west)= rlatv(jj)205 boundslonfi_glo(klon_glo,south_west)= 2*PI206 boundslatfi_glo(klon_glo,south_west)= -PI/2207 boundslonfi_glo(klon_glo,south_east)= 0208 boundslatfi_glo(klon_glo,south_east)= -Pi/2209 210 ! build airefi_glo(), mesh area on physics grid211 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)212 ! Poles are single points on physics grid213 airefi_glo(1)=sum(aire(1:ii,1))214 airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))215 216 ! Sanity check: do total planet area match between physics and dynamics?217 total_area_dyn=sum(aire(1:ii,1:jj+1))218 total_area_phy=sum(airefi_glo(1:klon_glo))219 IF (total_area_dyn/=total_area_phy) THEN220 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'221 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn222 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy223 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN224 ! stop here if the relative difference is more than 0.001%225 abort_message = 'planet total surface discrepancy'226 CALL abort_gcm(modname, abort_message, 1)227 ENDIF228 ENDIF229 ELSE ! klon_glo==1, running the 1D model230 ! just copy over input values231 latfi_glo(1)=rlatu(1)232 lonfi_glo(1)=rlonv(1)233 cufi_glo(1)=cu(1)234 cvfi_glo(1)=cv(1)235 airefi_glo(1)=aire(1,1)236 boundslonfi_glo(1,north_east)=rlonu(1)237 boundslatfi_glo(1,north_east)=PI/2238 boundslonfi_glo(1,north_west)=rlonu(2)239 boundslatfi_glo(1,north_west)=PI/2240 boundslonfi_glo(1,south_west)=rlonu(2)241 boundslatfi_glo(1,south_west)=rlatv(1)242 boundslonfi_glo(1,south_east)=rlonu(1)243 boundslatfi_glo(1,south_east)=rlatv(1)244 ENDIF ! of IF (klon_glo>1)245 246 101 !$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) 247 ! Now generate local lon/lat/cu/cv/area/bounds arrays248 ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))249 ALLOCATE(airefi(klon_omp))250 ALLOCATE(boundslonfi(klon_omp,4))251 ALLOCATE(boundslatfi(klon_omp,4))252 253 254 offset = klon_mpi_begin - 1255 airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)256 cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)257 cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)258 lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)259 latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)260 boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)261 boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)262 263 ! copy over local grid longitudes and latitudes264 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &265 airefi,cufi,cvfi)266 102 267 103 ! copy over preff , ap(), bp(), etc -
LMDZ5/branches/testing/libf/dynphy_lonlat/phylmd/limit_netcdf.F90
r2542 r2594 117 117 ALLOCATE(pctsrf(klon,nbsrf)) 118 118 CALL start_init_subsurf(.FALSE.) 119 !--- TO MATCH EXACTLY WHAT WOULD BE DONE IN etat0phys_netcdf 120 WHERE( masque(:,:)<EPSFRA) masque(:,:)=0. 121 WHERE(1.-masque(:,:)<EPSFRA) masque(:,:)=1. 119 122 END IF 120 123 … … 336 339 REAL, ALLOCATABLE :: champan(:,:,:) 337 340 !--- input files 341 CHARACTER(LEN=20) :: fnam_m, fnam_p ! previous/next files names 338 342 CHARACTER(LEN=20) :: cal_in ! calendar 339 343 CHARACTER(LEN=20) :: unit_sic ! attribute unit in sea-ice file … … 345 349 LOGICAL :: extrp ! flag for extrapolation 346 350 REAL :: chmin, chmax 347 INTEGER ierr 351 INTEGER ierr, idx 348 352 integer n_extrap ! number of extrapolated points 349 353 logical skip … … 360 364 END SELECT 361 365 extrp=.FALSE.; IF(PRESENT(flag).AND.mode=='SST') extrp=flag 366 idx=INDEX(fnam,'.nc')-1 362 367 363 368 !--- GETTING SOME DIMENSIONAL VARIABLES FROM FILE ----------------------------- … … 393 398 !--- Time (variable is not needed - it is rebuilt - but calendar is) 394 399 CALL ncerr(NF90_INQUIRE_DIMENSION(ncid, dids(3), name=dnam, len=lmdep), fnam) 395 ALLOCATE(timeyear( MAX(lmdep,14)))400 ALLOCATE(timeyear(lmdep+2)) 396 401 CALL ncerr(NF90_INQ_VARID(ncid, dnam, varid), fnam) 397 402 cal_in=' ' … … 412 417 IF(lmdep==12) THEN 413 418 timeyear=mid_month(anneeref, cal_in, ndays_in) 414 CALL msg(0,'Monthly periodic input file (perpetual run).') 415 ELSE IF(lmdep==14) THEN 416 timeyear=mid_month(anneeref, cal_in, ndays_in) 417 CALL msg(0,'Monthly 14-records input file (interannual run).') 419 CALL msg(0,'Monthly input file(s) for '//TRIM(title)//'.') 418 420 ELSE IF(lmdep==ndays_in) THEN 419 timeyear=[(REAL(k)-0.5,k= 1,ndays_in)]421 timeyear=[(REAL(k)-0.5,k=0,ndays_in+1)] 420 422 CALL msg(0,'Daily input file (no time interpolation).') 421 423 ELSE 422 424 WRITE(mess,'(a,i3,a,i3,a)')'Mismatching input file: found',lmdep, & 423 ' records, 12/ 14/',ndays_in,' (periodic/interannual/daily) needed'425 ' records, 12/',ndays_in,' (monthly/daily needed).' 424 426 CALL abort_physic('mid_months',TRIM(mess),1) 425 427 END IF 426 428 427 429 !--- GETTING THE FIELD AND INTERPOLATING IT ---------------------------------- 428 ALLOCATE(champ(imdep, jmdep), champtime(iim, jjp1, MAX(lmdep,14)))430 ALLOCATE(champ(imdep, jmdep), champtime(iim, jjp1, lmdep+2)) 429 431 IF(extrp) ALLOCATE(work(imdep, jmdep)) 430 432 CALL msg(5,'') … … 446 448 WHERE(NINT(mask)/=1) champint=0.001 447 449 END IF 448 !--- Special case for periodic input file: index shifted 449 ll = l; IF(lmdep==12) ll = l + 1 450 champtime(:, :, ll)=champint 450 champtime(:, :, l+1)=champint 451 451 END DO 452 IF(lmdep==12) THEN453 champtime(:,:, 1)=champtime(:,:,13)454 champtime(:,:,14)=champtime(:,:, 2)455 END IF456 452 CALL ncerr(NF90_CLOSE(ncid), fnam) 457 453 454 !--- FIRST RECORD: LAST ONE OF PREVIOUS YEAR (CURRENT YEAR IF UNAVAILABLE) 455 fnam_m=fnam(1:idx)//'_m.nc' 456 IF(NF90_OPEN(fnam_m,NF90_NOWRITE,ncid)==NF90_NOERR) THEN 457 CALL msg(0,'Reading previous year file ("'//TRIM(fnam_m)//'") last record for '//TRIM(title)) 458 CALL ncerr(NF90_INQ_VARID(ncid, varname, varid),fnam_m) 459 CALL ncerr(NF90_INQUIRE_VARIABLE(ncid, varid, dimids=dids),fnam_m) 460 CALL ncerr(NF90_INQUIRE_DIMENSION(ncid, dids(3), len=l), fnam_m) 461 CALL ncerr(NF90_GET_VAR(ncid,varid,champ,[1,1,l],[imdep,jmdep,1]),fnam_m) 462 CALL ncerr(NF90_CLOSE(ncid), fnam_m) 463 CALL conf_dat2d(title, dlon_ini, dlat_ini, dlon, dlat, champ, .TRUE.) 464 IF(extrp) CALL extrapol(champ,imdep,jmdep,999999.,.TRUE.,.TRUE.,2,work) 465 IF(mode=='RUG') champ=LOG(champ) 466 CALL inter_barxy(dlon,dlat(:jmdep-1),champ,rlonu(:iim),rlatv,champint) 467 IF(mode=='RUG') THEN 468 champint=EXP(champint) 469 WHERE(NINT(mask)/=1) champint=0.001 470 END IF 471 champtime(:, :, 1)=champint 472 ELSE 473 CALL msg(0,'Using current year file ("'//TRIM(fnam)//'") last record for '//TRIM(title)) 474 champtime(:, :, 1)=champtime(:, :, lmdep+1) 475 END IF 476 477 !--- LAST RECORD: FIRST ONE OF NEXT YEAR (CURRENT YEAR IF UNAVAILABLE) 478 fnam_p=fnam(1:idx)//'_p.nc' 479 IF(NF90_OPEN(fnam_p,NF90_NOWRITE,ncid)==NF90_NOERR) THEN 480 CALL msg(0,'Reading previous year file ("'//TRIM(fnam_p)//'") first record for '//TRIM(title)) 481 CALL ncerr(NF90_INQ_VARID(ncid, varname, varid),fnam_p) 482 CALL ncerr(NF90_GET_VAR(ncid,varid,champ,[1,1,1],[imdep,jmdep,1]),fnam_p) 483 CALL ncerr(NF90_CLOSE(ncid), fnam_p) 484 CALL conf_dat2d(title, dlon_ini, dlat_ini, dlon, dlat, champ, .TRUE.) 485 IF(extrp) CALL extrapol(champ,imdep,jmdep,999999.,.TRUE.,.TRUE.,2,work) 486 IF(mode=='RUG') champ=LOG(champ) 487 CALL inter_barxy(dlon,dlat(:jmdep-1),champ,rlonu(:iim),rlatv,champint) 488 IF(mode=='RUG') THEN 489 champint=EXP(champint) 490 WHERE(NINT(mask)/=1) champint=0.001 491 END IF 492 champtime(:, :, lmdep+2)=champint 493 ELSE 494 CALL msg(0,'Using current year file ("'//TRIM(fnam)//'") first record for '//TRIM(title)) 495 champtime(:, :, lmdep+2)=champtime(:, :, 2) 496 END IF 458 497 DEALLOCATE(dlon_ini, dlat_ini, dlon, dlat, champ) 459 498 IF(extrp) DEALLOCATE(work) … … 477 516 END IF 478 517 END IF 479 ALLOCATE(yder( MAX(lmdep,14)), champan(iip1, jjp1, ndays))518 ALLOCATE(yder(lmdep+2), champan(iip1, jjp1, ndays)) 480 519 IF(lmdep==ndays_in) THEN 481 520 champan(1:iim,:,:)=champtime … … 546 585 ! 547 586 !------------------------------------------------------------------------------- 587 USE grid_noro_m, ONLY: grid_noro0 548 588 IMPLICIT NONE 549 589 !=============================================================================== … … 599 639 600 640 END SUBROUTINE start_init_orog0 601 !602 !-------------------------------------------------------------------------------603 604 605 !-------------------------------------------------------------------------------606 !607 SUBROUTINE grid_noro0(xd,yd,zd,x,y,zphi,mask)608 !609 !===============================================================================610 ! Purpose: Extracted from grid_noro to provide geopotential height for dynamics611 ! without any call to physics subroutines.612 !===============================================================================613 IMPLICIT NONE614 !-------------------------------------------------------------------------------615 ! Arguments:616 REAL, INTENT(IN) :: xd(:), yd(:) !--- INPUT COORDINATES (imdp) (jmdp)617 REAL, INTENT(IN) :: zd(:,:) !--- INPUT FIELD (imdp,jmdp)618 REAL, INTENT(IN) :: x(:), y(:) !--- OUTPUT COORDINATES (imar+1) (jmar)619 REAL, INTENT(OUT) :: zphi(:,:) !--- GEOPOTENTIAL (imar+1,jmar)620 REAL, INTENT(INOUT):: mask(:,:) !--- MASK (imar+1,jmar)621 !-------------------------------------------------------------------------------622 ! Local variables:623 CHARACTER(LEN=256) :: modname="grid_noro0"624 REAL, ALLOCATABLE :: xusn(:), yusn(:) ! dim (imdp+2*iext) (jmdp+2)625 REAL, ALLOCATABLE :: zusn(:,:) ! dim (imdp+2*iext,jmdp+2)626 REAL, ALLOCATABLE :: weight(:,:) ! dim (imar+1,jmar)627 REAL, ALLOCATABLE :: mask_tmp(:,:), zmea(:,:) ! dim (imar+1,jmar)628 REAL, ALLOCATABLE :: num_tot(:,:), num_lan(:,:) ! dim (imax,jmax)629 REAL, ALLOCATABLE :: a(:), b(:) ! dim (imax)630 REAL, ALLOCATABLE :: c(:), d(:) ! dim (jmax)631 LOGICAL :: masque_lu632 INTEGER :: i, ii, imdp, imar, iext633 INTEGER :: j, jj, jmdp, jmar, nn634 REAL :: xpi, zlenx, weighx, xincr, zbordnor, zmeanor, zweinor, zbordest635 REAL :: rad, zleny, weighy, masque, zbordsud, zmeasud, zweisud, zbordoue636 !-------------------------------------------------------------------------------637 imdp=assert_eq(SIZE(xd),SIZE(zd,1),TRIM(modname)//" imdp")638 jmdp=assert_eq(SIZE(yd),SIZE(zd,2),TRIM(modname)//" jmdp")639 imar=assert_eq(SIZE(x),SIZE(zphi,1),SIZE(mask,1),TRIM(modname)//" imar")-1640 jmar=assert_eq(SIZE(y),SIZE(zphi,2),SIZE(mask,2),TRIM(modname)//" jmar")641 IF(imar/=iim) CALL abort_gcm(TRIM(modname),'imar/=iim' ,1)642 IF(jmar/=jjm+1) CALL abort_gcm(TRIM(modname),'jmar/=jjm+1',1)643 iext=imdp/10644 xpi = ACOS(-1.)645 rad = 6371229.646 647 !--- ARE WE USING A READ MASK ?648 masque_lu=ANY(mask/=-99999.); IF(.NOT.masque_lu) mask=0.0649 WRITE(lunout,*)'Masque lu: ',masque_lu650 651 !--- EXTENSION OF THE INPUT DATABASE TO PROCEED COMPUTATIONS AT BOUNDARIES:652 ALLOCATE(xusn(imdp+2*iext))653 xusn(1 +iext:imdp +iext)=xd(:)654 xusn(1 : iext)=xd(1+imdp-iext:imdp)-2.*xpi655 xusn(1+imdp+iext:imdp+2*iext)=xd(1 :iext)+2.*xpi656 657 ALLOCATE(yusn(jmdp+2))658 yusn(1 )=yd(1) +(yd(1) -yd(2))659 yusn(2:jmdp+1)=yd(:)660 yusn( jmdp+2)=yd(jmdp)+(yd(jmdp)-yd(jmdp-1))661 662 ALLOCATE(zusn(imdp+2*iext,jmdp+2))663 zusn(1 +iext:imdp +iext,2:jmdp+1)=zd (: , :)664 zusn(1 : iext,2:jmdp+1)=zd (imdp-iext+1:imdp , :)665 zusn(1+imdp +iext:imdp+2*iext,2:jmdp+1)=zd (1:iext , :)666 zusn(1 :imdp/2+iext, 1)=zusn(1+imdp/2:imdp +iext, 2)667 zusn(1+imdp/2+iext:imdp+2*iext, 1)=zusn(1 :imdp/2+iext, 2)668 zusn(1 :imdp/2+iext, jmdp+2)=zusn(1+imdp/2:imdp +iext,jmdp+1)669 zusn(1+imdp/2+iext:imdp+2*iext, jmdp+2)=zusn(1 :imdp/2+iext,jmdp+1)670 671 !--- COMPUTE LIMITS OF MODEL GRIDPOINT AREA (REGULAR GRID)672 ALLOCATE(a(imar+1),b(imar+1))673 b(1:imar)=(x(1:imar )+ x(2:imar+1))/2.0674 b(imar+1)= x( imar+1)+(x( imar+1)-x(imar))/2.0675 a(1)=x(1)-(x(2)-x(1))/2.0676 a(2:imar+1)= b(1:imar)677 678 ALLOCATE(c(jmar),d(jmar))679 d(1:jmar-1)=(y(1:jmar-1)+ y(2:jmar))/2.0680 d( jmar )= y( jmar )+(y( jmar)-y(jmar-1))/2.0681 c(1)=y(1)-(y(2)-y(1))/2.0682 c(2:jmar)=d(1:jmar-1)683 684 !--- INITIALIZATIONS:685 ALLOCATE(weight(imar+1,jmar)); weight(:,:)= 0.0686 ALLOCATE(zmea (imar+1,jmar)); zmea (:,:)= 0.0687 688 !--- SUMMATION OVER GRIDPOINT AREA689 zleny=xpi/REAL(jmdp)*rad690 xincr=xpi/REAL(jmdp)/2.691 ALLOCATE(num_tot(imar+1,jmar)); num_tot(:,:)=0.692 ALLOCATE(num_lan(imar+1,jmar)); num_lan(:,:)=0.693 DO ii = 1, imar+1694 DO jj = 1, jmar695 DO j = 2,jmdp+1696 zlenx =zleny *COS(yusn(j))697 zbordnor=(xincr+c(jj)-yusn(j))*rad698 zbordsud=(xincr-d(jj)+yusn(j))*rad699 weighy=AMAX1(0.,AMIN1(zbordnor,zbordsud,zleny))700 IF(weighy/=0) THEN701 DO i = 2, imdp+2*iext-1702 zbordest=(xusn(i)-a(ii)+xincr)*rad*COS(yusn(j))703 zbordoue=(b(ii)+xincr-xusn(i))*rad*COS(yusn(j))704 weighx=AMAX1(0.,AMIN1(zbordest,zbordoue,zlenx))705 IF(weighx/=0)THEN706 num_tot(ii,jj)=num_tot(ii,jj)+1.0707 IF(zusn(i,j)>=1.)num_lan(ii,jj)=num_lan(ii,jj)+1.0708 weight(ii,jj)=weight(ii,jj)+weighx*weighy709 zmea (ii,jj)=zmea (ii,jj)+zusn(i,j)*weighx*weighy !--- MEAN710 END IF711 END DO712 END IF713 END DO714 END DO715 END DO716 717 !--- COMPUTE PARAMETERS NEEDED BY LOTT & MILLER (1997) AND LOTT (1999) SSO SCHEME718 IF(.NOT.masque_lu) THEN719 WHERE(weight(:,1:jmar-1)/=0.0) mask=num_lan(:,:)/num_tot(:,:)720 END IF721 nn=COUNT(weight(:,1:jmar-1)==0.0)722 IF(nn/=0) WRITE(lunout,*)'Problem with weight ; vanishing occurrences: ',nn723 WHERE(weight/=0.0) zmea(:,:)=zmea(:,:)/weight(:,:)724 725 !--- MASK BASED ON GROUND MAXIMUM, 10% THRESHOLD (<10%: SURF PARAMS MEANINGLESS)726 ALLOCATE(mask_tmp(imar+1,jmar)); mask_tmp(:,:)=0.0727 WHERE(mask>=0.1) mask_tmp = 1.728 WHERE(weight(:,:)/=0.0)729 zphi(:,:)=mask_tmp(:,:)*zmea(:,:)730 zmea(:,:)=mask_tmp(:,:)*zmea(:,:)731 END WHERE732 WRITE(lunout,*)' MEAN ORO:' ,MAXVAL(zmea)733 734 !--- Values at poles735 zphi(imar+1,:)=zphi(1,:)736 737 zweinor=SUM(weight(1:imar, 1),DIM=1)738 zweisud=SUM(weight(1:imar,jmar),DIM=1)739 zmeanor=SUM(weight(1:imar, 1)*zmea(1:imar, 1),DIM=1)740 zmeasud=SUM(weight(1:imar,jmar)*zmea(1:imar,jmar),DIM=1)741 zphi(:,1)=zmeanor/zweinor; zphi(:,jmar)=zmeasud/zweisud742 743 END SUBROUTINE grid_noro0744 641 ! 745 642 !------------------------------------------------------------------------------- -
LMDZ5/branches/testing/libf/dynphy_lonlat/phymar/iniphysiq_mod.F90
r2435 r2594 12 12 prad,pg,pr,pcpp,iflag_phys) 13 13 USE dimphy, ONLY: init_dimphy 14 USE mod_grid_phy_lmdz, ONLY: klon_glo, & ! number of atmospheric columns (on full grid) 15 regular_lonlat ! regular longitude-latitude grid type 16 USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) 17 klon_omp_begin, & ! start index of local omp subgrid 18 klon_omp_end, & ! end index of local omp subgrid 19 klon_mpi_begin ! start indes of columns (on local mpi grid) 20 USE geometry_mod, ONLY : init_geometry 14 USE inigeomphy_mod, ONLY: inigeomphy 21 15 USE infotrac, ONLY: nqtot 22 16 USE comcstphy, ONLY: rradius, & ! planet radius (m) … … 24 18 rg, & ! gravity 25 19 rcpp ! specific heat of the atmosphere 26 ! USE phyaqua_mod, ONLY: iniaqua27 USE physics_distribution_mod, ONLY : init_physics_distribution28 USE regular_lonlat_mod, ONLY : init_regular_lonlat, &29 east, west, north, south, &30 north_east, north_west, &31 south_west, south_east32 USE mod_interface_dyn_phys, ONLY : init_interface_dyn_phys33 20 USE infotrac_phy, ONLY: init_infotrac_phy 34 21 USE nrtype, ONLY: pi … … 68 55 CHARACTER (LEN=20) :: modname='iniphysiq' 69 56 CHARACTER (LEN=80) :: abort_message 70 REAL :: total_area_phy, total_area_dyn71 72 ! boundaries, on global grid73 REAL,ALLOCATABLE :: boundslon_reg(:,:)74 REAL,ALLOCATABLE :: boundslat_reg(:,:)75 76 ! global array, on full physics grid:77 REAL,ALLOCATABLE :: latfi_glo(:)78 REAL,ALLOCATABLE :: lonfi_glo(:)79 REAL,ALLOCATABLE :: cufi_glo(:)80 REAL,ALLOCATABLE :: cvfi_glo(:)81 REAL,ALLOCATABLE :: airefi_glo(:)82 REAL,ALLOCATABLE :: boundslonfi_glo(:,:)83 REAL,ALLOCATABLE :: boundslatfi_glo(:,:)84 85 ! local arrays, on given MPI/OpenMP domain:86 REAL,ALLOCATABLE,SAVE :: latfi(:)87 REAL,ALLOCATABLE,SAVE :: lonfi(:)88 REAL,ALLOCATABLE,SAVE :: cufi(:)89 REAL,ALLOCATABLE,SAVE :: cvfi(:)90 REAL,ALLOCATABLE,SAVE :: airefi(:)91 REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)92 REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)93 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)94 95 ! Initialize Physics distibution and parameters and interface with dynamics96 CALL init_physics_distribution(regular_lonlat,4, &97 nbp,ii,jj+1,nlayer,communicator)98 CALL init_interface_dyn_phys99 100 ! init regular global longitude-latitude grid points and boundaries101 ALLOCATE(boundslon_reg(ii,2))102 ALLOCATE(boundslat_reg(jj+1,2))103 104 DO i=1,ii105 boundslon_reg(i,east)=rlonu(i)106 boundslon_reg(i,west)=rlonu(i+1)107 ENDDO108 109 boundslat_reg(1,north)= PI/2110 boundslat_reg(1,south)= rlatv(1)111 DO j=2,jj112 boundslat_reg(j,north)=rlatv(j-1)113 boundslat_reg(j,south)=rlatv(j)114 ENDDO115 boundslat_reg(jj+1,north)= rlatv(jj)116 boundslat_reg(jj+1,south)= -PI/2117 118 ! Write values in module regular_lonlat_mod119 CALL init_regular_lonlat(ii,jj+1, rlonv(1:ii), rlatu, &120 boundslon_reg, boundslat_reg)121 122 ! Generate global arrays on full physics grid123 ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))124 ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))125 ALLOCATE(airefi_glo(klon_glo))126 ALLOCATE(boundslonfi_glo(klon_glo,4))127 ALLOCATE(boundslatfi_glo(klon_glo,4))128 129 IF (klon_glo>1) THEN ! general case130 ! North pole131 latfi_glo(1)=rlatu(1)132 lonfi_glo(1)=0.133 cufi_glo(1) = cu(1)134 cvfi_glo(1) = cv(1)135 boundslonfi_glo(1,north_east)=0136 boundslatfi_glo(1,north_east)=PI/2137 boundslonfi_glo(1,north_west)=2*PI138 boundslatfi_glo(1,north_west)=PI/2139 boundslonfi_glo(1,south_west)=2*PI140 boundslatfi_glo(1,south_west)=rlatv(1)141 boundslonfi_glo(1,south_east)=0142 boundslatfi_glo(1,south_east)=rlatv(1)143 DO j=2,jj144 DO i=1,ii145 k=(j-2)*ii+1+i146 latfi_glo((j-2)*ii+1+i)= rlatu(j)147 lonfi_glo((j-2)*ii+1+i)= rlonv(i)148 cufi_glo((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)149 cvfi_glo((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)150 boundslonfi_glo(k,north_east)=rlonu(i)151 boundslatfi_glo(k,north_east)=rlatv(j-1)152 boundslonfi_glo(k,north_west)=rlonu(i+1)153 boundslatfi_glo(k,north_west)=rlatv(j-1)154 boundslonfi_glo(k,south_west)=rlonu(i+1)155 boundslatfi_glo(k,south_west)=rlatv(j)156 boundslonfi_glo(k,south_east)=rlonu(i)157 boundslatfi_glo(k,south_east)=rlatv(j)158 ENDDO159 ENDDO160 ! South pole161 latfi_glo(klon_glo)= rlatu(jj+1)162 lonfi_glo(klon_glo)= 0.163 cufi_glo(klon_glo) = cu((ii+1)*jj+1)164 cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)165 boundslonfi_glo(klon_glo,north_east)= 0166 boundslatfi_glo(klon_glo,north_east)= rlatv(jj)167 boundslonfi_glo(klon_glo,north_west)= 2*PI168 boundslatfi_glo(klon_glo,north_west)= rlatv(jj)169 boundslonfi_glo(klon_glo,south_west)= 2*PI170 boundslatfi_glo(klon_glo,south_west)= -PI/2171 boundslonfi_glo(klon_glo,south_east)= 0172 boundslatfi_glo(klon_glo,south_east)= -Pi/2173 174 ! build airefi(), mesh area on physics grid175 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)176 ! Poles are single points on physics grid177 airefi_glo(1)=sum(aire(1:ii,1))178 airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))179 180 ! Sanity check: do total planet area match between physics and dynamics?181 total_area_dyn=sum(aire(1:ii,1:jj+1))182 total_area_phy=sum(airefi_glo(1:klon_glo))183 IF (total_area_dyn/=total_area_phy) THEN184 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'185 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn186 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy187 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN188 ! stop here if the relative difference is more than 0.001%189 abort_message = 'planet total surface discrepancy'190 CALL abort_gcm(modname, abort_message, 1)191 ENDIF192 ENDIF193 ELSE ! klon_glo==1, running the 1D model194 ! just copy over input values195 latfi_glo(1)=rlatu(1)196 lonfi_glo(1)=rlonv(1)197 cufi_glo(1)=cu(1)198 cvfi_glo(1)=cv(1)199 airefi_glo(1)=aire(1,1)200 boundslonfi_glo(1,north_east)=rlonu(1)201 boundslatfi_glo(1,north_east)=PI/2202 boundslonfi_glo(1,north_west)=rlonu(2)203 boundslatfi_glo(1,north_west)=PI/2204 boundslonfi_glo(1,south_west)=rlonu(2)205 boundslatfi_glo(1,south_west)=rlatv(1)206 boundslonfi_glo(1,south_east)=rlonu(1)207 boundslatfi_glo(1,south_east)=rlatv(1)208 ENDIF ! of IF (klon_glo>1)209 210 !$OMP PARALLEL211 ! Now generate local lon/lat/cu/cv/area/bounds arrays212 ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))213 ALLOCATE(airefi(klon_omp))214 ALLOCATE(boundslonfi(klon_omp,4))215 ALLOCATE(boundslatfi(klon_omp,4))216 57 217 58 218 offset = klon_mpi_begin - 1 219 airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end) 220 cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end) 221 cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 222 lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 223 latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end) 224 boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:) 225 boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:) 59 ! --> initialize physics distribution, global fields and geometry 60 ! (i.e. things in phy_common or dynphy_lonlat) 61 CALL inigeomphy(ii,jj,nlayer, & 62 nbp, communicator, & 63 rlatu,rlatv, & 64 rlonu,rlonv, & 65 aire,cu,cv) 226 66 227 ! copy over local grid longitudes and latitudes 228 CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, & 229 airefi,cufi,cvfi) 230 67 ! --> now initialize things specific to the phymar physics package 68 69 !$OMP PARALLEL 231 70 232 71 ! Initialize tracer names, numbers, etc. for physics -
LMDZ5/branches/testing/libf/phydev/iophy.F90
r2408 r2594 44 44 jj_nb, jj_begin, jj_end, ii_begin, ii_end, & 45 45 mpi_size, mpi_rank, klon_mpi, & 46 is_sequential, is_south_pole 46 is_sequential, is_south_pole_dyn 47 47 USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo 48 48 USE print_control_mod, ONLY: lunout, prt_level … … 141 141 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 142 142 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 143 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole 143 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn 144 144 endif 145 145 … … 148 148 1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end, & 149 149 klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend, & 150 io_lat, io_lon,is_south_pole ,mpi_rank)150 io_lat, io_lon,is_south_pole_dyn,mpi_rank) 151 151 #endif 152 152 !$OMP END MASTER -
LMDZ5/branches/testing/libf/phylmd/aero_mod.F90
r2435 r2594 88 88 89 89 ! Number of diagnostics wavelengths (5 SW + 1 LW @ 10 um) 90 INTEGER, PARAMETER :: nwave = 590 INTEGER, PARAMETER :: nwave_sw = 5 91 91 INTEGER, PARAMETER :: nwave_lw = 1 92 INTEGER, PARAMETER :: nwave = nwave_sw + nwave_lw 92 93 93 94 ! Number of modes spectral bands -
LMDZ5/branches/testing/libf/phylmd/aeropt_2bands.F90
r2408 r2594 1128 1128 ENDDO 1129 1129 1130 inu=1 1130 inu=1 ! visible wavaband 1131 mrfspecies=2 ! total aerosol AER 1131 1132 DO i=1, KLON 1132 absvisaer(i)=SUM((1-piz_allaer(i,:, :,inu))*tau_allaer(i,:,:,inu))1133 absvisaer(i)=SUM((1-piz_allaer(i,:,mrfspecies,inu))*tau_allaer(i,:,mrfspecies,inu)) 1133 1134 ENDDO 1135 STOP 1134 1136 1135 1137 DEALLOCATE(aerosol_name) -
LMDZ5/branches/testing/libf/phylmd/aeropt_5wv.F90
r2408 r2594 74 74 ! Local 75 75 ! 76 INTEGER, PARAMETER :: las = nwave 76 INTEGER, PARAMETER :: las = nwave_sw 77 77 LOGICAL :: soluble 78 78 -
LMDZ5/branches/testing/libf/phylmd/alpale.F90
r2542 r2594 4 4 wake_pe, wake_fip, & 5 5 Ale_bl, Ale_bl_trig, Alp_bl, & 6 Ale, Alp )6 Ale, Alp, Ale_wake, Alp_wake ) 7 7 8 8 ! ************************************************************** … … 46 46 !---------------- 47 47 REAL, DIMENSION(klon), INTENT(OUT) :: Ale, Alp 48 REAL, DIMENSION(klon), INTENT(OUT) :: Ale_wake, Alp_wake 48 49 49 50 include "thermcell.h" … … 55 56 INTEGER :: i, k 56 57 REAL, DIMENSION(klon) :: www 57 REAL, DIMENSION(klon) :: ale_wake, alp_wake58 58 REAL, SAVE :: ale_max=1000. 59 59 REAL, SAVE :: alp_max=2. -
LMDZ5/branches/testing/libf/phylmd/alpale_th.F90
r2542 r2594 1 SUBROUTINE alpale_th ( dtime, lmax_th, t_seri, &1 SUBROUTINE alpale_th ( dtime, lmax_th, t_seri, cell_area, & 2 2 cin, s2, n2, & 3 3 ale_bl_trig, ale_bl_stat, ale_bl, & 4 alp_bl, alp_bl_stat ) 4 alp_bl, alp_bl_stat, & 5 proba_notrig, random_notrig) 5 6 6 7 ! ************************************************************** … … 27 28 !---------------- 28 29 REAL, INTENT(IN) :: dtime 30 REAL, DIMENSION(klon), INTENT(IN) :: cell_area 29 31 INTEGER, DIMENSION(klon), INTENT(IN) :: lmax_th 30 32 REAL, DIMENSION(klon,klev), INTENT(IN) :: t_seri … … 37 39 REAL, DIMENSION(klon), INTENT(INOUT) :: alp_bl_stat 38 40 41 REAL, DIMENSION(klon), INTENT(OUT) :: proba_notrig, random_notrig 42 39 43 include "thermcell.h" 40 44 … … 44 48 LOGICAL, SAVE :: first = .TRUE. 45 49 REAL, SAVE :: random_notrig_max=1. 46 REAL, DIMENSION(klon) :: proba_notrig, tau_trig, random_notrig 50 REAL, SAVE :: cv_feed_area 51 REAL :: birth_number 52 REAL, DIMENSION(klon) :: ale_bl_ref 53 REAL, DIMENSION(klon) :: tau_trig 54 REAL, DIMENSION(klon) :: birth_rate 47 55 ! 48 56 !$OMP THREADPRIVATE(random_notrig_max) 57 !$OMP THREADPRIVATE(cv_feed_area) 49 58 !$OMP THREADPRIVATE(first) 50 59 ! 60 REAL umexp ! expression of (1.-exp(-x))/x valid for all x, especially when x->0 61 REAL x 62 umexp(x) = max(sign(1.,x-1.e-3),0.)*(1.-exp(-x))/max(x,1.e-3) + & 63 (1.-max(sign(1.,x-1.e-3),0.))*(1.-0.5*x*(1.-x/3.*(1.-0.25*x))) 64 ! 65 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 66 ! JYG, 20160513 : Introduction of the Effective Lifting Power (ELP), which 67 ! takes into account the area (cv_feed_area) covered by thermals contributing 68 ! to each cumulonimbus. 69 ! The use of ELP prevents singularities when the trigger probability tends to 70 ! zero. It is activated by iflag_clos_bl = 3. 71 ! The ELP values are stored in the ALP_bl variable. 72 ! 73 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 74 ! 75 !--------------------------------------- 76 IF (iflag_clos_bl .LT. 3) THEN 77 !--------------------------------------- 78 ! 79 ! Original code (Nicolas Rochetin) 80 ! -------------------------------- 81 51 82 IF (first) THEN 83 random_notrig_max=1. 52 84 CALL getin_p('random_notrig_max',random_notrig_max) 53 85 first=.FALSE. … … 155 187 endif !(iflag_clos_bl) 156 188 189 ! 190 !--------------------------------------- 191 ELSEIF (iflag_clos_bl .EQ. 3) THEN ! (iflag_clos_bl .LT. 3) 192 !--------------------------------------- 193 ! 194 ! New code with Effective Lifting Power 195 ! ------------------------------------- 196 IF (first) THEN 197 cv_feed_area = 1.e10 ! m2 198 CALL getin_p('cv_feed_area', cv_feed_area) 199 first=.FALSE. 200 ENDIF 201 202 !-----------Stochastic triggering----------- 203 if (iflag_trig_bl.ge.1) then 204 ! 205 IF (prt_level .GE. 10) THEN 206 print *,'cin, ale_bl_stat, alp_bl_stat ', & 207 cin, ale_bl_stat, alp_bl_stat 208 ENDIF 209 210 ! Use ale_bl_stat (Rochetin's code) or ale_bl (old code) according to 211 ! iflag_trig_bl value. 212 IF (iflag_trig_bl.eq.1) then ! use ale_bl_stat (Rochetin computation) 213 do i=1,klon 214 ale_bl_ref(i)=ale_bl_stat(i) 215 enddo 216 ELSE IF (iflag_trig_bl.ge.2) then ! use ale_bl (old computation) 217 do i=1,klon 218 ale_bl_ref(i)=Ale_bl(i) 219 enddo 220 ENDIF ! (iflag_trig_bl.eq.1) 221 222 223 !----Initializations and random number generation 224 do i=1,klon 225 proba_notrig(i)=1. 226 random_notrig(i)=1e6*ale_bl_stat(i)-int(1e6*ale_bl_stat(i)) 227 if ( ale_bl_trig(i) .lt. abs(cin(i))+1.e-10 ) then 228 tau_trig(i)=tau_trig_shallow 229 else 230 tau_trig(i)=tau_trig_deep 231 endif 232 enddo 233 ! 234 IF (prt_level .GE. 10) THEN 235 print *,'random_notrig, tau_trig ', & 236 random_notrig, tau_trig 237 print *,'s_trig,s2,n2 ', & 238 s_trig,s2,n2 239 ENDIF 240 241 !----alp_bl computation 242 do i=1,klon 243 if ( (ale_bl_ref(i) .gt. abs(cin(i))+1.e-10) ) then 244 birth_number = n2(i)*exp(-s_trig/s2(i)) 245 birth_rate(i) = birth_number/(tau_trig(i)*cell_area(i)) 246 proba_notrig(i)=exp(-birth_number*dtime/tau_trig(i)) 247 Alp_bl(i) = Alp_bl(i)* & 248 umexp(-birth_number*cv_feed_area/cell_area(i))/ & 249 umexp(-birth_number*dtime/tau_trig(i))* & 250 tau_trig(i)*cv_feed_area/(dtime*cell_area(i)) 251 else 252 proba_notrig(i)=1. 253 random_notrig(i)=0. 254 alp_bl(i)=0. 255 endif 256 enddo 257 258 !----ale_bl_trig computation 259 do i=1,klon 260 if (random_notrig(i) .ge. proba_notrig(i)) then 261 ale_bl_trig(i)=ale_bl_ref(i) 262 else 263 ale_bl_trig(i)=0. 264 endif 265 enddo 266 267 ! 268 IF (prt_level .GE. 10) THEN 269 print *,'proba_notrig, ale_bl_trig ', & 270 proba_notrig, ale_bl_trig 271 ENDIF 272 273 endif !(iflag_trig_bl .ge. 1) 274 275 !--------------------------------------- 276 ENDIF ! (iflag_clos_bl .LT. 3) 277 !--------------------------------------- 278 157 279 IF (prt_level .GE. 10) THEN 158 280 print *,'ale_bl_trig, alp_bl_stat ',ale_bl_trig, alp_bl_stat … … 160 282 161 283 !cc fin nrlmd le 10/04/2012 162 163 ! ------------------------------------------------------------------ 164 ! Transport de la TKE par les panaches thermiques. 165 ! FH : 2010/02/01 166 ! if (iflag_pbl.eq.10) then 167 ! call thermcell_dtke(klon,klev,nbsrf,pdtphys,fm_therm,entr_therm, 168 ! s rg,paprs,pbl_tke) 169 ! endif 170 ! ------------------------------------------------------------------- 284 ! 171 285 !IM/FH: 2011/02/23 172 286 ! Couplage Thermiques/Emanuel seulement si T<0 … … 180 294 endif 181 295 enddo 296 print *,'In order to run with iflag_coupl=2, you have to comment out the following stop' 297 STOP 182 298 endif 183 !184 299 RETURN 185 300 END -
LMDZ5/branches/testing/libf/phylmd/clesphys.h
r2542 r2594 40 40 !IM, MAFo fmagic, pmagic : parametres - additionnel et multiplicatif - 41 41 ! pour regler l albedo sur ocean 42 REAL pbl_lmixmin_alpha 42 43 REAL fmagic, pmagic 43 44 ! Hauteur (imposee) du contenu en eau du sol … … 77 78 REAL ecrit_LES 78 79 REAL freq_ISCCP, ecrit_ISCCP 79 REAL freq_COSP 80 REAL freq_COSP, freq_AIRS 80 81 LOGICAL :: ok_cosp,ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP 82 LOGICAL :: ok_airs 81 83 INTEGER :: ip_ebil_phy, iflag_rrtm, iflag_ice_thermo, NSW, iflag_albedo 82 84 LOGICAL :: ok_chlorophyll … … 94 96 & , CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt & 95 97 & , CH4_ppb_per, N2O_ppb_per, CFC11_ppt_per, CFC12_ppt_per & 96 & , cdmmax, cdhmax, ksta, ksta_ter, f_ri_cd_min&98 & , cdmmax,cdhmax,ksta,ksta_ter,f_ri_cd_min,pbl_lmixmin_alpha & 97 99 & , fmagic, pmagic & 98 100 & , f_cdrag_ter,f_cdrag_oce,f_rugoro,z0min & … … 101 103 & , pasphys , freq_outNMC, freq_calNMC & 102 104 & , lonmin_ins, lonmax_ins, latmin_ins, latmax_ins & 103 & , freq_ISCCP, ecrit_ISCCP, freq_COSP 105 & , freq_ISCCP, ecrit_ISCCP, freq_COSP, freq_AIRS & 104 106 & , cvl_corr & 105 107 & , qsol0,albsno0,evap0 & … … 120 122 & , lev_histins, lev_histLES, lev_histdayNMC, levout_histNMC & 121 123 & , ok_histNMC & 122 & , type_run, ok_regdyn, ok_cosp 124 & , type_run, ok_regdyn, ok_cosp, ok_airs & 123 125 & , ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP & 124 126 & , ip_ebil_phy & -
LMDZ5/branches/testing/libf/phylmd/cloudth.F90
r2544 r2594 5 5 6 6 7 USE IOIPSL, ONLY : getin8 7 IMPLICIT NONE 9 8 … … 20 19 #include "FCTTRE.h" 21 20 #include "thermcell.h" 21 #include "nuage.h" 22 22 23 23 INTEGER itap,ind1,ind2 … … 54 54 REAL sth,senv,sigma1s,sigma2s,xth,xenv 55 55 REAL Tbef,zdelta,qsatbef,zcor 56 REAL alpha,qlbef56 REAL qlbef 57 57 REAL ratqs(ngrid,klev) ! determine la largeur de distribution de vapeur 58 58 … … 62 62 REAL erf 63 63 64 REAL, SAVE :: iflag_cloudth_vert, iflag_cloudth_vert_omp=065 66 67 LOGICAL, SAVE :: first=.true.68 69 70 64 71 65 72 66 73 67 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 74 ! Astuce pour gérer deux versions de cloudth en attendant 75 ! de converger sur une version nouvelle 68 ! Gestion de deux versions de cloudth 76 69 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 77 IF (first) THEN 78 !$OMP MASTER 79 CALL getin('iflag_cloudth_vert',iflag_cloudth_vert_omp) 80 !$OMP END MASTER 81 !$OMP BARRIER 82 iflag_cloudth_vert=iflag_cloudth_vert_omp 83 first=.false. 84 ENDIF 85 IF (iflag_cloudth_vert==1) THEN 86 CALL cloudth_vert(ngrid,klev,ind2, & 70 71 IF (iflag_cloudth_vert.GE.1) THEN 72 CALL cloudth_vert(ngrid,klev,ind2, & 87 73 & ztv,po,zqta,fraca, & 88 74 & qcloud,ctot,zpspsk,paprs,ztla,zthl, & 89 75 & ratqs,zqs,t) 90 91 76 RETURN 77 ENDIF 92 78 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 93 94 79 95 80 … … 185 170 cenv(ind1,ind2)=0.5*(1.+1.*erf(xenv)) 186 171 ctot(ind1,ind2)=fraca(ind1,ind2)*cth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*cenv(ind1,ind2) 187 ! ctot(ind1,ind2)=alpha*cth(ind1,ind2)+(1.-1.*alpha)*cenv(ind1,ind2)188 189 190 172 191 173 qlth(ind1,ind2)=sigma2s*((exp(-1.*xth**2)/sqrt2pi)+xth*sqrt(2.)*cth(ind1,ind2)) 192 174 qlenv(ind1,ind2)=sigma1s*((exp(-1.*xenv**2)/sqrt2pi)+xenv*sqrt(2.)*cenv(ind1,ind2)) 193 175 qltot(ind1,ind2)=fraca(ind1,ind2)*qlth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*qlenv(ind1,ind2) 194 ! qltot(ind1,ind2)=alpha*qlth(ind1,ind2)+(1.-1.*alpha)*qlenv(ind1,ind2)195 196 197 ! print*,senv,sth,sigma1s,sigma2s,fraca(ind1,ind2),'senv et sth et sig1 et sig2 et alpha'198 176 199 177 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 269 247 & ratqs,zqs,t) 270 248 271 272 IMPLICIT NONE273 274 275 249 !=========================================================================== 276 250 ! Auteur : Arnaud Octavio Jam (LMD/CNRS) … … 280 254 281 255 256 USE ioipsl_getin_p_mod, ONLY : getin_p 257 258 IMPLICIT NONE 259 282 260 #include "YOMCST.h" 283 261 #include "YOETHF.h" 284 262 #include "FCTTRE.h" 285 263 #include "thermcell.h" 286 264 #include "nuage.h" 265 287 266 INTEGER itap,ind1,ind2 288 267 INTEGER ngrid,klev,klon,l,ig … … 320 299 REAL IntJ,IntI1,IntI2,IntI3,coeffqlenv,coeffqlth 321 300 REAL Tbef,zdelta,qsatbef,zcor 322 REAL alpha,qlbef301 REAL qlbef 323 302 REAL ratqs(ngrid,klev) ! determine la largeur de distribution de vapeur 303 ! Change the width of the PDF used for vertical subgrid scale heterogeneity 304 ! (J Jouhaud, JL Dufresne, JB Madeleine) 305 REAL,SAVE :: vert_alpha 306 LOGICAL, SAVE :: firstcall = .TRUE. 324 307 325 308 REAL zpdf_sig(ngrid),zpdf_k(ngrid),zpdf_delta(ngrid) … … 327 310 REAL zqs(ngrid), qcloud(ngrid) 328 311 REAL erf 329 330 331 332 333 312 334 313 !------------------------------------------------------------------------------ … … 355 334 sqrtpi=sqrt(pi) 356 335 357 336 IF (firstcall) THEN 337 vert_alpha=0.5 338 CALL getin_p('cloudth_vert_alpha',vert_alpha) 339 WRITE(*,*) 'cloudth_vert_alpha = ', vert_alpha 340 firstcall=.FALSE. 341 ENDIF 358 342 359 343 !------------------------------------------------------------------------------- … … 425 409 cenv(ind1,ind2)=0.5*(1.+1.*erf(xenv)) 426 410 ctot(ind1,ind2)=fraca(ind1,ind2)*cth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*cenv(ind1,ind2) 427 ! ctot(ind1,ind2)=alpha*cth(ind1,ind2)+(1.-1.*alpha)*cenv(ind1,ind2)428 429 430 411 431 412 qlth(ind1,ind2)=sigma2s*((exp(-1.*xth**2)/sqrt2pi)+xth*sqrt(2.)*cth(ind1,ind2)) 432 413 qlenv(ind1,ind2)=sigma1s*((exp(-1.*xenv**2)/sqrt2pi)+xenv*sqrt(2.)*cenv(ind1,ind2)) 433 414 qltot(ind1,ind2)=fraca(ind1,ind2)*qlth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*qlenv(ind1,ind2) 434 ! qltot(ind1,ind2)=alpha*qlth(ind1,ind2)+(1.-1.*alpha)*qlenv(ind1,ind2)435 415 436 437 ! print*,senv,sth,sigma1s,sigma2s,fraca(ind1,ind2),'senv et sth et sig1 et sig2 et alpha' 438 439 416 IF (iflag_cloudth_vert == 1) THEN 440 417 !------------------------------------------------------------------------------- 441 418 ! Version 2: Modification selon J.-Louis. On condense ?? partir de qsat-ratqs … … 479 456 qltot(ind1,ind2)=fraca(ind1,ind2)*qlth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*qlenv(ind1,ind2) 480 457 458 ELSE IF (iflag_cloudth_vert == 2) THEN 459 460 !------------------------------------------------------------------------------- 461 ! Version 3: Modification Jean Jouhaud. On condense a partir de -delta s 462 !------------------------------------------------------------------------------- 463 ! deltasenv=aenv*ratqs(ind1,ind2)*po(ind1) 464 ! deltasth=ath*ratqs(ind1,ind2)*zqta(ind1,ind2) 465 ! deltasenv=aenv*ratqs(ind1,ind2)*zqsatenv(ind1,ind2) 466 ! deltasth=ath*ratqs(ind1,ind2)*zqsatth(ind1,ind2) 467 deltasenv=aenv*vert_alpha*sigma1s 468 deltasth=ath*vert_alpha*sigma2s 469 470 xenv1=-(senv+deltasenv)/(sqrt(2.)*sigma1s) 471 xenv2=-(senv-deltasenv)/(sqrt(2.)*sigma1s) 472 xth1=-(sth+deltasth)/(sqrt(2.)*sigma2s) 473 xth2=-(sth-deltasth)/(sqrt(2.)*sigma2s) 474 ! coeffqlenv=(sigma1s)**2/(2*sqrtpi*deltasenv) 475 ! coeffqlth=(sigma2s)**2/(2*sqrtpi*deltasth) 476 477 cth(ind1,ind2)=0.5*(1.-1.*erf(xth1)) 478 cenv(ind1,ind2)=0.5*(1.-1.*erf(xenv1)) 479 ctot(ind1,ind2)=fraca(ind1,ind2)*cth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*cenv(ind1,ind2) 480 481 IntJ=0.5*senv*(1-erf(xenv2))+(sigma1s/sqrt2pi)*exp(-1.*xenv2**2) 482 IntI1=(((senv+deltasenv)**2+(sigma1s)**2)/(8*deltasenv))*(erf(xenv2)-erf(xenv1)) 483 IntI2=(sigma1s**2/(4*deltasenv*sqrtpi))*(xenv1*exp(-1.*xenv1**2)-xenv2*exp(-1.*xenv2**2)) 484 IntI3=((sqrt2*sigma1s*(senv+deltasenv))/(4*sqrtpi*deltasenv))*(exp(-1.*xenv1**2)-exp(-1.*xenv2**2)) 485 486 ! IntI1=0.5*(0.5*sqrtpi*(erf(xenv2)-erf(xenv1))+xenv1*exp(-1.*xenv1**2)-xenv2*exp(-1.*xenv2**2)) 487 ! IntI2=xenv2*(exp(-1.*xenv2**2)-exp(-1.*xenv1**2)) 488 ! IntI3=0.5*sqrtpi*xenv2**2*(erf(xenv2)-erf(xenv1)) 489 490 qlenv(ind1,ind2)=IntJ+IntI1+IntI2+IntI3 491 ! qlenv(ind1,ind2)=IntJ 492 ! print*, qlenv(ind1,ind2),'VERIF EAU' 493 494 IntJ=0.5*sth*(1-erf(xth2))+(sigma2s/sqrt2pi)*exp(-1.*xth2**2) 495 IntI1=(((sth+deltasth)**2+(sigma2s)**2)/(8*deltasth))*(erf(xth2)-erf(xth1)) 496 IntI2=(sigma2s**2/(4*deltasth*sqrtpi))*(xth1*exp(-1.*xth1**2)-xth2*exp(-1.*xth2**2)) 497 IntI3=((sqrt2*sigma2s*(sth+deltasth))/(4*sqrtpi*deltasth))*(exp(-1.*xth1**2)-exp(-1.*xth2**2)) 498 499 qlth(ind1,ind2)=IntJ+IntI1+IntI2+IntI3 500 ! qlth(ind1,ind2)=IntJ 501 ! print*, IntJ,IntI1,IntI2,IntI3,qlth(ind1,ind2),'VERIF EAU2' 502 qltot(ind1,ind2)=fraca(ind1,ind2)*qlth(ind1,ind2)+(1.-1.*fraca(ind1,ind2))*qlenv(ind1,ind2) 503 504 505 506 507 ENDIF ! of if (iflag_cloudth_vert==1 or 2) 508 481 509 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 510 482 511 if (cenv(ind1,ind2).lt.1.e-10.or.cth(ind1,ind2).lt.1.e-10) then 483 512 ctot(ind1,ind2)=0. -
LMDZ5/branches/testing/libf/phylmd/coef_diff_turb_mod.F90
r2408 r2594 164 164 iflag_pbl) 165 165 ELSE IF (iflag_pbl<20) THEN 166 CALL yamada4( knon,dtime,RG,RD,ypaprs,yt, &166 CALL yamada4(ni,nsrf,knon,dtime,RG,RD,ypaprs,yt, & 167 167 yzlev,yzlay,yu,yv,yteta, & 168 168 ycdragm,yq2,ykmm,ykmn,ykmq,yustar, & -
LMDZ5/branches/testing/libf/phylmd/conf_phys_m.F90
r2544 r2594 98 98 REAL,SAVE :: bl95_b0_omp, bl95_b1_omp 99 99 REAL,SAVE :: freq_ISCCP_omp, ecrit_ISCCP_omp 100 REAL,SAVE :: freq_COSP_omp 100 REAL,SAVE :: freq_COSP_omp, freq_AIRS_omp 101 101 real,SAVE :: fact_cldcon_omp, facttemps_omp,ratqsbas_omp 102 102 real,SAVE :: tau_cld_cv_omp, coefw_cld_cv_omp … … 165 165 INTEGER,SAVE :: iflag_ice_thermo_omp 166 166 INTEGER,SAVE :: iflag_t_glace_omp 167 INTEGER,SAVE :: iflag_cloudth_vert_omp 167 168 REAL,SAVE :: rad_froid_omp, rad_chau1_omp, rad_chau2_omp 168 169 REAL,SAVE :: t_glace_min_omp, t_glace_max_omp … … 178 179 REAL,SAVE :: cdmmax_omp,cdhmax_omp,ksta_omp,ksta_ter_omp,f_ri_cd_min_omp 179 180 LOGICAL,SAVE :: ok_kzmin_omp 181 REAL, SAVE :: pbl_lmixmin_alpha_omp 180 182 REAL, SAVE :: fmagic_omp, pmagic_omp 181 183 INTEGER,SAVE :: iflag_pbl_omp,lev_histhf_omp,lev_histday_omp,lev_histmth_omp … … 188 190 REAL, SAVE :: freq_outNMC_omp(3), freq_calNMC_omp(3) 189 191 CHARACTER*4, SAVE :: type_run_omp 190 LOGICAL,SAVE :: ok_cosp_omp 192 LOGICAL,SAVE :: ok_cosp_omp, ok_airs_omp 191 193 LOGICAL,SAVE :: ok_mensuelCOSP_omp,ok_journeCOSP_omp,ok_hfCOSP_omp 192 194 REAL,SAVE :: lonmin_ins_omp, lonmax_ins_omp, latmin_ins_omp, latmax_ins_omp … … 460 462 call getin('freq_COSP', freq_COSP_omp) 461 463 464 !Config Key = freq_AIRS 465 !Config Desc = Frequence d'appel du simulateur AIRS en secondes; 466 ! par defaut 10800, i.e. 3 heures 467 !Config Def = 10800. 468 !Config Help = Used in ini_histdayAIRS.h 469 ! 470 freq_AIRS_omp = 10800. 471 call getin('freq_AIRS', freq_AIRS_omp) 472 462 473 ! 463 474 !Config Key = ip_ebil_phy … … 1161 1172 1162 1173 ! 1174 !Config Key = iflag_cloudth_vert 1175 !Config Desc = 1176 !Config Def = 0 1177 !Config Help = 1178 ! 1179 iflag_cloudth_vert_omp = 0 1180 call getin('iflag_cloudth_vert',iflag_cloudth_vert_omp) 1181 1182 ! 1163 1183 !Config Key = iflag_ice_thermo 1164 1184 !Config Desc = … … 1259 1279 ok_kzmin_omp = .true. 1260 1280 call getin('ok_kzmin',ok_kzmin_omp) 1281 1282 pbl_lmixmin_alpha_omp=0.0 1283 call getin('pbl_lmixmin_alpha',pbl_lmixmin_alpha_omp) 1284 1261 1285 1262 1286 ! … … 1594 1618 ok_cosp_omp = .false. 1595 1619 call getin('ok_cosp',ok_cosp_omp) 1620 1621 ! 1622 !Config Key = ok_airs 1623 !Config Desc = 1624 !Config Def = .false. 1625 !Config Help = 1626 ! 1627 ok_airs_omp = .false. 1628 call getin('ok_airs',ok_airs_omp) 1596 1629 1597 1630 ! … … 2044 2077 exposant_glace = exposant_glace_omp 2045 2078 iflag_t_glace = iflag_t_glace_omp 2079 iflag_cloudth_vert=iflag_cloudth_vert_omp 2046 2080 iflag_ice_thermo = iflag_ice_thermo_omp 2047 2081 rei_min = rei_min_omp … … 2055 2089 f_ri_cd_min = f_ri_cd_min_omp 2056 2090 ok_kzmin = ok_kzmin_omp 2091 pbl_lmixmin_alpha=pbl_lmixmin_alpha_omp 2057 2092 fmagic = fmagic_omp 2058 2093 pmagic = pmagic_omp … … 2094 2129 ecrit_ISCCP = ecrit_ISCCP_omp 2095 2130 freq_COSP = freq_COSP_omp 2131 freq_AIRS = freq_AIRS_omp 2096 2132 ok_ade = ok_ade_omp 2097 2133 ok_aie = ok_aie_omp … … 2144 2180 type_run = type_run_omp 2145 2181 ok_cosp = ok_cosp_omp 2182 ok_airs = ok_airs_omp 2183 2146 2184 ok_mensuelCOSP = ok_mensuelCOSP_omp 2147 2185 ok_journeCOSP = ok_journeCOSP_omp … … 2291 2329 write(lunout,*)' Frequence appel simulateur ISCCP, ecrit_ISCCP =', ecrit_ISCCP 2292 2330 write(lunout,*)' Frequence appel simulateur COSP, freq_COSP =', freq_COSP 2331 write(lunout,*)' Frequence appel simulateur AIRS, freq_AIRS =', freq_AIRS 2293 2332 write(lunout,*)' Sortie bilan d''energie, ip_ebil_phy =', ip_ebil_phy 2294 2333 write(lunout,*)' Excentricite = ',R_ecc … … 2361 2400 write(lunout,*)' exposant_glace = ',exposant_glace 2362 2401 write(lunout,*)' iflag_t_glace = ',iflag_t_glace 2402 write(lunout,*)' iflag_cloudth_vert = ',iflag_cloudth_vert 2363 2403 write(lunout,*)' iflag_ice_thermo = ',iflag_ice_thermo 2364 2404 write(lunout,*)' rei_min = ',rei_min … … 2371 2411 write(lunout,*)' f_ri_cd_min = ',f_ri_cd_min 2372 2412 write(lunout,*)' ok_kzmin = ',ok_kzmin 2413 write(lunout,*)' pbl_lmixmin_alpha = ',pbl_lmixmin_alpha 2373 2414 write(lunout,*)' fmagic = ',fmagic 2374 2415 write(lunout,*)' pmagic = ',pmagic … … 2404 2445 write(lunout,*)' type_run = ',type_run 2405 2446 write(lunout,*)' ok_cosp = ',ok_cosp 2447 write(lunout,*)' ok_airs = ',ok_airs 2448 2406 2449 write(lunout,*)' ok_mensuelCOSP = ',ok_mensuelCOSP 2407 2450 write(lunout,*)' ok_journeCOSP = ',ok_journeCOSP -
LMDZ5/branches/testing/libf/phylmd/cosp/cosp_constants.F90
r2435 r2594 108 108 -31.5,-28.5,-25.5,-22.5,-19.5,-16.5,-13.5,-10.5, -7.5, -4.5, & 109 109 -1.5, 1.5, 4.5, 7.5, 10.5, 13.5, 16.5, 19.5, 22.5, 25.5/) 110 real,parameter,dimension(2,LIDAR_NTEMP) :: LIDAR_PHASE_TEMP_BNDS=reshape(source=(/-273.15,-90.,-90.,-87.,-87.,-84.,-84.,-81.,-81.,-78., & 110 real,parameter,dimension(2,LIDAR_NTEMP) :: LIDAR_PHASE_TEMP_BNDS=reshape(source=& 111 (/-273.15,-90.,-90.,-87.,-87.,-84.,-84.,-81.,-81.,-78., & 111 112 -78.,-75.,-75.,-72.,-72.,-69.,-69.,-66.,-66.,-63., & 112 113 -63.,-60.,-60.,-57.,-57.,-54.,-54.,-51.,-51.,-48., & -
LMDZ5/branches/testing/libf/phylmd/cosp/cosp_output_mod.F90
r2471 r2594 228 228 real,dimension(2,SR_BINS) :: sratio_bounds 229 229 real,dimension(SR_BINS) :: sratio_ax 230 CHARACTER(LEN=20), DIMENSION(3) :: chfreq = (/ '1day', '1d ', '3h' /)230 CHARACTER(LEN=20), DIMENSION(3) :: chfreq = (/ '1day', '1d ', '3h ' /) 231 231 232 232 !!! Variables d'entree … … 363 363 CALL histvert(cosp_nidfiles(iff),"column","column","count",Ncolumns,column_ax(1:Ncolumns),nvertcol(iff)) 364 364 365 CALL histvert(cosp_nidfiles(iff),"temp","temperature","C",LIDAR_NTEMP,LIDAR_PHASE_TEMP,nverttemp(iff)) 366 CALL histvert(cosp_nidfiles(iff),"cth16","altitude","m",MISR_N_CTH,MISR_CTH,nvertmisr(iff)) 365 CALL histvert(cosp_nidfiles(iff),"temp","temperature","C",LIDAR_NTEMP,LIDAR_PHASE_TEMP,nverttemp(iff)) 366 367 CALL histvert(cosp_nidfiles(iff),"cth16","altitude","m",MISR_N_CTH,MISR_CTH,nvertmisr(iff)) 368 367 369 ! CALL histvert(cosp_nidfiles(iff),"dbze","equivalent_reflectivity_factor","dBZ",DBZE_BINS,dbze_ax,nvertbze(iff)) 368 370 -
LMDZ5/branches/testing/libf/phylmd/cosp/cosp_output_write_mod.F90
r2488 r2594 322 322 if(modis%Cloud_Particle_Size_Water_Mean(ip).eq.R_UNDEF)then 323 323 modis%Cloud_Particle_Size_Water_Mean(ip)=Cosp_fill_value 324 endif 325 if(modis%Cloud_Particle_Size_Ice_Mean(ip).eq.R_UNDEF)then 326 modis%Cloud_Particle_Size_Ice_Mean(ip)=Cosp_fill_value 324 327 endif 325 328 if(modis%Cloud_Top_Pressure_Total_Mean(ip).eq.R_UNDEF)then -
LMDZ5/branches/testing/libf/phylmd/cosp/phys_cosp.F90
r2435 r2594 73 73 74 74 !! AI rajouter 75 75 #include "cosp_defs.h" 76 76 USE MOD_COSP_CONSTANTS 77 77 USE MOD_COSP_TYPES -
LMDZ5/branches/testing/libf/phylmd/cv3_routines.F90
r2542 r2594 3860 3860 sigd(il) = sigd(il)/alpha_qpos(il) 3861 3861 precip(il) = precip(il)/alpha_qpos(il) 3862 cbmf(il) = cbmf(il)/alpha_qpos(il) 3862 3863 END IF 3863 3864 END DO -
LMDZ5/branches/testing/libf/phylmd/dyn1d/1DUTILS.h
r2471 r2594 3236 3236 & thlpcar(nlev_max),tracer(nlev_max,ntrac) 3237 3237 3238 real height1(nlev_max) 3239 3238 3240 integer, parameter :: ilesfile=1 3239 3241 integer :: ierr,k,itrac,nt1,nt2 … … 3245 3247 read (ilesfile,*) kmax 3246 3248 do k=1,kmax 3247 read (ilesfile,*) height (k),thlprof(k),qtprof (k), &3249 read (ilesfile,*) height1(k),thlprof(k),qtprof (k), & 3248 3250 & uprof (k),vprof (k),e12prof(k) 3249 3251 enddo … … 3261 3263 read (ilesfile,*) height(k),ugprof(k),vgprof(k),wfls(k), & 3262 3264 & dqtdxls(k),dqtdyls(k),dqtdtls(k),thlpcar(k) 3265 end do 3266 do k=1,kmax 3267 if (height(k) .ne. height1(k)) then 3268 print *, 'fichiers prof.inp et lscale.inp incompatibles :' 3269 print *, 'les niveaux different : ',k,height1(k), height(k) 3270 stop 3271 endif 3263 3272 end do 3264 3273 close(ilesfile) -
LMDZ5/branches/testing/libf/phylmd/dyn1d/1D_interp_cases.h
r2408 r2594 2 2 ! $Id$ 3 3 ! 4 !--------------------------------------------------------------------- 5 ! Forcing_LES case: constant dq_dyn 6 !--------------------------------------------------------------------- 7 if (forcing_LES) then 8 DO l = 1,llm 9 d_q_adv(l,1) = dq_dyn(l,1) 10 ENDDO 11 endif ! forcing_LES 12 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 4 13 !--------------------------------------------------------------------- 5 14 ! Interpolation forcing in time and onto model levels -
LMDZ5/branches/testing/libf/phylmd/dyn1d/lmdz1d.F90
r2488 r2594 33 33 USE mod_1D_cases_read 34 34 USE mod_1D_amma_read 35 USE print_control_mod, ONLY: prt_level35 USE print_control_mod, ONLY: lunout, prt_level 36 36 USE iniphysiq_mod, ONLY: iniphysiq 37 37 USE mod_const_mpi, ONLY: comm_lmdz … … 54 54 #include "fcg_gcssold.h" 55 55 !!!#include "fbforcing.h" 56 #include "compbl.h" 56 57 57 58 !===================================================================== … … 242 243 !--------------------------------------------------------------------- 243 244 integer :: k,l,i,it=1,mxcalc 245 integer :: nsrf 244 246 integer jcode 245 247 INTEGER read_climoz … … 738 740 t_ancien(1,:)=temp(:) 739 741 q_ancien(1,:)=q(:,1) 740 pbl_tke(:,:,:)=1.e-8 741 wake_delta_pbl_tke(:,:,:)=0. 742 !jyg< 743 !! pbl_tke(:,:,:)=1.e-8 744 pbl_tke(:,:,:)=0. 745 pbl_tke(:,2,:)=1.e-2 746 PRINT *, ' pbl_tke dans lmdz1d ' 747 DO nsrf = 1,4 748 PRINT *,'pbl_tke(1,:,',nsrf,') ',pbl_tke(1,:,nsrf) 749 ENDDO 750 751 !>jyg 742 752 743 753 rain_fall=0. … … 762 772 wake_deltaq = 0. 763 773 wake_deltat = 0. 764 wake_delta_pbl_TKE = 0.774 wake_delta_pbl_TKE(:,:,:) = 0. 765 775 delta_tsurf = 0. 766 776 wake_fip = 0. … … 791 801 ! run_off_lic_0,pbl_tke(:,1:klev,nsrf), zmax0,f0,sig1,w01 792 802 ! wake_deltat,wake_deltaq,wake_s,wake_cstar,wake_fip,wake_delta_pbl_tke(:,1:klev,nsrf) 803 ! 804 ! NB2: The content of the startphy.nc file depends on some flags defined in 805 ! the ".def" files. However, since conf_phys is not called in lmdz1d.F90, these flags have 806 ! to be set at some arbitratry convenient values. 793 807 !------------------------------------------------------------------------ 794 808 !Al1 =============== restart option ========================== 795 809 if (.not.restart) then 810 iflag_pbl = 5 796 811 call phyredem ("startphy.nc") 797 812 else … … 1075 1090 !--------------------------------------------------------------------- 1076 1091 1077 IF (nudge_tsoil ) THEN1092 IF (nudge_tsoil .AND. .NOT. lastcall) THEN 1078 1093 ftsoil(1,isoil_nudge,:) = ftsoil(1,isoil_nudge,:) & 1079 1094 & -timestep/tau_soil_nudge*(ftsoil(1,isoil_nudge,:)-Tsoil_nudge) -
LMDZ5/branches/testing/libf/phylmd/grid_noro_m.F90
r2408 r2594 3 3 !******************************************************************************* 4 4 5 USE print_control_mod, ONLY: lunout 6 USE assert_eq_m, ONLY: assert_eq 5 7 PRIVATE 6 PUBLIC :: grid_noro 8 PUBLIC :: grid_noro, grid_noro0 7 9 8 10 … … 45 47 ! on the edge are contained in input cells. 46 48 !=============================================================================== 47 USE assert_eq_m, ONLY: assert_eq 48 USE print_control_mod, ONLY: lunout 49 IMPLICIT NONE 50 REAL, PARAMETER :: epsfra = 1.e-5 49 IMPLICIT NONE 51 50 !------------------------------------------------------------------------------- 52 51 ! Arguments: … … 315 314 !------------------------------------------------------------------------------- 316 315 ! 316 SUBROUTINE grid_noro0(xd,yd,zd,x,y,zphi,mask) 317 ! 318 !=============================================================================== 319 ! Purpose: Extracted from grid_noro to provide geopotential height for dynamics 320 ! without any call to physics subroutines. 321 !=============================================================================== 322 IMPLICIT NONE 323 !------------------------------------------------------------------------------- 324 ! Arguments: 325 REAL, INTENT(IN) :: xd(:), yd(:) !--- INPUT COORDINATES (imdp) (jmdp) 326 REAL, INTENT(IN) :: zd(:,:) !--- INPUT FIELD (imdp,jmdp) 327 REAL, INTENT(IN) :: x(:), y(:) !--- OUTPUT COORDINATES (imar+1) (jmar) 328 REAL, INTENT(OUT) :: zphi(:,:) !--- GEOPOTENTIAL (imar+1,jmar) 329 REAL, INTENT(INOUT):: mask(:,:) !--- MASK (imar+1,jmar) 330 !------------------------------------------------------------------------------- 331 ! Local variables: 332 CHARACTER(LEN=256) :: modname="grid_noro0" 333 REAL, ALLOCATABLE :: xusn(:), yusn(:) ! dim (imdp+2*iext) (jmdp+2) 334 REAL, ALLOCATABLE :: zusn(:,:) ! dim (imdp+2*iext,jmdp+2) 335 REAL, ALLOCATABLE :: weight(:,:) ! dim (imar+1,jmar) 336 REAL, ALLOCATABLE :: mask_tmp(:,:), zmea(:,:) ! dim (imar+1,jmar) 337 REAL, ALLOCATABLE :: num_tot(:,:), num_lan(:,:) ! dim (imax,jmax) 338 REAL, ALLOCATABLE :: a(:), b(:) ! dim (imax) 339 REAL, ALLOCATABLE :: c(:), d(:) ! dim (jmax) 340 LOGICAL :: masque_lu 341 INTEGER :: i, ii, imdp, imar, iext 342 INTEGER :: j, jj, jmdp, jmar, nn 343 REAL :: xpi, zlenx, weighx, xincr, zbordnor, zmeanor, zweinor, zbordest 344 REAL :: rad, zleny, weighy, masque, zbordsud, zmeasud, zweisud, zbordoue 345 !------------------------------------------------------------------------------- 346 imdp=assert_eq(SIZE(xd),SIZE(zd,1),TRIM(modname)//" imdp") 347 jmdp=assert_eq(SIZE(yd),SIZE(zd,2),TRIM(modname)//" jmdp") 348 imar=assert_eq(SIZE(x),SIZE(zphi,1),SIZE(mask,1),TRIM(modname)//" imar")-1 349 jmar=assert_eq(SIZE(y),SIZE(zphi,2),SIZE(mask,2),TRIM(modname)//" jmar") 350 ! IF(imar/=iim) CALL abort_gcm(TRIM(modname),'imar/=iim' ,1) 351 ! IF(jmar/=jjm+1) CALL abort_gcm(TRIM(modname),'jmar/=jjm+1',1) 352 iext=imdp/10 353 xpi = ACOS(-1.) 354 rad = 6371229. 355 356 !--- ARE WE USING A READ MASK ? 357 masque_lu=ANY(mask/=-99999.); IF(.NOT.masque_lu) mask=0.0 358 WRITE(lunout,*)'Masque lu: ',masque_lu 359 360 !--- EXTENSION OF THE INPUT DATABASE TO PROCEED COMPUTATIONS AT BOUNDARIES: 361 ALLOCATE(xusn(imdp+2*iext)) 362 xusn(1 +iext:imdp +iext)=xd(:) 363 xusn(1 : iext)=xd(1+imdp-iext:imdp)-2.*xpi 364 xusn(1+imdp+iext:imdp+2*iext)=xd(1 :iext)+2.*xpi 365 366 ALLOCATE(yusn(jmdp+2)) 367 yusn(1 )=yd(1) +(yd(1) -yd(2)) 368 yusn(2:jmdp+1)=yd(:) 369 yusn( jmdp+2)=yd(jmdp)+(yd(jmdp)-yd(jmdp-1)) 370 371 ALLOCATE(zusn(imdp+2*iext,jmdp+2)) 372 zusn(1 +iext:imdp +iext,2:jmdp+1)=zd (: , :) 373 zusn(1 : iext,2:jmdp+1)=zd (imdp-iext+1:imdp , :) 374 zusn(1+imdp +iext:imdp+2*iext,2:jmdp+1)=zd (1:iext , :) 375 zusn(1 :imdp/2+iext, 1)=zusn(1+imdp/2:imdp +iext, 2) 376 zusn(1+imdp/2+iext:imdp+2*iext, 1)=zusn(1 :imdp/2+iext, 2) 377 zusn(1 :imdp/2+iext, jmdp+2)=zusn(1+imdp/2:imdp +iext,jmdp+1) 378 zusn(1+imdp/2+iext:imdp+2*iext, jmdp+2)=zusn(1 :imdp/2+iext,jmdp+1) 379 380 !--- COMPUTE LIMITS OF MODEL GRIDPOINT AREA (REGULAR GRID) 381 ALLOCATE(a(imar+1),b(imar+1)) 382 b(1:imar)=(x(1:imar )+ x(2:imar+1))/2.0 383 b(imar+1)= x( imar+1)+(x( imar+1)-x(imar))/2.0 384 a(1)=x(1)-(x(2)-x(1))/2.0 385 a(2:imar+1)= b(1:imar) 386 387 ALLOCATE(c(jmar),d(jmar)) 388 d(1:jmar-1)=(y(1:jmar-1)+ y(2:jmar))/2.0 389 d( jmar )= y( jmar )+(y( jmar)-y(jmar-1))/2.0 390 c(1)=y(1)-(y(2)-y(1))/2.0 391 c(2:jmar)=d(1:jmar-1) 392 393 !--- INITIALIZATIONS: 394 ALLOCATE(weight(imar+1,jmar)); weight(:,:)= 0.0 395 ALLOCATE(zmea (imar+1,jmar)); zmea (:,:)= 0.0 396 397 !--- SUMMATION OVER GRIDPOINT AREA 398 zleny=xpi/REAL(jmdp)*rad 399 xincr=xpi/REAL(jmdp)/2. 400 ALLOCATE(num_tot(imar+1,jmar)); num_tot(:,:)=0. 401 ALLOCATE(num_lan(imar+1,jmar)); num_lan(:,:)=0. 402 DO ii = 1, imar+1 403 DO jj = 1, jmar 404 DO j = 2,jmdp+1 405 zlenx =zleny *COS(yusn(j)) 406 zbordnor=(xincr+c(jj)-yusn(j))*rad 407 zbordsud=(xincr-d(jj)+yusn(j))*rad 408 weighy=AMAX1(0.,AMIN1(zbordnor,zbordsud,zleny)) 409 IF(weighy/=0) THEN 410 DO i = 2, imdp+2*iext-1 411 zbordest=(xusn(i)-a(ii)+xincr)*rad*COS(yusn(j)) 412 zbordoue=(b(ii)+xincr-xusn(i))*rad*COS(yusn(j)) 413 weighx=AMAX1(0.,AMIN1(zbordest,zbordoue,zlenx)) 414 IF(weighx/=0)THEN 415 num_tot(ii,jj)=num_tot(ii,jj)+1.0 416 IF(zusn(i,j)>=1.)num_lan(ii,jj)=num_lan(ii,jj)+1.0 417 weight(ii,jj)=weight(ii,jj)+weighx*weighy 418 zmea (ii,jj)=zmea (ii,jj)+zusn(i,j)*weighx*weighy !--- MEAN 419 END IF 420 END DO 421 END IF 422 END DO 423 END DO 424 END DO 425 426 !--- COMPUTE PARAMETERS NEEDED BY LOTT & MILLER (1997) AND LOTT (1999) SSO SCHEME 427 IF(.NOT.masque_lu) THEN 428 WHERE(weight(:,1:jmar-1)/=0.0) mask=num_lan(:,:)/num_tot(:,:) 429 END IF 430 nn=COUNT(weight(:,1:jmar-1)==0.0) 431 IF(nn/=0) WRITE(lunout,*)'Problem with weight ; vanishing occurrences: ',nn 432 WHERE(weight/=0.0) zmea(:,:)=zmea(:,:)/weight(:,:) 433 434 !--- MASK BASED ON GROUND MAXIMUM, 10% THRESHOLD (<10%: SURF PARAMS MEANINGLESS) 435 ALLOCATE(mask_tmp(imar+1,jmar)); mask_tmp(:,:)=0.0 436 WHERE(mask>=0.1) mask_tmp = 1. 437 WHERE(weight(:,:)/=0.0) 438 zphi(:,:)=mask_tmp(:,:)*zmea(:,:) 439 zmea(:,:)=mask_tmp(:,:)*zmea(:,:) 440 END WHERE 441 WRITE(lunout,*)' MEAN ORO:' ,MAXVAL(zmea) 442 443 !--- Values at poles 444 zphi(imar+1,:)=zphi(1,:) 445 446 zweinor=SUM(weight(1:imar, 1),DIM=1) 447 zweisud=SUM(weight(1:imar,jmar),DIM=1) 448 zmeanor=SUM(weight(1:imar, 1)*zmea(1:imar, 1),DIM=1) 449 zmeasud=SUM(weight(1:imar,jmar)*zmea(1:imar,jmar),DIM=1) 450 zphi(:,1)=zmeanor/zweinor; zphi(:,jmar)=zmeasud/zweisud 451 452 END SUBROUTINE grid_noro0 453 ! 454 !------------------------------------------------------------------------------- 455 456 457 !------------------------------------------------------------------------------- 458 ! 317 459 SUBROUTINE MVA9(x) 318 460 ! -
LMDZ5/branches/testing/libf/phylmd/nuage.h
r2544 r2594 9 9 REAL tmax_fonte_cv 10 10 11 INTEGER iflag_t_glace, iflag_cld_cv11 INTEGER iflag_t_glace, iflag_cloudth_vert, iflag_cld_cv 12 12 13 13 common /nuagecom/ rad_froid,rad_chau1, rad_chau2,t_glace_max, & 14 14 & t_glace_min,exposant_glace,rei_min,rei_max, & 15 15 & tau_cld_cv,coefw_cld_cv, & 16 & iflag_t_glace,iflag_cld_cv,tmax_fonte_cv 16 & iflag_t_glace,iflag_cloudth_vert,iflag_cld_cv, & 17 & tmax_fonte_cv 17 18 !$OMP THREADPRIVATE(/nuagecom/) -
LMDZ5/branches/testing/libf/phylmd/phyetat0.F90
r2570 r2594 18 18 wake_deltat, wake_delta_pbl_TKE, delta_tsurf, wake_fip, wake_pe, & 19 19 wake_s, zgam, zmax0, zmea, zpic, zsig, & 20 zstd, zthe, zval, ale_bl, ale_bl_trig, alp_bl 20 zstd, zthe, zval, ale_bl, ale_bl_trig, alp_bl, u10m, v10m 21 21 USE geometry_mod, ONLY : longitude_deg, latitude_deg 22 22 USE iostart, ONLY : close_startphy, get_field, get_var, open_startphy … … 260 260 ENDDO 261 261 262 263 262 found=phyetat0_srf(1,u10m,"U10M","u a 10m",0.) 263 found=phyetat0_srf(1,v10m,"V10M","v a 10m",0.) 264 264 265 !=================================================================== 265 266 ! Lecture des temperatures du sol profond: -
LMDZ5/branches/testing/libf/phylmd/phyredem.F90
r2570 r2594 21 21 wake_pe, wake_fip, fm_therm, entr_therm, & 22 22 detr_therm, Ale_bl, Ale_bl_trig, Alp_bl, & 23 du_gwd_rando, du_gwd_front 23 du_gwd_rando, du_gwd_front, u10m, v10m 24 24 USE geometry_mod, ONLY : longitude_deg, latitude_deg 25 25 USE iostart, ONLY: open_restartphy, close_restartphy, put_field, put_var … … 153 153 154 154 155 CALL put_field_srf1("U10M", "u a 10m", u10m) 156 157 CALL put_field_srf1("V10M", "v a 10m", v10m) 158 159 155 160 ! ================== Tsoil ========================================= 156 161 CALL put_field_srf2("Tsoil","Temperature",tsoil(:,:,:)) -
LMDZ5/branches/testing/libf/phylmd/phys_local_var_mod.F90
r2542 r2594 16 16 REAL, SAVE, ALLOCATABLE :: u_seri(:,:), v_seri(:,:) 17 17 !$OMP THREADPRIVATE(u_seri, v_seri) 18 REAL, SAVE, ALLOCATABLE :: l_mixmin(:,:,:), l_mix(:,:,:) 19 !$OMP THREADPRIVATE(l_mixmin, l_mix) 18 20 19 21 REAL, SAVE, ALLOCATABLE :: tr_seri(:,:,:) … … 406 408 allocate(t_seri(klon,klev),q_seri(klon,klev),ql_seri(klon,klev),qs_seri(klon,klev)) 407 409 allocate(u_seri(klon,klev),v_seri(klon,klev)) 410 allocate(l_mixmin(klon,klev,nbsrf), l_mix(klon,klev,nbsrf)) 411 l_mix(:,:,:)=0. ; l_mixmin(:,:,:)=0. ! doit etre initialse car pas toujours remplis 408 412 409 413 allocate(tr_seri(klon,klev,nbtr)) … … 625 629 deallocate(t_seri,q_seri,ql_seri,qs_seri) 626 630 deallocate(u_seri,v_seri) 631 deallocate(l_mixmin,l_mix) 627 632 628 633 deallocate(tr_seri) -
LMDZ5/branches/testing/libf/phylmd/phys_output_ctrlout_mod.F90
r2542 r2594 41 41 42 42 !!! 2D 43 44 ! Marine 45 46 TYPE(ctrl_out), SAVE :: o_alt_tropo = ctrl_out((/1,1,1,1,1,10,10,10,10/),& 47 'alt_tropo','Tropopause pressure','hPa',& 48 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 49 "inst(X)", "inst(X)","inst(X)" /)) 50 51 TYPE(ctrl_out), SAVE :: o_map_prop_hc = ctrl_out((/1,1,1,1,1,10,10,10,10/),& 52 'map_prop_hc','Proportion of high clouds',' ',& 53 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 54 "inst(X)", "inst(X)","inst(X)" /)) 55 56 TYPE(ctrl_out), SAVE :: o_map_prop_hist = & 57 ctrl_out((/1,1,1,1,1,1,10,10,10/),& 58 'map_prop_hist','Proportion of high ice semi-transp clouds',' ',& 59 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 60 "inst(X)", "inst(X)","inst(X)" /)) 61 62 TYPE(ctrl_out), SAVE :: o_map_emis_hc = & 63 ctrl_out((/1,1,1,1,1,1,10,10,10/),& 64 'map_emis_hc','Emissivity of high clouds',' ',& 65 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 66 "inst(X)", "inst(X)","inst(X)" /)) 67 68 TYPE(ctrl_out), SAVE :: o_map_iwp_hc = & 69 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 70 'map_iwp_hc','Ice water path of high clouds','g/m2',& 71 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 72 "inst(X)", "inst(X)","inst(X)" /)) 73 74 TYPE(ctrl_out), SAVE :: o_map_deltaz_hc = & 75 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 76 'map_deltaz_hc','geom thickness of high clouds','m',& 77 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 78 "inst(X)", "inst(X)","inst(X)" /)) 79 80 TYPE(ctrl_out), SAVE :: o_map_pcld_hc = & 81 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 82 'map_pcld_hc','cloud pressure of high clouds','hPa',& 83 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 84 "inst(X)", "inst(X)","inst(X)" /)) 85 86 TYPE(ctrl_out), SAVE :: o_map_tcld_hc = & 87 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 88 'map_tcld_hc','cloud temperature of high clouds','K',& 89 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 90 "inst(X)", "inst(X)","inst(X)" /)) 91 92 93 TYPE(ctrl_out), SAVE :: o_map_emis_hist = & 94 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 95 'map_emis_hist','Emissivity of high ice st clouds',' ',& 96 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 97 "inst(X)", "inst(X)","inst(X)" /)) 98 99 TYPE(ctrl_out), SAVE :: o_map_iwp_hist = & 100 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 101 'map_iwp_hist','Ice water path of high ice st clouds','g/m2',& 102 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 103 "inst(X)", "inst(X)","inst(X)" /)) 104 105 TYPE(ctrl_out), SAVE :: o_map_deltaz_hist = & 106 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 107 'map_deltaz_hist','geom thickness of high ice st clouds','m',& 108 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 109 "inst(X)", "inst(X)","inst(X)" /)) 110 111 TYPE(ctrl_out), SAVE :: o_map_rad_hist = & 112 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 113 'map_rad_hist','ice crystals radius in high ice st clouds','µm',& 114 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 115 "inst(X)", "inst(X)","inst(X)" /)) 116 117 118 TYPE(ctrl_out), SAVE :: o_map_emis_Cb = & 119 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 120 'map_emis_Cb','Emissivity of high Cb clouds',' ',& 121 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 122 "inst(X)", "inst(X)","inst(X)" /)) 123 124 TYPE(ctrl_out), SAVE :: o_map_pcld_Cb = & 125 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 126 'map_pcld_Cb','cloud pressure of high Cb clouds','hPa',& 127 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 128 "inst(X)", "inst(X)","inst(X)" /)) 129 130 TYPE(ctrl_out), SAVE :: o_map_tcld_Cb = & 131 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 132 'map_tcld_Cb','cloud temperature of high Cb clouds','K',& 133 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 134 "inst(X)", "inst(X)","inst(X)" /)) 135 136 137 TYPE(ctrl_out), SAVE :: o_map_emis_Anv = & 138 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 139 'map_emis_Anv','Emissivity of high Anv clouds',' ',& 140 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 141 "inst(X)", "inst(X)","inst(X)" /)) 142 143 TYPE(ctrl_out), SAVE :: o_map_pcld_Anv = & 144 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 145 'map_pcld_Anv','cloud pressure of high Anv clouds','hPa',& 146 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 147 "inst(X)", "inst(X)","inst(X)" /)) 148 149 TYPE(ctrl_out), SAVE :: o_map_tcld_Anv = & 150 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 151 'map_tcld_Anv','cloud temperature of high Anv clouds','K',& 152 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 153 "inst(X)", "inst(X)","inst(X)" /)) 154 155 TYPE(ctrl_out), SAVE :: o_map_emis_ThCi = & 156 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 157 'map_emis_ThCi','Emissivity of high ThCi clouds',' ',& 158 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 159 "inst(X)", "inst(X)","inst(X)" /)) 160 161 TYPE(ctrl_out), SAVE :: o_map_pcld_ThCi = & 162 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 163 'map_pcld_ThCi','cloud pressure of high ThCi clouds','hPa',& 164 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 165 "inst(X)", "inst(X)","inst(X)" /)) 166 167 TYPE(ctrl_out), SAVE :: o_map_tcld_ThCi = & 168 ctrl_out((/10,10,1,10,10,10,10,10,10/),& 169 'map_tcld_ThCi','cloud temperature of high ThCi clouds','K',& 170 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 171 "inst(X)", "inst(X)","inst(X)" /)) 172 173 TYPE(ctrl_out), SAVE :: o_map_ntot = & 174 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 175 'map_ntot','total AIRS cloud fraction',' ',& 176 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 177 "inst(X)", "inst(X)","inst(X)" /)) 178 179 TYPE(ctrl_out), SAVE :: o_map_hc = & 180 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 181 'map_hc','high clouds AIRS cloud fraction',' ',& 182 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 183 "inst(X)", "inst(X)","inst(X)" /)) 184 185 TYPE(ctrl_out), SAVE :: o_map_hist = & 186 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 187 'map_hist','high clouds ice st AIRS cloud fraction',' ',& 188 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 189 "inst(X)", "inst(X)","inst(X)" /)) 190 191 TYPE(ctrl_out), SAVE :: o_map_Cb = & 192 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 193 'map_Cb','high clouds Cb AIRS cloud fraction',' ',& 194 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 195 "inst(X)", "inst(X)","inst(X)" /)) 196 197 TYPE(ctrl_out), SAVE :: o_map_ThCi = & 198 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 199 'map_ThCi','high clouds ThCi AIRS cloud fraction',' ',& 200 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 201 "inst(X)", "inst(X)","inst(X)" /)) 202 203 TYPE(ctrl_out), SAVE :: o_map_Anv = & 204 ctrl_out((/1,1,1,1,1,10,10,10,10/),& 205 'map_Anv','high clouds Anv AIRS cloud fraction',' ',& 206 (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)",& 207 "inst(X)", "inst(X)","inst(X)" /)) 208 209 210 ! Fin Marine 211 43 212 TYPE(ctrl_out), SAVE :: o_flat = ctrl_out((/ 5, 1, 10, 10, 5, 10, 11, 11, 11 /), & 44 213 'flat', 'Latent heat flux', 'W/m2', (/ ('', i=1, 9) /)) … … 745 914 TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_srf = (/ & 746 915 ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_ter', & 747 "Max Turb. Kinetic Energy "//clnsurf(1)," -", (/ ('', i=1, 9) /)), &916 "Max Turb. Kinetic Energy "//clnsurf(1),"m2/s2", (/ ('', i=1, 9) /)), & 748 917 ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_lic', & 749 "Max Turb. Kinetic Energy "//clnsurf(2)," -", (/ ('', i=1, 9) /)), &918 "Max Turb. Kinetic Energy "//clnsurf(2),"m2/s2", (/ ('', i=1, 9) /)), & 750 919 ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_oce', & 751 "Max Turb. Kinetic Energy "//clnsurf(3)," -", (/ ('', i=1, 9) /)), &920 "Max Turb. Kinetic Energy "//clnsurf(3),"m2/s2", (/ ('', i=1, 9) /)), & 752 921 ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_sic', & 753 "Max Turb. Kinetic Energy "//clnsurf(4),"-", (/ ('', i=1, 9) /)) /) 922 "Max Turb. Kinetic Energy "//clnsurf(4),"m2/s2", (/ ('', i=1, 9) /)) /) 923 924 TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_l_mixmin = (/ & 925 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mixmin_ter', & 926 "PBL mixing length "//clnsurf(1),"m", (/ ('', i=1, 9) /)), & 927 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mixmin_lic', & 928 "PBL mixing length "//clnsurf(2),"m", (/ ('', i=1, 9) /)), & 929 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mixmin_oce', & 930 "PBL mixing length "//clnsurf(3),"m", (/ ('', i=1, 9) /)), & 931 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mixmin_sic', & 932 "PBL mixing length "//clnsurf(4),"m", (/ ('', i=1, 9) /)) /) 933 934 TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_l_mix = (/ & 935 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mix_ter', & 936 "min PBL mixing length "//clnsurf(1),"m", (/ ('', i=1, 9) /)), & 937 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mix_lic', & 938 "min PBL mixing length "//clnsurf(2),"m", (/ ('', i=1, 9) /)), & 939 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mix_oce', & 940 "min PBL mixing length "//clnsurf(3),"m", (/ ('', i=1, 9) /)), & 941 ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'l_mix_sic', & 942 "min PBL mixing length "//clnsurf(4),"m", (/ ('', i=1, 9) /)) /) 754 943 755 944 TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_max_srf = (/ & … … 968 1157 'ovapinit', 'Specific humidity (begin of timestep)', 'kg/kg', (/ ('', i=1, 9) /)) 969 1158 TYPE(ctrl_out), SAVE :: o_oliq = ctrl_out((/ 2, 3, 4, 10, 10, 10, 11, 11, 11 /), & 970 'oliq', 'Condensed water', 'kg/kg', (/ ('', i=1, 9) /)) 1159 'oliq', 'Liquid water', 'kg/kg', (/ ('', i=1, 9) /)) 1160 TYPE(ctrl_out), SAVE :: o_ocond = ctrl_out((/ 2, 3, 4, 10, 10, 10, 11, 11, 11 /), & 1161 'ocond', 'Condensed water', 'kg/kg', (/ ('', i=1, 9) /)) 971 1162 TYPE(ctrl_out), SAVE :: o_wvapp = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), & 972 1163 'wvapp', '', '', (/ ('', i=1, 9) /)) -
LMDZ5/branches/testing/libf/phylmd/phys_output_mod.F90
r2542 r2594 56 56 include "clesphys.h" 57 57 include "thermcell.h" 58 include "YOMCST.h" 58 59 59 60 ! ug Nouveaux arguments n\'ecessaires au histwrite_mod: … … 263 264 ELSE 264 265 CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian) 265 CALL ymds2ju(annee_ref, 1, day_ini, start_time , zjulian_start)266 CALL ymds2ju(annee_ref, 1, day_ini, start_time*rday, zjulian_start) 266 267 END IF 267 268 -
LMDZ5/branches/testing/libf/phylmd/phys_output_var_mod.F90
r2542 r2594 16 16 INTEGER, SAVE, ALLOCATABLE :: itau_con(:) ! Nombre de pas ou rflag <= 1 17 17 !$OMP THREADPRIVATE(itau_con) 18 REAL, ALLOCATABLE :: bils_ec(:) ! Contribution of energy conservation19 REAL, ALLOCATABLE :: bils_ech(:) ! Contribution of energy conservation20 REAL, ALLOCATABLE :: bils_tke(:) ! Contribution of energy conservation21 REAL, ALLOCATABLE :: bils_diss(:) ! Contribution of energy conservation22 REAL, ALLOCATABLE :: bils_kinetic(:) ! bilan de chaleur au sol, kinetic23 REAL, ALLOCATABLE :: bils_enthalp(:) ! bilan de chaleur au sol24 REAL, ALLOCATABLE :: bils_latent(:) ! bilan de chaleur au sol18 REAL, SAVE, ALLOCATABLE :: bils_ec(:) ! Contribution of energy conservation 19 REAL, SAVE, ALLOCATABLE :: bils_ech(:) ! Contribution of energy conservation 20 REAL, SAVE, ALLOCATABLE :: bils_tke(:) ! Contribution of energy conservation 21 REAL, SAVE, ALLOCATABLE :: bils_diss(:) ! Contribution of energy conservation 22 REAL, SAVE, ALLOCATABLE :: bils_kinetic(:) ! bilan de chaleur au sol, kinetic 23 REAL, SAVE, ALLOCATABLE :: bils_enthalp(:) ! bilan de chaleur au sol 24 REAL, SAVE, ALLOCATABLE :: bils_latent(:) ! bilan de chaleur au sol 25 25 !$OMP THREADPRIVATE(bils_ec,bils_ech,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent) 26 26 27 ! Marine 28 ! Variables de sortie du simulateur AIRS 29 30 REAL, SAVE, ALLOCATABLE :: map_prop_hc(:),map_prop_hist(:),alt_tropo(:) 31 !$OMP THREADPRIVATE(map_prop_hc,map_prop_hist,alt_tropo) 32 REAL, SAVE, ALLOCATABLE :: map_emis_hc(:),map_iwp_hc(:),map_deltaz_hc(:), & 33 map_pcld_hc(:),map_tcld_hc(:) 34 !$OMP THREADPRIVATE(map_emis_hc,map_iwp_hc,map_deltaz_hc,map_pcld_hc,map_tcld_hc) 35 REAL, SAVE, ALLOCATABLE :: map_emis_hist(:),map_iwp_hist(:),map_deltaz_hist(:),map_rad_hist(:) 36 !$OMP THREADPRIVATE(map_emis_hist,map_iwp_hist,map_deltaz_hist,map_rad_hist) 37 REAL, SAVE, ALLOCATABLE :: map_ntot(:),map_hc(:),map_hist(:) 38 REAL, SAVE, ALLOCATABLE :: map_Cb(:),map_ThCi(:),map_Anv(:) 39 !$OMP THREADPRIVATE(map_ntot,map_hc,map_hist,map_Cb,map_ThCi,map_Anv) 40 REAL, SAVE, ALLOCATABLE :: map_emis_Cb(:),map_pcld_Cb(:),map_tcld_Cb(:) 41 REAL, SAVE, ALLOCATABLE :: map_emis_ThCi(:),map_pcld_ThCi(:),map_tcld_ThCi(:) 42 !$OMP THREADPRIVATE(map_emis_Cb,map_pcld_Cb,map_tcld_Cb,map_emis_ThCi) 43 REAL, SAVE, ALLOCATABLE :: map_emis_Anv(:),map_pcld_Anv(:),map_tcld_Anv(:) 44 !$OMP THREADPRIVATE(map_pcld_ThCi,map_tcld_ThCi,map_emis_Anv,map_pcld_Anv,map_tcld_Anv) 45 27 46 28 47 ! ug Plein de variables venues de phys_output_mod … … 103 122 allocate (bils_ec(klon),bils_ech(klon),bils_tke(klon),bils_diss(klon),bils_kinetic(klon),bils_enthalp(klon),bils_latent(klon)) 104 123 124 ! Marine 125 ! Variables de sortie simulateur AIRS 126 127 ! if (ok_airs) then 128 allocate (map_prop_hc(klon),map_prop_hist(klon)) 129 allocate (alt_tropo(klon)) 130 allocate (map_emis_hc(klon),map_iwp_hc(klon),map_deltaz_hc(klon)) 131 allocate (map_pcld_hc(klon),map_tcld_hc(klon)) 132 allocate (map_emis_hist(klon),map_iwp_hist(klon),map_deltaz_hist(klon)) 133 allocate (map_rad_hist(klon)) 134 allocate (map_ntot(klon),map_hc(klon),map_hist(klon)) 135 allocate (map_Cb(klon),map_ThCi(klon),map_Anv(klon)) 136 allocate (map_emis_Cb(klon),map_pcld_Cb(klon),map_tcld_Cb(klon)) 137 allocate (map_emis_ThCi(klon),map_pcld_ThCi(klon),map_tcld_ThCi(klon)) 138 allocate (map_emis_Anv(klon),map_pcld_Anv(klon),map_tcld_Anv(klon)) 139 ! endif 140 105 141 IF (ok_hines) allocate(zustr_gwd_hines(klon), zvstr_gwd_hines(klon)) 106 142 IF (.not.ok_hines.and.ok_gwd_rando) & … … 115 151 IMPLICIT NONE 116 152 153 include "clesphys.h" 154 117 155 deallocate(snow_o,zfra_o,itau_con) 118 156 deallocate (bils_ec,bils_ech,bils_tke,bils_diss,bils_kinetic,bils_enthalp,bils_latent) 157 158 ! Marine 159 ! Variables de sortie simulateur AIRS 160 161 ! if (ok_airs) then 162 deallocate (map_prop_hc,map_prop_hist) 163 deallocate (alt_tropo) 164 deallocate (map_emis_hc,map_iwp_hc,map_deltaz_hc) 165 deallocate (map_pcld_hc,map_tcld_hc) 166 deallocate (map_emis_hist,map_iwp_hist,map_deltaz_hist) 167 deallocate (map_rad_hist) 168 deallocate (map_ntot,map_hc,map_hist) 169 deallocate (map_Cb,map_ThCi,map_Anv) 170 deallocate (map_emis_Cb,map_pcld_Cb,map_tcld_Cb) 171 deallocate (map_emis_ThCi,map_pcld_ThCi,map_tcld_ThCi) 172 deallocate (map_emis_Anv,map_pcld_Anv,map_tcld_Anv) 173 ! endif 119 174 120 175 END SUBROUTINE phys_output_var_end -
LMDZ5/branches/testing/libf/phylmd/phys_output_write_mod.F90
r2542 r2594 60 60 o_fsw_srf, o_wbils_srf, o_wbilo_srf, & 61 61 o_tke_srf, o_tke_max_srf,o_dltpbltke_srf, o_wstar, & 62 o_l_mixmin,o_l_mix, & 62 63 o_cdrm, o_cdrh, o_cldl, o_cldm, o_cldh, & 63 64 o_cldt, o_JrNt, o_cldljn, o_cldmjn, & … … 116 117 o_lcc3dstra, o_reffclwtop, o_ec550aer, & 117 118 o_lwcon, o_iwcon, o_temp, o_theta, & 118 o_ovapinit, o_ovap, o_oliq, o_ geop, &119 o_ovapinit, o_ovap, o_oliq, o_ocond, o_geop, & 119 120 o_vitu, o_vitv, o_vitw, o_pres, o_paprs, & 120 121 o_zfull, o_zhalf, o_rneb, o_rnebjn, o_rnebcon, & … … 167 168 o_sens_prec_sol_oce, o_sens_prec_sol_sic, & 168 169 o_lat_prec_liq_oce, o_lat_prec_liq_sic, & 169 o_lat_prec_sol_oce, o_lat_prec_sol_sic 170 o_lat_prec_sol_oce, o_lat_prec_sol_sic, & 171 ! Marine 172 o_map_prop_hc, o_map_prop_hist, o_map_emis_hc, o_map_iwp_hc, & 173 o_map_deltaz_hc, o_map_pcld_hc, o_map_tcld_hc, & 174 o_map_emis_hist, o_map_iwp_hist, o_map_deltaz_hist, & 175 o_map_rad_hist, & 176 o_map_emis_Cb, o_map_pcld_Cb, o_map_tcld_Cb, & 177 o_map_emis_ThCi, o_map_pcld_ThCi, o_map_tcld_ThCi, & 178 o_map_emis_Anv, o_map_pcld_Anv, o_map_tcld_Anv, & 179 o_map_ntot, o_map_hc,o_map_hist,o_map_Cb,o_map_ThCi,o_map_Anv, & 180 o_alt_tropo 181 170 182 171 183 USE phys_state_var_mod, only: pctsrf, paire_ter, rain_fall, snow_fall, & … … 198 210 USE phys_local_var_mod, only: zxfluxlat, slp, ptstar, pt0, zxtsol, zt2m, & 199 211 t2m_min_mon, t2m_max_mon, evap, & 212 l_mixmin,l_mix, & 200 213 zu10m, zv10m, zq2m, zustar, zxqsurf, & 201 214 rain_lsc, rain_num, snow_lsc, bils, sens, fder, & … … 237 250 lcc, lcc3d, lcc3dcon, lcc3dstra, reffclwtop, & 238 251 ec550aer, flwc, fiwc, t_seri, theta, q_seri, & 239 ql_seri, tr_seri, &252 ql_seri, qs_seri, tr_seri, & 240 253 zphi, u_seri, v_seri, omega, cldfra, & 241 254 rneb, rnebjn, zx_rh, d_t_dyn, & … … 262 275 zustr_gwd_hines, zvstr_gwd_hines,zustr_gwd_rando, zvstr_gwd_rando, & 263 276 zustr_gwd_front, zvstr_gwd_front, & 264 sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o 277 sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o, & 278 ! Marine 279 map_prop_hc, map_prop_hist, & 280 map_emis_hc,map_iwp_hc,map_deltaz_hc,& 281 map_pcld_hc,map_tcld_hc,& 282 map_emis_hist,map_iwp_hist,map_deltaz_hist,& 283 map_rad_hist,& 284 map_ntot,map_hc,map_hist,& 285 map_Cb,map_ThCi,map_Anv,& 286 map_emis_Cb,map_pcld_Cb,map_tcld_Cb,& 287 map_emis_ThCi,map_pcld_ThCi,map_tcld_ThCi,& 288 map_emis_Anv,map_pcld_Anv,map_tcld_Anv, & 289 alt_tropo 290 265 291 266 292 … … 331 357 332 358 ! On calcul le nouveau tau: 333 itau_w = itau_phy + itap + start_time * day_step_phy359 itau_w = itau_phy + itap 334 360 ! On le donne à iophy pour que les histwrite y aient accès: 335 361 CALL set_itau_iophy(itau_w) … … 378 404 CALL histwrite_phy(o_aireTER, paire_ter) 379 405 !!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 406 ! Simulateur AIRS 407 IF (ok_airs) then 408 CALL histwrite_phy(o_alt_tropo,alt_tropo) 409 410 CALL histwrite_phy(o_map_prop_hc,map_prop_hc) 411 CALL histwrite_phy(o_map_prop_hist,map_prop_hist) 412 413 CALL histwrite_phy(o_map_emis_hc,map_emis_hc) 414 CALL histwrite_phy(o_map_iwp_hc,map_iwp_hc) 415 CALL histwrite_phy(o_map_deltaz_hc,map_deltaz_hc) 416 CALL histwrite_phy(o_map_pcld_hc,map_pcld_hc) 417 CALL histwrite_phy(o_map_tcld_hc,map_tcld_hc) 418 419 CALL histwrite_phy(o_map_emis_hist,map_emis_hist) 420 CALL histwrite_phy(o_map_iwp_hist,map_iwp_hist) 421 CALL histwrite_phy(o_map_deltaz_hist,map_deltaz_hist) 422 423 CALL histwrite_phy(o_map_ntot,map_ntot) 424 CALL histwrite_phy(o_map_hc,map_hc) 425 CALL histwrite_phy(o_map_hist,map_hist) 426 427 CALL histwrite_phy(o_map_Cb,map_Cb) 428 CALL histwrite_phy(o_map_ThCi,map_ThCi) 429 CALL histwrite_phy(o_map_Anv,map_Anv) 430 431 CALL histwrite_phy(o_map_emis_Cb,map_emis_Cb) 432 CALL histwrite_phy(o_map_pcld_Cb,map_pcld_Cb) 433 CALL histwrite_phy(o_map_tcld_Cb,map_tcld_Cb) 434 435 CALL histwrite_phy(o_map_emis_ThCi,map_emis_ThCi) 436 CALL histwrite_phy(o_map_pcld_ThCi,map_pcld_ThCi) 437 CALL histwrite_phy(o_map_tcld_ThCi,map_tcld_ThCi) 438 439 CALL histwrite_phy(o_map_emis_Anv,map_emis_Anv) 440 CALL histwrite_phy(o_map_pcld_Anv,map_pcld_Anv) 441 CALL histwrite_phy(o_map_tcld_Anv,map_tcld_Anv) 442 ENDIF 443 380 444 CALL histwrite_phy(o_flat, zxfluxlat) 381 445 CALL histwrite_phy(o_ptstar, ptstar) … … 619 683 IF (iflag_pbl > 1) THEN 620 684 CALL histwrite_phy(o_tke_srf(nsrf), pbl_tke(:,1:klev,nsrf)) 685 CALL histwrite_phy(o_l_mix(nsrf), l_mix(:,1:klev,nsrf)) 686 CALL histwrite_phy(o_l_mixmin(nsrf), l_mixmin(:,1:klev,nsrf)) 621 687 CALL histwrite_phy(o_tke_max_srf(nsrf), pbl_tke(:,1:klev,nsrf)) 622 688 ENDIF … … 1055 1121 CALL histwrite_phy(o_ovap, q_seri) 1056 1122 CALL histwrite_phy(o_oliq, ql_seri) 1123 CALL histwrite_phy(o_ocond, ql_seri+qs_seri) 1057 1124 CALL histwrite_phy(o_geop, zphi) 1058 1125 CALL histwrite_phy(o_vitu, u_seri) -
LMDZ5/branches/testing/libf/phylmd/physiq_mod.F90
r2570 r2594 1077 1077 !RC 1078 1078 ustar(:,:)=0. 1079 u10m(:,:)=0.1080 v10m(:,:)=0.1079 ! u10m(:,:)=0. 1080 ! v10m(:,:)=0. 1081 1081 rain_con(:)=0. 1082 1082 snow_con(:)=0. … … 1165 1165 1166 1166 CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0) 1167 !jyg< 1167 1168 IF (klon_glo==1) THEN 1168 coefh=0. ; coefm=0. ; pbl_tke=0. 1169 coefh(:,2,:)=1.e-2 ; coefm(:,2,:)=1.e-2 ; pbl_tke(:,2,:)=1.e-2 1170 PRINT*,'FH WARNING : lignes a supprimer' 1169 pbl_tke(:,:,is_ave) = 0. 1170 DO nsrf=1,nbsrf 1171 DO k = 1,klev+1 1172 pbl_tke(:,k,is_ave) = pbl_tke(:,k,is_ave) & 1173 +pctsrf(:,nsrf)*pbl_tke(:,k,nsrf) 1174 ENDDO 1175 ENDDO 1176 !>jyg 1171 1177 ENDIF 1172 1178 !IM begin … … 1424 1430 klon, & 1425 1431 nqtot, & 1432 nqo, & 1426 1433 pdtphys, & 1427 1434 annee_ref, & … … 2294 2301 wake_pe, wake_fip, & 2295 2302 Ale_bl, Ale_bl_trig, Alp_bl, & 2296 Ale, Alp )2303 Ale, Alp , Ale_wake, Alp_wake) 2297 2304 !>jyg 2298 2305 ! … … 2776 2783 !jyg< 2777 2784 ! 2778 CALL alpale_th( dtime, lmax_th, t_seri, &2785 CALL alpale_th( dtime, lmax_th, t_seri, cell_area, & 2779 2786 cin, s2, n2, & 2780 2787 ale_bl_trig, ale_bl_stat, ale_bl, & 2781 alp_bl, alp_bl_stat ) 2788 alp_bl, alp_bl_stat, & 2789 proba_notrig, random_notrig) 2790 2791 ! ------------------------------------------------------------------ 2792 ! Transport de la TKE par les panaches thermiques. 2793 ! FH : 2010/02/01 2794 ! if (iflag_pbl.eq.10) then 2795 ! call thermcell_dtke(klon,klev,nbsrf,pdtphys,fm_therm,entr_therm, 2796 ! s rg,paprs,pbl_tke) 2797 ! endif 2798 ! ------------------------------------------------------------------- 2782 2799 2783 2800 do i=1,klon … … 3931 3948 #endif 3932 3949 ENDIF !ok_cosp 3950 3951 3952 ! Marine 3953 3954 IF (ok_airs) then 3955 3956 IF (itap.eq.1.or.MOD(itap,NINT(freq_airs/dtime)).EQ.0) THEN 3957 write(*,*) 'je vais appeler simu_airs, ok_airs, freq_airs=', & 3958 & ok_airs, freq_airs 3959 call simu_airs(itap,rneb, t_seri, cldemi, fiwc, ref_ice, pphi, pplay, paprs,& 3960 & map_prop_hc,map_prop_hist,& 3961 & map_emis_hc,map_iwp_hc,map_deltaz_hc,map_pcld_hc,map_tcld_hc,& 3962 & map_emis_Cb,map_pcld_Cb,map_tcld_Cb,& 3963 & map_emis_ThCi,map_pcld_ThCi,map_tcld_ThCi,& 3964 & map_emis_Anv,map_pcld_Anv,map_tcld_Anv,& 3965 & map_emis_hist,map_iwp_hist,map_deltaz_hist,map_rad_hist,& 3966 & map_ntot,map_hc,map_hist,& 3967 & map_Cb,map_ThCi,map_Anv,& 3968 & alt_tropo ) 3969 ENDIF 3970 3971 ENDIF ! ok_airs 3972 3973 3933 3974 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3934 3975 !AA -
LMDZ5/branches/testing/libf/phylmd/readaerosolstrato.F90
r2542 r2594 55 55 data piz_strat /0.9999998, 0.99762493/ 56 56 data cg_strat /0.73107845,0.73229635/ 57 real, dimension(nwave ) :: alpha_strat_wave57 real, dimension(nwave_sw) :: alpha_strat_wave 58 58 data alpha_strat_wave/3.36780953,3.34667683,3.20444202,3.0293026,2.82108808/ 59 59 … … 153 153 154 154 !--total vertical aod at the 6 wavelengths 155 DO wave=1, nwave 155 DO wave=1, nwave_sw 156 156 DO k=1, klev 157 157 tausum_aero(:,wave,id_STRAT_phy)=tausum_aero(:,wave,id_STRAT_phy)+tau_aer_strat(:,k)*alpha_strat_wave(wave)/alpha_strat_wave(2) -
LMDZ5/branches/testing/libf/phylmd/rrtm/aeropt_5wv_rrtm.F90
r2211 r2594 70 70 ! Local 71 71 ! 72 INTEGER, PARAMETER :: las = nwave 72 INTEGER, PARAMETER :: las = nwave_sw 73 73 LOGICAL :: soluble 74 74 -
LMDZ5/branches/testing/libf/phylmd/rrtm/readaerosolstrato1_rrtm.F90
r2542 r2594 61 61 !--diagnostics AOD in the SW 62 62 ! alpha_sw_strat_wave is *not* normalised by the 550 nm extinction coefficient 63 real, dimension(nwave ) :: alpha_sw_strat_wave63 real, dimension(nwave_sw) :: alpha_sw_strat_wave 64 64 data alpha_sw_strat_wave/3.708007,4.125824,4.136584,3.887478,3.507738/ 65 65 ! 66 !--diagnostics AOD in the LW at 10 um 67 real :: alpha_lw_strat_wave 66 !--diagnostics AOD in the LW at 10 um (not normalised by the 550 nm ext coefficient 67 real :: alpha_lw_strat_wave(nwave_lw) 68 68 data alpha_lw_strat_wave/0.2746812/ 69 69 ! … … 171 171 172 172 !--total vertical aod at the 5 SW wavelengths 173 DO wave=1, nwave 173 DO wave=1, nwave_sw 174 174 DO k=1, klev 175 tausum_aero(:,wave,id_STRAT_phy)=tausum_aero(:,wave,id_STRAT_phy)+ &176 tau_aer_strat(:,k)*alpha_sw_strat_wave(wave)/alpha_sw_strat_wave(2)175 tausum_aero(:,wave,id_STRAT_phy)=tausum_aero(:,wave,id_STRAT_phy)+ & 176 tau_aer_strat(:,k)*alpha_sw_strat_wave(wave)/alpha_sw_strat_wave(2) 177 177 ENDDO 178 178 ENDDO … … 210 210 ENDIF 211 211 212 !--total vertical aod at the 1 LW wavelength 213 DO wave=1, nwave_lw 214 DO k=1, klev 215 tausum_aero(:,nwave_sw+wave,id_STRAT_phy)=tausum_aero(:,nwave_sw+wave,id_STRAT_phy)+ & 216 tau_aer_strat(:,k)*alpha_lw_strat_wave(wave)/alpha_sw_strat_wave(2) 217 ENDDO 218 ENDDO 219 212 220 DO band=1, nbands_lw_rrtm 213 221 tau_aero_lw_rrtm(:,:,2,band) = tau_aero_lw_rrtm(:,:,2,band) + alpha_lw_abs_rrtm(band)*tau_aer_strat(:,:) -
LMDZ5/branches/testing/libf/phylmd/rrtm/readaerosolstrato2_rrtm.F90
r2542 r2594 269 269 !--total vertical aod at the 5 SW wavelengths 270 270 !--for now use band 3 AOD into all 5 wavelengths 271 !--it is only a reasonable approximation for 550 nm (wave=2) 271 272 band=3 272 273 DO i=1, klon 273 274 DO k=1, klev 274 275 IF (stratomask(i,k).GT.0.999999) THEN 275 DO wave=1, nwave 276 tausum_aero( :,wave,id_STRAT_phy)=tausum_aero(:,wave,id_STRAT_phy)+tau_aer_strat(:,k,band)276 DO wave=1, nwave_sw 277 tausum_aero(i,wave,id_STRAT_phy)=tausum_aero(i,wave,id_STRAT_phy)+tau_aer_strat(i,k,band) 277 278 ENDDO 278 279 ENDIF … … 308 309 ENDDO 309 310 311 !--total vertical aod at 10 um 312 !--this is approximated from band 7 of RRTM 313 band=7 314 DO i=1, klon 315 DO k=1, klev 316 IF (stratomask(i,k).GT.0.999999) THEN 317 DO wave=1, nwave_lw 318 tausum_aero(i,nwave_sw+wave,id_STRAT_phy)=tausum_aero(i,nwave_sw+wave,id_STRAT_phy)+taulw_aer_strat(i,k,band) 319 ENDDO 320 ENDIF 321 ENDDO 322 ENDDO 323 310 324 DO band=1, NLW 311 325 WHERE (stratomask.GT.0.999999) -
LMDZ5/branches/testing/libf/phylmd/surf_land_mod.F90
r2435 r2594 24 24 USE surface_data, ONLY : ok_veget 25 25 26 ! See comments in each module surf_land_orchidee_xxx for compatiblity with ORCHIDEE 26 27 #ifdef ORCHIDEE_NOOPENMP 28 ! Compilation with cpp key ORCHIDEE NOOPENMP 27 29 USE surf_land_orchidee_noopenmp_mod 28 30 #else 31 #if ORCHIDEE_NOZ0H 32 ! Compilation with cpp key ORCHIDEE NOZ0H 33 USE surf_land_orchidee_noz0h_mod 34 #else 35 ! Compilation with default interface 29 36 USE surf_land_orchidee_mod 30 37 #endif 38 #endif 39 31 40 USE surf_land_bucket_mod 32 41 USE calcul_fluxs_mod … … 141 150 evap, fluxsens, fluxlat, & 142 151 tsol_rad, tsurf_new, alb1_new, alb2_new, & 143 emis_new, z0m, qsurf) 144 z0h(1:knon)=z0m(1:knon) ! En attendant mieux 152 emis_new, z0m, z0h, qsurf) 145 153 146 154 ! -
LMDZ5/branches/testing/libf/phylmd/surf_land_orchidee_mod.F90
r2435 r2594 2 2 MODULE surf_land_orchidee_mod 3 3 #ifndef ORCHIDEE_NOOPENMP 4 #ifndef ORCHIDEE_NOZ0H 4 5 ! 5 6 ! This module controles the interface towards the model ORCHIDEE. 6 7 ! 7 8 ! Compatibility with ORCHIDIEE : 8 ! The current version can be used with ORCHIDEE/trunk from revision 2961. 9 ! This interface can also be used with ORCHIDEE/trunk revision 1078-2960 if changing 10 ! coszang=yrmu0 into sinang=yrmu0 at 2 places later below in this module. 9 ! The current version can be used with ORCHIDEE/trunk from revision 3525. 10 ! This interface is used if none of the cpp keys ORCHIDEE_NOOPENMP or ORCHIDEE_NOZ0H is set. 11 11 ! 12 12 ! Subroutines in this module : surf_land_orchidee … … 44 44 evap, fluxsens, fluxlat, & 45 45 tsol_rad, tsurf_new, alb1_new, alb2_new, & 46 emis_new, z0 _new, qsurf)46 emis_new, z0m_new, z0h_new, qsurf) 47 47 48 48 USE mod_surf_para … … 104 104 ! alb2_new albedo in near IR interval 105 105 ! emis_new emissivite 106 ! z0_new surface roughness 106 ! z0m_new surface roughness for momentum 107 ! z0h_new surface roughness for heat 107 108 ! qsurf air moisture at surface 108 109 ! … … 137 138 REAL, DIMENSION(klon), INTENT(OUT) :: tsol_rad, tsurf_new 138 139 REAL, DIMENSION(klon), INTENT(OUT) :: alb1_new, alb2_new 139 REAL, DIMENSION(klon), INTENT(OUT) :: emis_new, z0 _new140 REAL, DIMENSION(klon), INTENT(OUT) :: emis_new, z0m_new, z0h_new 140 141 141 142 ! Local … … 403 404 404 405 #ifdef CPP_VEGET 405 CALL intersurf_main (itime+itau_phy-1, nbp_lon, nbp_lat, knon, ktindex, dtime, & 406 lrestart_read, lrestart_write, lalo, & 407 contfrac, neighbours, resolution, date0, & 408 zlev, u1_lay, v1_lay, spechum, temp_air, epot_air, ccanopy, & 406 CALL intersurf_initialize_gathered (itime+itau_phy-1, nbp_lon, nbp_lat, knon, ktindex, dtime, & 407 lrestart_read, lrestart_write, lalo, contfrac, neighbours, resolution, date0, & 408 zlev, u1_lay, v1_lay, spechum, temp_air, epot_air, & 409 409 cdrag, petA_orc, peqA_orc, petB_orc, peqB_orc, & 410 410 precip_rain, precip_snow, lwdown, swnet, swdown, ps, & 411 411 evap, fluxsens, fluxlat, coastalflow, riverflow, & 412 tsol_rad, tsurf_new, qsurf, albedo_out, emis_new, z0 _new, &413 lon_scat, lat_scat, q2m, t2m, coszang=yrmu0)412 tsol_rad, tsurf_new, qsurf, albedo_out, emis_new, z0m_new, & 413 lon_scat, lat_scat, q2m, t2m, z0h_new) 414 414 #endif 415 415 ENDIF … … 427 427 IF (knon > 0) THEN 428 428 #ifdef CPP_VEGET 429 CALL intersurf_main (itime+itau_phy, nbp_lon, nbp_lat, knon, ktindex, dtime, &429 CALL intersurf_main_gathered (itime+itau_phy, nbp_lon, nbp_lat, knon, ktindex, dtime, & 430 430 lrestart_read, lrestart_write, lalo, & 431 431 contfrac, neighbours, resolution, date0, & … … 434 434 precip_rain(1:knon), precip_snow(1:knon), lwdown(1:knon), swnet(1:knon), swdown_vrai(1:knon), ps(1:knon), & 435 435 evap(1:knon), fluxsens(1:knon), fluxlat(1:knon), coastalflow(1:knon), riverflow(1:knon), & 436 tsol_rad(1:knon), tsurf_new(1:knon), qsurf(1:knon), albedo_out(1:knon,:), emis_new(1:knon), z0 _new(1:knon), &437 lon_scat, lat_scat, q2m, t2m, coszang=yrmu0(1:knon))436 tsol_rad(1:knon), tsurf_new(1:knon), qsurf(1:knon), albedo_out(1:knon,:), emis_new(1:knon), z0m_new(1:knon), & 437 lon_scat, lat_scat, q2m, t2m, z0h_new(1:knon), coszang=yrmu0(1:knon)) 438 438 #endif 439 439 ENDIF … … 664 664 ! 665 665 #endif 666 #endif 666 667 END MODULE surf_land_orchidee_mod -
LMDZ5/branches/testing/libf/phylmd/surf_land_orchidee_noopenmp_mod.F90
r2435 r2594 38 38 knindex, rlon, rlat, yrmu0, pctsrf, & 39 39 debut, lafin, & 40 plev, u1_lay, v1_lay, temp_air, spechum, epot_air, ccanopy, &40 plev, u1_lay, v1_lay, gustiness, temp_air, spechum, epot_air, ccanopy, & 41 41 tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, & 42 42 precip_rain, precip_snow, lwdown, swnet, swdown, & … … 44 44 evap, fluxsens, fluxlat, & 45 45 tsol_rad, tsurf_new, alb1_new, alb2_new, & 46 emis_new, z0_new, qsurf)46 emis_new, z0_new, z0h_new, qsurf) 47 47 ! 48 48 ! Cette routine sert d'interface entre le modele atmospherique et le … … 95 95 ! emis_new emissivite 96 96 ! z0_new surface roughness 97 ! z0h_new surface roughness, it is the same as z0_new 97 98 ! qsurf air moisture at surface 98 99 ! … … 121 122 REAL, DIMENSION(klon), INTENT(IN) :: yrmu0 122 123 REAL, DIMENSION(klon), INTENT(IN) :: plev 123 REAL, DIMENSION(klon), INTENT(IN) :: u1_lay, v1_lay 124 REAL, DIMENSION(klon), INTENT(IN) :: u1_lay, v1_lay, gustiness 124 125 REAL, DIMENSION(klon), INTENT(IN) :: temp_air, spechum 125 126 REAL, DIMENSION(klon), INTENT(IN) :: epot_air, ccanopy … … 136 137 REAL, DIMENSION(klon), INTENT(OUT) :: tsol_rad, tsurf_new 137 138 REAL, DIMENSION(klon), INTENT(OUT) :: alb1_new, alb2_new 138 REAL, DIMENSION(klon), INTENT(OUT) :: emis_new, z0_new 139 REAL, DIMENSION(klon), INTENT(OUT) :: emis_new, z0_new, z0h_new 139 140 140 141 ! Local … … 496 497 497 498 albedo_keep(1:knon) = (albedo_out(1:knon,1)+albedo_out(1:knon,2))/2. 499 500 ! ORCHIDEE only gives one value for z0_new. Copy it into z0h_new. 501 z0h_new(:)=z0_new(:) 498 502 499 503 !* Send to coupler -
LMDZ5/branches/testing/libf/phylmd/time_phylmdz_mod.F90
r2488 r2594 83 83 USE print_control_mod, ONLY: lunout 84 84 IMPLICIT NONE 85 INCLUDE 'YOMCST.h' 85 86 REAL,INTENT(IN) :: pdtphys_ 86 87 REAL :: julian_date … … 94 95 95 96 ! Update elapsed time since begining of run: 96 current_time=current_time+pdtphys 97 current_time=current_time+pdtphys/rday 97 98 98 99 ! Compute corresponding Julian date and update calendar 99 CALL ymds2ju(annee_ref,1,day_ini, start_time+current_time,julian_date)100 CALL ymds2ju(annee_ref,1,day_ini,(start_time+current_time)*rday,julian_date) 100 101 CALL phys_cal_update(julian_date) 101 102 -
LMDZ5/branches/testing/libf/phylmd/yamada4.F90
r2471 r2594 1 2 ! $Header$ 3 4 SUBROUTINE yamada4(ngrid, dt, g, rconst, plev, temp, zlev, zlay, u, v, teta, & 1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 3 SUBROUTINE yamada4(ni, nsrf, ngrid, dt, g, rconst, plev, temp, zlev, zlay, u, v, teta, & 5 4 cd, q2, km, kn, kq, ustar, iflag_pbl) 5 6 6 USE dimphy 7 USE print_control_mod, ONLY: prt_level8 7 USE ioipsl_getin_p_mod, ONLY : getin_p 9 8 10 9 IMPLICIT NONE 11 10 include "iniprint.h" 11 ! ....................................................................... 12 ! ym#include "dimensions.h" 13 ! ym#include "dimphy.h" 14 ! ************************************************************************************************ 15 ! 16 ! yamada4: subroutine qui calcule le transfert turbulent avec une fermeture d'ordre 2 ou 2.5 17 ! 18 ! Reference: Simulation of nocturnal drainage flows by a q2l Turbulence Closure Model 19 ! Yamada T. 20 ! J. Atmos. Sci, 40, 91-106, 1983 21 ! 22 !************************************************************************************************ 23 ! Input : 24 !'====== 25 ! ni: indice horizontal sur la grille de base, non restreinte 26 ! nsrf: type de surface 27 ! ngrid: nombre de mailles concern??es sur l'horizontal 12 28 ! dt : pas de temps 13 29 ! g : g 30 ! rconst: constante de l'air sec 14 31 ! zlev : altitude a chaque niveau (interface inferieure de la couche 15 32 ! de meme indice) … … 17 34 ! u,v : vitesse au centre de chaque couche 18 35 ! (en entree : la valeur au debut du pas de temps) 19 ! teta : temperature potentielle au centre de chaque couche36 ! teta : temperature potentielle virtuelle au centre de chaque couche 20 37 ! (en entree : la valeur au debut du pas de temps) 21 ! cd : cdrag 38 ! cd : cdrag pour la quantit?? de mouvement 22 39 ! (en entree : la valeur au debut du pas de temps) 40 ! ustar: vitesse de friction calcul??e par une formule diagnostique 41 ! iflag_pbl: flag pour choisir des options du sch??ma de turbulence 42 ! 43 ! iflag_pbl doit valoir entre 6 et 9 44 ! l=6, on prend systematiquement une longueur d'equilibre 45 ! iflag_pbl=6 : MY 2.0 46 ! iflag_pbl=7 : MY 2.0.Fournier 47 ! iflag_pbl=8/9 : MY 2.5 48 ! iflag_pbl=8 with special obsolete treatments for convergence 49 ! with Cmpi5 NPv3.1 simulations 50 ! iflag_pbl=10/11 : New scheme M2 and N2 explicit and dissiptation exact 51 ! iflag_pbl=12 = 11 with vertical diffusion off q2 52 ! 53 ! 2013/04/01 (FH hourdin@lmd.jussieu.fr) 54 ! Correction for very stable PBLs (iflag_pbl=10 and 11) 55 ! iflag_pbl=8 converges numerically with NPv3.1 56 ! iflag_pbl=11 -> the model starts with NP from start files created by ce0l 57 ! -> the model can run with longer time-steps. 58 ! 59 ! Inpout/Output : 60 !============== 23 61 ! q2 : $q^2$ au bas de chaque couche 24 62 ! (en entree : la valeur au debut du pas de temps) 25 63 ! (en sortie : la valeur a la fin du pas de temps) 64 65 ! Outputs: 66 !========== 26 67 ! km : diffusivite turbulente de quantite de mouvement (au bas de chaque 27 68 ! couche) … … 29 70 ! kn : diffusivite turbulente des scalaires (au bas de chaque couche) 30 71 ! (en sortie : la valeur a la fin du pas de temps) 31 32 ! iflag_pbl doit valoir entre 6 et 9 33 ! l=6, on prend systematiquement une longueur d'equilibre 34 ! iflag_pbl=6 : MY 2.0 35 ! iflag_pbl=7 : MY 2.0.Fournier 36 ! iflag_pbl=8/9 : MY 2.5 37 ! iflag_pbl=8 with special obsolete treatments for convergence 38 ! with Cmpi5 NPv3.1 simulations 39 ! iflag_pbl=10/11 : New scheme M2 and N2 explicit and dissiptation exact 40 ! iflag_pbl=12 = 11 with vertical diffusion off q2 41 42 ! 2013/04/01 (FH hourdin@lmd.jussieu.fr) 43 ! Correction for very stable PBLs (iflag_pbl=10 and 11) 44 ! iflag_pbl=8 converges numerically with NPv3.1 45 ! iflag_pbl=11 -> the model starts with NP from start files created by ce0l 46 ! -> the model can run with longer time-steps. 47 ! ....................................................................... 48 72 ! 73 !....................................................................... 74 75 !======================================================================= 76 ! Declarations: 77 !======================================================================= 78 79 80 ! Inputs/Outputs 81 !---------------- 49 82 REAL dt, g, rconst 50 83 REAL plev(klon, klev+1), temp(klon, klev) … … 57 90 REAL teta(klon, klev) 58 91 REAL cd(klon) 59 REAL q2(klon, klev+1) , qpre92 REAL q2(klon, klev+1) 60 93 REAL unsdz(klon, klev) 61 94 REAL unsdzdec(klon, klev+1) 62 95 REAL kn(klon, klev+1) 63 96 REAL km(klon, klev+1) 64 REAL kmpre(klon, klev+1), tmp2 97 INTEGER iflag_pbl, ngrid, nsrf 98 INTEGER ni(klon) 99 100 101 ! Local 102 !------- 103 104 INCLUDE "clesphys.h" 105 106 107 REAL kmpre(klon, klev+1), tmp2, qpre 65 108 REAL mpre(klon, klev+1) 66 REAL kn(klon, klev+1)67 109 REAL kq(klon, klev+1) 68 110 REAL ff(klon, klev+1), delta(klon, klev+1) 69 111 REAL aa(klon, klev+1), aa0, aa1 70 INTEGER iflag_pbl, ngrid71 112 INTEGER nlay, nlev 72 73 113 LOGICAL first 74 114 INTEGER ipas … … 77 117 DATA first, ipas/.FALSE., 0/ 78 118 !$OMP THREADPRIVATE( first,ipas) 79 REAL,SAVE :: lmixmin=1. 80 !$OMP THREADPRIVATE(lmixmin) 81 82 119 LOGICAL hboville 83 120 INTEGER ig, k 84 85 86 121 REAL ri, zrif, zalpha, zsm, zsn 87 122 REAL rif(klon, klev+1), sm(klon, klev+1), alpha(klon, klev) 88 89 123 REAL m2(klon, klev+1), dz(klon, klev+1), zq, n2(klon, klev+1) 90 124 REAL dtetadz(klon, klev+1) 91 125 REAL m2cstat, mcstat, kmcstat 92 126 REAL l(klon, klev+1) 93 REAL, ALLOCATABLE, SAVE :: l0(:) 94 !$OMP THREADPRIVATE(l0) 95 REAL sq(klon), sqz(klon), zz(klon, klev+1) 127 REAL zz(klon, klev+1) 96 128 INTEGER iter 97 98 129 REAL ric, rifc, b1, kap 99 130 SAVE ric, rifc, b1, kap 100 131 DATA ric, rifc, b1, kap/0.195, 0.191, 16.6, 0.4/ 101 132 !$OMP THREADPRIVATE(ric,rifc,b1,kap) 133 REAL seuilsm, seuilalpha 134 REAL,SAVE :: lmixmin 135 !$OMP THREADPRIVATE(lmixmin) 102 136 REAL frif, falpha, fsm 103 REAL fl, zzz, zl0, zq2, zn2104 105 137 REAL rino(klon, klev+1), smyam(klon, klev), styam(klon, klev), & 106 138 lyam(klon, klev), knyam(klon, klev), w2yam(klon, klev), t2yam(klon, klev) 107 139 LOGICAL, SAVE :: firstcall = .TRUE. 108 140 !$OMP THREADPRIVATE(firstcall) 141 142 143 ! Fonctions utilis??es 144 !-------------------- 145 109 146 frif(ri) = 0.6588*(ri+0.1776-sqrt(ri*ri-0.3221*ri+0.03156)) 110 147 falpha(ri) = 1.318*(0.2231-ri)/(0.2341-ri) 111 148 fsm(ri) = 1.96*(0.1912-ri)*(0.2341-ri)/((1.-ri)*(0.2231-ri)) 112 fl(zzz, zl0, zq2, zn2) = max(min(l0(ig)*kap*zlev(ig, & 113 k)/(kap*zlev(ig,k)+l0(ig)),0.5*sqrt(q2(ig,k))/sqrt( & 114 max(n2(ig,k),1.E-10))), lmixmin) 115 116 117 nlay = klev 118 nlev = klev + 1 149 119 150 120 151 IF (firstcall) THEN 121 ALLOCATE (l0(klon))122 152 firstcall = .FALSE. 153 lmixmin=1. 123 154 CALL getin_p('lmixmin',lmixmin) 124 155 END IF 156 157 158 159 !=============================================================================== 160 ! Flags, tests et ??valuations de constantes 161 !=============================================================================== 162 163 ! On utilise ou non la routine de Holstalg Boville pour les cas tres stables 164 hboville=.TRUE. 125 165 126 166 … … 129 169 END IF 130 170 171 ! Seuil dans le code de turbulence 172 seuilalpha=1.12 173 seuilsm=0.085 174 175 nlay = klev 176 nlev = klev + 1 131 177 ipas = ipas + 1 132 178 133 179 134 ! ....................................................................... 135 ! les increments verticaux 136 ! ....................................................................... 137 138 ! !!!!! allerte !!!!!c 139 ! !!!!! zlev n'est pas declare a nlev !!!!!c 140 ! !!!!! ----> 180 !======================================================================== 181 ! Calcul des increments verticaux 182 !========================================================================= 183 184 185 ! Attention: zlev n'est pas declare a nlev 141 186 DO ig = 1, ngrid 142 187 zlev(ig, nlev) = zlay(ig, nlay) + (zlay(ig,nlay)-zlev(ig,nlev-1)) 143 188 END DO 144 ! !!!!! <---- 145 ! !!!!! allerte !!!!!c 189 146 190 147 191 DO k = 1, nlay … … 162 206 END DO 163 207 164 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 165 ! Computing M^2, N^2, Richardson numbers, stability functions 166 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 167 ! initialize arrays: 168 m2(:, :) = 0.0 169 sm(:, :) = 0.0 170 rif(:, :) = 0.0 171 208 !========================================================================= 209 ! Richardson number and stability functions 210 !========================================================================= 211 212 ! initialize arrays: 213 214 m2(1:ngrid, :) = 0.0 215 sm(1:ngrid, :) = 0.0 216 rif(1:ngrid, :) = 0.0 217 218 !------------------------------------------------------------ 172 219 DO k = 2, klev 220 173 221 DO ig = 1, ngrid 174 222 dz(ig, k) = zlay(ig, k) - zlay(ig, k-1) … … 177 225 dtetadz(ig, k) = (teta(ig,k)-teta(ig,k-1))/dz(ig, k) 178 226 n2(ig, k) = g*2.*dtetadz(ig, k)/(teta(ig,k-1)+teta(ig,k)) 179 ! n2(ig,k)=0.180 227 ri = n2(ig, k)/max(m2(ig,k), 1.E-10) 181 228 IF (ri<ric) THEN … … 184 231 rif(ig, k) = rifc 185 232 END IF 233 186 234 IF (rif(ig,k)<0.16) THEN 187 235 alpha(ig, k) = falpha(rif(ig,k)) 188 236 sm(ig, k) = fsm(rif(ig,k)) 189 237 ELSE 190 alpha(ig, k) = 1.12191 sm(ig, k) = 0.085238 alpha(ig, k) = seuilalpha 239 sm(ig, k) = seuilsm 192 240 END IF 193 241 zz(ig, k) = b1*m2(ig, k)*(1.-rif(ig,k))*sm(ig, k) … … 196 244 197 245 198 ! ==================================================================== 199 ! Computing the mixing length 200 ! ==================================================================== 201 202 ! Mise a jour de l0 203 IF (iflag_pbl==8 .OR. iflag_pbl==10) THEN 204 205 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 206 ! Iterative computation of l0 207 ! This version is kept for iflag_pbl only for convergence 208 ! with NPv3.1 Cmip5 simulations 209 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 210 211 DO ig = 1, ngrid 212 sq(ig) = 1.E-10 213 sqz(ig) = 1.E-10 214 END DO 215 DO k = 2, klev - 1 216 DO ig = 1, ngrid 217 zq = sqrt(q2(ig,k)) 218 sqz(ig) = sqz(ig) + zq*zlev(ig, k)*(zlay(ig,k)-zlay(ig,k-1)) 219 sq(ig) = sq(ig) + zq*(zlay(ig,k)-zlay(ig,k-1)) 220 END DO 221 END DO 222 DO ig = 1, ngrid 223 l0(ig) = 0.2*sqz(ig)/sq(ig) 224 END DO 246 247 ! ==================================================================== 248 ! Computing the mixing length 249 ! ==================================================================== 250 251 252 CALL mixinglength(ni,nsrf,ngrid,iflag_pbl,pbl_lmixmin_alpha,lmixmin,zlay,zlev,u,v,q2,n2, l) 253 254 255 256 !======================================================================= 257 ! DIFFERENT TYPES DE SCHEMA de YAMADA 258 !======================================================================= 259 260 !-------------- 261 ! Yamada 2.0 262 !-------------- 263 IF (iflag_pbl==6) THEN 264 265 DO k = 2, klev 266 q2(1:ngrid, k) = l(1:ngrid, k)**2*zz(1:ngrid, k) 267 END DO 268 269 270 !------------------ 271 ! Yamada 2.Fournier 272 !------------------ 273 274 ELSE IF (iflag_pbl==7) THEN 275 276 277 ! Calcul de l, km, au pas precedent 278 !.................................... 225 279 DO k = 2, klev 226 280 DO ig = 1, ngrid 227 l(ig, k) = fl(zlev(ig,k), l0(ig), q2(ig,k), n2(ig,k))228 END DO229 END DO230 ! print*,'L0 cas 8 ou 10 ',l0231 232 ELSE233 234 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!235 ! In all other case, the assymptotic mixing length l0 is imposed (100m)236 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!237 238 l0(:) = 150.239 DO k = 2, klev240 DO ig = 1, ngrid241 l(ig, k) = fl(zlev(ig,k), l0(ig), q2(ig,k), n2(ig,k))242 END DO243 END DO244 ! print*,'L0 cas autres ',l0245 246 END IF247 248 249 ! ====================================================================250 ! Yamada 2.0251 ! ====================================================================252 IF (iflag_pbl==6) THEN253 254 DO k = 2, klev255 q2(:, k) = l(:, k)**2*zz(:, k)256 END DO257 258 259 ELSE IF (iflag_pbl==7) THEN260 ! ====================================================================261 ! Yamada 2.Fournier262 ! ====================================================================263 264 ! Calcul de l, km, au pas precedent265 DO k = 2, klev266 DO ig = 1, ngrid267 ! print*,'SMML=',sm(ig,k),l(ig,k)268 281 delta(ig, k) = q2(ig, k)/(l(ig,k)**2*sm(ig,k)) 269 282 kmpre(ig, k) = l(ig, k)*sqrt(q2(ig,k))*sm(ig, k) 270 283 mpre(ig, k) = sqrt(m2(ig,k)) 271 ! print*,'0L=',k,l(ig,k),delta(ig,k),km(ig,k)272 284 END DO 273 285 END DO … … 278 290 mcstat = sqrt(m2cstat) 279 291 280 ! print*,'M2 L=',k,mpre(ig,k),mcstat 281 282 ! -----{puis on ecrit la valeur de q qui annule l'equation de m 283 ! supposee en q3} 292 ! Puis on ecrit la valeur de q qui annule l'equation de m supposee en q3 293 !......................................................................... 284 294 285 295 IF (k==2) THEN … … 293 303 (unsdz(ig,k)+unsdz(ig,k-1)) 294 304 END IF 295 ! print*,'T2 L=',k,tmp2 305 296 306 tmp2 = kmcstat/(sm(ig,k)/q2(ig,k))/l(ig, k) 297 307 q2(ig, k) = max(tmp2, 1.E-12)**(2./3.) 298 ! print*,'Q2 L=',k,q2(ig,k)299 308 300 309 END DO 301 310 END DO 302 311 312 313 ! ------------------------ 314 ! Yamada 2.5 a la Didi 315 !------------------------- 316 303 317 ELSE IF (iflag_pbl==8 .OR. iflag_pbl==9) THEN 304 ! ==================================================================== 305 ! Yamada 2.5 a la Didi 306 ! ==================================================================== 307 308 309 ! Calcul de l, km, au pas precedent 318 319 ! Calcul de l, km, au pas precedent 320 !.................................... 310 321 DO k = 2, klev 311 322 DO ig = 1, ngrid 312 ! print*,'SMML=',sm(ig,k),l(ig,k)313 323 delta(ig, k) = q2(ig, k)/(l(ig,k)**2*sm(ig,k)) 314 324 IF (delta(ig,k)<1.E-20) THEN 315 ! print*,'ATTENTION L=',k,' Delta=',delta(ig,k)316 325 delta(ig, k) = 1.E-20 317 326 END IF … … 319 328 aa0 = (m2(ig,k)-alpha(ig,k)*n2(ig,k)-delta(ig,k)/b1) 320 329 aa1 = (m2(ig,k)*(1.-rif(ig,k))-delta(ig,k)/b1) 321 ! abder print*,'AA L=',k,aa0,aa1,aa1/max(m2(ig,k),1.e-20)322 330 aa(ig, k) = aa1*dt/(delta(ig,k)*l(ig,k)) 323 ! print*,'0L=',k,l(ig,k),delta(ig,k),km(ig,k)324 331 qpre = sqrt(q2(ig,k)) 325 ! if (iflag_pbl.eq.8 ) then326 332 IF (aa(ig,k)>0.) THEN 327 333 q2(ig, k) = (qpre+aa(ig,k)*qpre*qpre)**2 … … 337 343 ! endif 338 344 q2(ig, k) = min(max(q2(ig,k),1.E-10), 1.E4) 339 ! print*,'Q2 L=',k,q2(ig,k),qpre*qpre340 345 END DO 341 346 END DO … … 343 348 ELSE IF (iflag_pbl>=10) THEN 344 349 345 ! print*,'Schema mixte D'346 ! print*,'Longueur ',l(:,:)347 350 DO k = 2, klev - 1 348 DO ig = 1, ngrid 349 l(ig, k) = max(l(ig,k), lmixmin) 350 km(ig, k) = l(ig, k)*sqrt(q2(ig,k))*sm(ig, k) 351 q2(ig, k) = q2(ig, k) + dt*km(ig, k)*m2(ig, k)*(1.-rif(ig,k)) 352 q2(ig, k) = min(max(q2(ig,k),1.E-10), 1.E4) 353 q2(ig, k) = 1./(1./sqrt(q2(ig,k))+dt/(2*l(ig,k)*b1)) 354 q2(ig, k) = q2(ig, k)*q2(ig, k) 355 END DO 351 km(1:ngrid, k) = l(1:ngrid, k)*sqrt(q2(1:ngrid,k))*sm(1:ngrid, k) 352 q2(1:ngrid, k) = q2(1:ngrid, k) + dt*km(1:ngrid, k)*m2(1:ngrid, k)*(1.-rif(1:ngrid,k)) 353 q2(1:ngrid, k) = min(max(q2(1:ngrid,k),1.E-10), 1.E4) 354 q2(1:ngrid, k) = 1./(1./sqrt(q2(1:ngrid,k))+dt/(2*l(1:ngrid,k)*b1)) 355 q2(1:ngrid, k) = q2(1:ngrid, k)*q2(1:ngrid, k) 356 356 END DO 357 357 … … 362 362 END IF ! Fin du cas 8 363 363 364 ! print*,'OK8'365 364 366 365 ! ==================================================================== 367 ! Calcul des coefficients de m �ange366 ! Calcul des coefficients de melange 368 367 ! ==================================================================== 368 369 369 DO k = 2, klev 370 ! print*,'k=',k371 370 DO ig = 1, ngrid 372 ! abde print*,'KML=',l(ig,k),q2(ig,k),sm(ig,k)373 371 zq = sqrt(q2(ig,k)) 374 km(ig, k) = l(ig, k)*zq*sm(ig, k) 375 kn(ig, k) = km(ig, k)*alpha(ig, k) 376 kq(ig, k) = l(ig, k)*zq*0.2 377 ! print*,'KML=',km(ig,k),kn(ig,k) 378 END DO 379 END DO 372 km(ig, k) = l(ig, k)*zq*sm(ig, k) ! For momentum 373 kn(ig, k) = km(ig, k)*alpha(ig, k) ! For scalars 374 kq(ig, k) = l(ig, k)*zq*0.2 ! For TKE 375 END DO 376 END DO 377 378 379 !==================================================================== 380 ! Transport diffusif vertical de la TKE par la TKE 381 !==================================================================== 382 383 380 384 ! initialize near-surface and top-layer mixing coefficients 381 kq(1:ngrid, 1) = kq(1:ngrid, 2) ! constant (ie no gradient) near the surface 382 kq(1:ngrid, klev+1) = 0 ! zero at the top 383 384 ! Transport diffusif vertical de la TKE. 385 !........................................................... 386 387 kq(1:ngrid, 1) = kq(1:ngrid, 2) ! constant (ie no gradient) near the surface 388 kq(1:ngrid, klev+1) = 0 ! zero at the top 389 390 ! Transport diffusif vertical de la TKE. 391 !....................................... 392 385 393 IF (iflag_pbl>=12) THEN 386 ! print*,'YAMADA VDIF' 387 q2(:, 1) = q2(:, 2) 394 q2(1:ngrid, 1) = q2(1:ngrid, 2) 388 395 CALL vdif_q2(dt, g, rconst, ngrid, plev, temp, kq, q2) 389 396 END IF 390 397 391 ! Traitement des cas noctrunes avec l'introduction d'une longueur 392 ! minilale. 393 394 ! ==================================================================== 395 ! Traitement particulier pour les cas tres stables. 396 ! D'apres Holtslag Boville. 398 399 !==================================================================== 400 ! Traitement particulier pour les cas tres stables, introduction d'une 401 ! longueur de m??lange minimale 402 !==================================================================== 403 ! 404 ! Reference: Local versus Nonlocal boundary-layer diffusion in a global climate model 405 ! Holtslag A.A.M. and Boville B.A. 406 ! J. Clim., 6, 1825-1842, 1993 407 408 409 IF (hboville) THEN 410 397 411 398 412 IF (prt_level>1) THEN 399 413 PRINT *, 'YAMADA4 0' 400 END IF !(prt_level>1) THEN 414 END IF 415 401 416 DO ig = 1, ngrid 402 417 coriol(ig) = 1.E-4 … … 404 419 END DO 405 420 406 ! print*,'pblhmin ',pblhmin407 ! Test a remettre 21 11 02408 ! test abd 13 05 02 if(0.eq.1) then409 421 IF (1==1) THEN 410 422 IF (iflag_pbl==8 .OR. iflag_pbl==10) THEN … … 419 431 END IF 420 432 IF (kn(ig,k)<kmin .OR. km(ig,k)<kmin) THEN 421 ! print*,'Seuil min Km K=',k,kmin,km(ig,k),kn(ig,k) 422 ! s ,sqrt(q2(ig,k)),pblhmin(ig),qmin/sm(ig,k) 433 423 434 kn(ig, k) = kmin 424 435 km(ig, k) = kmin 425 436 kq(ig, k) = kmin 426 ! la longueur de melange est suposee etre l= kap z 427 ! K=l q Sm d'ou q2=(K/l Sm)**2 437 438 ! la longueur de melange est suposee etre l= kap z 439 ! K=l q Sm d'ou q2=(K/l Sm)**2 440 428 441 q2(ig, k) = (qmin/sm(ig,k))**2 429 442 END IF … … 432 445 433 446 ELSE 434 435 447 DO k = 2, klev 436 448 DO ig = 1, ngrid … … 442 454 END IF 443 455 IF (kn(ig,k)<kmin .OR. km(ig,k)<kmin) THEN 444 ! print*,'Seuil min Km K=',k,kmin,km(ig,k),kn(ig,k)445 ! s ,sqrt(q2(ig,k)),pblhmin(ig),qmin/sm(ig,k)446 456 kn(ig, k) = kmin 447 457 km(ig, k) = kmin 448 458 kq(ig, k) = kmin 449 450 459 ! la longueur de melange est suposee etre l= kap z 460 ! K=l q Sm d'ou q2=(K/l Sm)**2 451 461 sm(ig, k) = 1. 452 462 alpha(ig, k) = 1. … … 463 473 END IF 464 474 475 END IF ! hboville 476 465 477 IF (prt_level>1) THEN 466 478 PRINT *, 'YAMADA4 1' 467 479 END IF !(prt_level>1) THEN 480 481 482 !====================================================== 483 ! Estimations de w'2 et T'2 d'apres Abdela et McFarlane 484 !====================================================== 485 ! 486 ! Reference: A New Second-Order Turbulence Closure Scheme for the Planetary Boundary Layer 487 ! Abdella K and McFarlane N 488 ! J. Atmos. Sci., 54, 1850-1867, 1997 489 468 490 ! Diagnostique pour stokage 491 !.......................... 469 492 470 493 IF (1==0) THEN … … 482 505 knyam(1:ngrid, 2:klev) = kn(1:ngrid, 2:klev) 483 506 484 ! Estimations de w'2 et T'2 d'apres Abdela et McFarlane 507 508 ! Calcul de w'2 et T'2 509 !....................... 485 510 486 511 w2yam(1:ngrid, 2:klev) = q2(1:ngrid, 2:klev)*0.24 + & … … 493 518 END IF 494 519 495 ! print*,'OKFIN' 520 !============================================================================ 521 496 522 first = .FALSE. 497 523 RETURN 524 525 498 526 END SUBROUTINE yamada4 527 528 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 529 530 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 499 531 SUBROUTINE vdif_q2(timestep, gravity, rconst, ngrid, plev, temp, kmy, q2) 532 500 533 USE dimphy 501 534 IMPLICIT NONE 502 503 ! dt : pas de temps 535 536 include "dimensions.h" 537 538 ! vdif_q2: subroutine qui calcule la diffusion de la TKE par la TKE 539 ! avec un schema implicite en temps avec 540 ! inversion d'un syst??me tridiagonal 541 ! 542 ! Reference: Description of the interface with the surface and 543 ! the computation of the turbulet diffusion in LMDZ 544 ! Technical note on LMDZ 545 ! Dufresne, J-L, Ghattas, J. and Grandpeix, J-Y 546 ! 547 !============================================================================ 548 ! Declarations 549 !============================================================================ 504 550 505 551 REAL plev(klon, klev+1) … … 516 562 INTEGER i, k 517 563 518 ! print*,'RD=',rconst 564 565 !========================================================================= 566 ! Calcul 567 !========================================================================= 568 519 569 DO k = 1, klev 520 570 DO i = 1, ngrid 521 ! test522 ! print*,'i,k',i,k523 ! print*,'temp(i,k)=',temp(i,k)524 ! print*,'(plev(i,k)-plev(i,k+1))=',plev(i,k),plev(i,k+1)525 571 zz = (plev(i,k)+plev(i,k+1))*gravity/(rconst*temp(i,k)) 526 572 kstar(i, k) = 0.125*(kmy(i,k+1)+kmy(i,k))*zz*zz/ & … … 546 592 denom(i, k) = deltap(i, k) + (1.-beta(i,k+1))*kstar(i, k) + & 547 593 kstar(i, k-1) 548 ! correction d'un bug 10 01 2001549 594 alpha(i, k) = (q2(i,k)*deltap(i,k)+kstar(i,k)*alpha(i,k+1))/denom(i, k) 550 595 beta(i, k) = kstar(i, k-1)/denom(i, k) … … 553 598 554 599 ! Si on recalcule q2(1) 600 !....................... 555 601 IF (1==0) THEN 556 602 DO i = 1, ngrid … … 559 605 END DO 560 606 END IF 561 ! sinon, on peut sauter cette boucle... 607 562 608 563 609 DO k = 2, klev + 1 … … 569 615 RETURN 570 616 END SUBROUTINE vdif_q2 571 SUBROUTINE vdif_q2e(timestep, gravity, rconst, ngrid, plev, temp, kmy, q2) 572 USE dimphy 617 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 618 619 620 621 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 622 SUBROUTINE vdif_q2e(timestep, gravity, rconst, ngrid, plev, temp, kmy, q2) 623 624 USE dimphy 573 625 IMPLICIT NONE 574 626 575 ! dt : pas de temps 627 include "dimensions.h" 628 ! 629 ! vdif_q2e: subroutine qui calcule la diffusion de TKE par la TKE 630 ! avec un schema explicite en temps 631 632 633 !==================================================== 634 ! Declarations 635 !==================================================== 576 636 577 637 REAL plev(klon, klev+1) … … 585 645 REAL denom(klon, klev+1), alpha(klon, klev+1), beta(klon, klev+1) 586 646 INTEGER ngrid 587 588 647 INTEGER i, k 648 649 650 !================================================== 651 ! Calcul 652 !================================================== 589 653 590 654 DO k = 1, klev … … 621 685 RETURN 622 686 END SUBROUTINE vdif_q2e 687 688 !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 689 690 691 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 692 693 SUBROUTINE mixinglength(ni, nsrf, ngrid,iflag_pbl,pbl_lmixmin_alpha,lmixmin,zlay,zlev,u,v,q2,n2, lmix) 694 695 696 697 USE dimphy 698 USE phys_state_var_mod, only: zstd, zsig, zmea 699 USE phys_local_var_mod, only: l_mixmin, l_mix 700 701 ! zstd: ecart type de la'altitud e sous-maille 702 ! zmea: altitude moyenne sous maille 703 ! zsig: pente moyenne de le maille 704 705 USE geometry_mod, only: cell_area 706 ! aire_cell: aire de la maille 707 708 IMPLICIT NONE 709 !************************************************************************* 710 ! Subrourine qui calcule la longueur de m??lange dans le sch??ma de turbulence 711 ! avec la formule de Blackadar 712 ! Calcul d'un minimum en fonction de l'orographie sous-maille: 713 ! L'id??e est la suivante: plus il y a de relief, plus il y a du m??lange 714 ! induit par les circulations meso et submeso ??chelles. 715 ! 716 ! References: * The vertical distribution of wind and turbulent exchange in a neutral atmosphere 717 ! Blackadar A.K. 718 ! J. Geophys. Res., 64, No 8, 1962 719 ! 720 ! * An evaluation of neutral and convective planetary boundary-layer parametrisations relative 721 ! to large eddy simulations 722 ! Ayotte K et al 723 ! Boundary Layer Meteorology, 79, 131-175, 1996 724 ! 725 ! 726 ! * Local Similarity in the Stable Boundary Layer and Mixing length Approaches: consistency of concepts 727 ! Van de Wiel B.J.H et al 728 ! Boundary-Lay Meteorol, 128, 103-166, 2008 729 ! 730 ! 731 ! Histoire: 732 !---------- 733 ! * premi??re r??daction, Etienne et Frederic, 09/06/2016 734 ! 735 ! *********************************************************************** 736 737 !================================================================== 738 ! Declarations 739 !================================================================== 740 741 ! Inputs 742 !------- 743 INTEGER ni(klon) ! indice sur la grille original (non restreinte) 744 INTEGER nsrf ! Type de surface 745 INTEGER ngrid ! Nombre de points concern??s sur l'horizontal 746 INTEGER iflag_pbl ! Choix du sch??ma de turbulence 747 REAL pbl_lmixmin_alpha ! on active ou non le calcul de la longueur de melange minimum 748 REAL lmixmin ! Minimum absolu de la longueur de m??lange 749 REAL zlay(klon, klev) ! altitude du centre de la couche 750 REAL zlev(klon, klev+1) ! atitude de l'interface inf??rieure de la couche 751 REAL u(klon, klev) ! vitesse du vent zonal 752 REAL v(klon, klev) ! vitesse du vent meridional 753 REAL q2(klon, klev+1) ! energie cin??tique turbulente 754 REAL n2(klon, klev+1) ! frequence de Brunt-Vaisala 755 756 !In/out 757 !------- 758 759 LOGICAL, SAVE :: firstcall = .TRUE. 760 !$OMP THREADPRIVATE(firstcall) 761 762 ! Outputs 763 !--------- 764 765 REAL lmix(klon, klev+1) ! Longueur de melange 766 767 768 ! Local 769 !------- 770 771 INTEGER ig,jg, k 772 REAL h_oro(klon) 773 REAL hlim(klon) 774 REAL, SAVE :: kap=0.4,kapb=0.4 775 REAL zq 776 REAL sq(klon), sqz(klon) 777 REAL, ALLOCATABLE, SAVE :: l0(:) 778 !$OMP THREADPRIVATE(l0) 779 REAL fl, zzz, zl0, zq2, zn2 780 REAL famorti, zzzz, zh_oro, zhlim 781 REAL l1(klon, klev+1), l2(klon,klev+1) 782 REAL winds(klon, klev) 783 REAL xcell 784 REAL zstdslope(klon) 785 REAL lmax 786 REAL l2strat, l2neutre, extent 787 REAL l2limit(klon) 788 !=============================================================== 789 ! Fonctions utiles 790 !=============================================================== 791 792 ! Calcul de l suivant la formule de Blackadar 1962 adapt??e par Ayotte 1996 793 !.......................................................................... 794 795 fl(zzz, zl0, zq2, zn2) = max(min(l0(ig)*kap*zlev(ig, & 796 k)/(kap*zlev(ig,k)+l0(ig)),0.5*sqrt(q2(ig,k))/sqrt( & 797 max(n2(ig,k),1.E-10))), 1.E-5) 798 799 ! Fonction d'amortissement de la turbulence au dessus de la montagne 800 ! On augmente l'amortissement en diminuant la valeur de hlim (extent) dans le code 801 !..................................................................... 802 803 famorti(zzzz, zh_oro, zhlim)=(-1.)*ATAN((zzzz-zh_oro)/(zhlim-zh_oro))*2./3.1416+1. 804 805 IF (ngrid==0) RETURN 806 807 IF (firstcall) THEN 808 ALLOCATE (l0(klon)) 809 firstcall = .FALSE. 810 END IF 811 812 813 !===================================================================== 814 ! CALCUL de la LONGUEUR de m??lange suivant BLACKADAR: l1 815 !===================================================================== 816 817 818 IF (iflag_pbl==8 .OR. iflag_pbl==10) THEN 819 820 821 ! Iterative computation of l0 822 ! This version is kept for iflag_pbl only for convergence 823 ! with NPv3.1 Cmip5 simulations 824 !................................................................... 825 826 DO ig = 1, ngrid 827 sq(ig) = 1.E-10 828 sqz(ig) = 1.E-10 829 END DO 830 DO k = 2, klev - 1 831 DO ig = 1, ngrid 832 zq = sqrt(q2(ig,k)) 833 sqz(ig) = sqz(ig) + zq*zlev(ig, k)*(zlay(ig,k)-zlay(ig,k-1)) 834 sq(ig) = sq(ig) + zq*(zlay(ig,k)-zlay(ig,k-1)) 835 END DO 836 END DO 837 DO ig = 1, ngrid 838 l0(ig) = 0.2*sqz(ig)/sq(ig) 839 END DO 840 DO k = 2, klev 841 DO ig = 1, ngrid 842 l1(ig, k) = fl(zlev(ig,k), l0(ig), q2(ig,k), n2(ig,k)) 843 END DO 844 END DO 845 846 ELSE 847 848 849 ! In all other case, the assymptotic mixing length l0 is imposed (150m) 850 !...................................................................... 851 852 l0(1:ngrid) = 150. 853 DO k = 2, klev 854 DO ig = 1, ngrid 855 l1(ig, k) = fl(zlev(ig,k), l0(ig), q2(ig,k), n2(ig,k)) 856 END DO 857 END DO 858 859 END IF 860 861 !================================================================================= 862 ! CALCUL d'une longueur de melange en fonctions de la topographie sous maille: l2 863 ! si plb_lmixmin_alpha=TRUE et si on se trouve sur de la terre ( pas actif sur les 864 ! glacier, la glace de mer et les oc??ans) 865 !================================================================================= 866 867 l2(1:ngrid,:)=0.0 868 l_mixmin(1:ngrid,:,nsrf)=0. 869 l_mix(1:ngrid,:,nsrf)=0. 870 871 IF (nsrf .EQ. 1) THEN 872 873 ! coefficients 874 !-------------- 875 876 extent=2. ! On ??tend l'impact du relief jusqu'?? extent*h, extent >1. 877 lmax=150. ! Longueur de m??lange max dans l'absolu 878 879 ! calculs 880 !--------- 881 882 DO ig=1,ngrid 883 884 ! On calcule la hauteur du relief 885 !................................. 886 ! On ne peut pas prendre zstd seulement pour caracteriser le relief sous maille 887 ! car sur un terrain pentu mais sans relief, zstd est non nul (comme en Antarctique, C. Genthon) 888 ! On corrige donc zstd avec l'ecart type de l'altitude dans la maille sans relief 889 ! (en gros, une maille de taille xcell avec une pente constante zstdslope) 890 jg=ni(ig) 891 ! IF (zsig(jg) .EQ. 0.) THEN 892 ! zstdslope(ig)=0. 893 ! ELSE 894 ! xcell=sqrt(cell_area(jg)) 895 ! zstdslope(ig)=max((xcell*zsig(jg)-zmea(jg))**3 /(3.*zsig(jg)),0.) 896 ! zstdslope(ig)=sqrt(zstdslope(ig)) 897 ! END IF 898 899 ! h_oro(ig)=max(zstd(jg)-zstdslope(ig),0.) ! Hauteur du relief 900 h_oro(ig)=zstd(jg) 901 hlim(ig)=extent*h_oro(ig) 902 ENDDO 903 904 l2limit(1:ngrid)=0. 905 906 DO k=2,klev 907 DO ig=1,ngrid 908 winds(ig,k)=sqrt(u(ig,k)**2+v(ig,k)**2) 909 IF (zlev(ig,k) .LE. h_oro(ig)) THEN ! sous l'orographie 910 l2strat= kapb*pbl_lmixmin_alpha*winds(ig,k)/sqrt(max(n2(ig,k),1.E-10)) ! si stratifi??, amplitude d'oscillation * kappab (voir Van de Wiel et al 2008) 911 l2neutre=kap*zlev(ig,k)*h_oro(ig)/(kap*zlev(ig,k)+h_oro(ig)) ! Dans le cas neutre, formule de blackadar. tend asymptotiquement vers h 912 l2neutre=MIN(l2neutre,lmax) ! On majore par lmax 913 l2limit(ig)=MIN(l2neutre,l2strat) ! Calcule de l2 (minimum de la longueur en cas neutre et celle en situation stratifi??e) 914 l2(ig,k)=l2limit(ig) 915 916 ELSE IF (zlev(ig,k) .LE. hlim(ig)) THEN ! Si on est au dessus des montagnes, mais affect?? encore par elles 917 918 ! Au dessus des montagnes, on prend la l2limit au sommet des montagnes 919 ! (la derni??re calcul??e dans la boucle k, vu que k est un indice croissant avec z) 920 ! et on multiplie l2limit par une fonction qui d??croit entre h et hlim 921 l2(ig,k)=l2limit(ig)*famorti(zlev(ig,k),h_oro(ig), hlim(ig)) 922 ELSE ! Au dessus de extent*h, on prend l2=l0 923 l2(ig,k)=0. 924 END IF 925 ENDDO 926 ENDDO 927 ENDIF ! pbl_lmixmin_alpha 928 929 !================================================================================== 930 ! On prend le max entre la longueur de melange de blackadar et celle calcul??e 931 ! en fonction de la topographie 932 !=================================================================================== 933 934 935 DO k=2,klev 936 DO ig=1,ngrid 937 lmix(ig,k)=MAX(MAX(l1(ig,k), l2(ig,k)),lmixmin) 938 ENDDO 939 ENDDO 940 941 ! Diagnostics 942 943 DO k=2,klev 944 DO ig=1,ngrid 945 jg=ni(ig) 946 l_mix(jg,k,nsrf)=lmix(ig,k) 947 l_mixmin(jg,k,nsrf)=l2(ig,k) 948 ENDDO 949 ENDDO 950 DO ig=1,ngrid 951 jg=ni(ig) 952 l_mix(jg,1,nsrf)=hlim(ig) 953 ENDDO 954 955 956 957 END SUBROUTINE mixinglength
Note: See TracChangeset
for help on using the changeset viewer.