Changeset 1425
- Timestamp:
- Sep 2, 2010, 3:45:23 PM (14 years ago)
- Location:
- LMDZ4/trunk
- Files:
-
- 18 added
- 4 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/trunk/arch/arch-SX8_BRODIE.fcm
r1279 r1425 2 2 %LINK sxmpif90 3 3 %AR sxar 4 %MAKE make4 %MAKE sxgmake 5 5 %FPP_FLAGS -P -traditional 6 6 %FPP_DEF NC_DOUBLE BLAS SGEMV=DGEMV SGEMM=DGEMM FFT_MATHKEISAN -
LMDZ4/trunk/arch/arch-linux-32bit.fcm
r1146 r1425 1 %COMPILER pgf9 02 %LINK pgf9 01 %COMPILER pgf95 2 %LINK pgf95 3 3 %AR ar 4 4 %MAKE make … … 7 7 %BASE_FFLAGS 8 8 %PROD_FFLAGS -fast 9 %DEV_FFLAGS -g 10 %DEBUG_FFLAGS -g 9 %DEV_FFLAGS -g -O1 10 %DEBUG_FFLAGS -g -O0 -Kieee -Ktrap=fp -Mbounds 11 11 %MPI_FFLAGS 12 12 %OMP_FFLAGS 13 %BASE_LD -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.213 %BASE_LD 14 14 %MPI_LD 15 15 %OMP_LD -
LMDZ4/trunk/bld.cfg
r1327 r1425 103 103 # extension for module output 104 104 bld::outfile_ext::mod .mod 105 bld::tool::SHELL /bin/bash -
LMDZ4/trunk/libf/dyn3d/abort_gcm.F
r1279 r1425 26 26 character(len=*) message 27 27 28 ! write(lunout,*) 'in abort_gcm' 29 write(6,*) 'in abort_gcm' 28 write(lunout,*) 'in abort_gcm' 30 29 #ifdef CPP_IOIPSL 31 30 call histclo … … 37 36 c call histclo(4) 38 37 c call histclo(5) 39 c write(lunout,*) 'Stopping in ', modname 40 c write(lunout,*) 'Reason = ',message 41 c if (ierr .eq. 0) then 42 c write(lunout,*) 'Everything is cool' 43 c else 44 c write(lunout,*) 'Houston, we have a problem ', ierr 45 c endif 46 write(6,*) 'Stopping in ', modname 47 write(6,*) 'Reason = ',message 38 write(lunout,*) 'Stopping in ', modname 39 write(lunout,*) 'Reason = ',message 48 40 if (ierr .eq. 0) then 49 write(6,*) 'Everything is cool' 41 write(lunout,*) 'Everything is cool' 42 stop 50 43 else 51 write(6,*) 'Houston, we have a problem ', ierr 44 write(lunout,*) 'Houston, we have a problem ', ierr 45 stop 1 52 46 endif 53 STOP54 47 END -
LMDZ4/trunk/libf/dyn3d/ce0l.F90
r1403 r1425 93 93 #endif 94 94 ! of #ifndef CPP_EARTH #else 95 STOP96 95 97 96 END PROGRAM ce0l -
LMDZ4/trunk/libf/dyn3d/etat0_netcdf.F90
r1406 r1425 106 106 INTEGER :: iflag_thermals_ed, iflag_thermals_optflux 107 107 REAL :: tau_thermals, solarlong0, seuil_inversion 108 INTEGER :: read_climoz ! read ozone climatology 108 INTEGER :: read_climoz ! read ozone climatology 109 109 ! Allowed values are 0, 1 and 2 110 110 ! 0: do not read an ozone climatology … … 140 140 iflag_thermals_ed,iflag_thermals_optflux, & 141 141 iflag_coupl,iflag_clos,iflag_wake, read_climoz, & 142 alp_offset 142 alp_offset) 143 143 144 144 ! co2_ppm0 : initial value of atmospheric CO2 from .def file (co2_ppm value) … … 291 291 q3d(:,:,:,:) = 0.0 ; q3d(:,:,:,1) = qd(:,:,:) 292 292 293 ! 294 ! 295 296 297 298 299 300 301 302 303 304 305 ! 306 307 293 ! Parameterization of ozone chemistry: 294 ! Look for ozone tracer: 295 i = 1 296 DO 297 found = tname(i)=="O3" .OR. tname(i)=="o3" 298 if (found .or. i == nqtot) exit 299 i = i + 1 300 end do 301 if (found) then 302 call regr_lat_time_coefoz 303 call press_coefoz 304 call regr_pr_o3(p3d, q3d(:, :, :, i)) 305 ! Convert from mole fraction to mass fraction: 306 q3d(:, :, :, i) = q3d(:, :, :, i) * 48. / 29. 307 end if 308 308 309 309 !--- OZONE CLIMATOLOGY -
LMDZ4/trunk/libf/dyn3d/limit_netcdf.F90
r1404 r1425 267 267 #endif 268 268 ! of #ifdef CPP_EARTH 269 STOP270 269 271 270 … … 281 280 SUBROUTINE get_2Dfield(fnam, mode, ibar, ndays, champo, flag, mask, lCPL) 282 281 ! 283 !----------------------------------------------------------------------------- --282 !----------------------------------------------------------------------------- 284 283 ! Comments: 285 284 ! There are two assumptions concerning the NetCDF files, that are satisfied … … 287 286 ! 1) The last dimension of the variables used is the time record. 288 287 ! 2) Dimensional variables have the same names as corresponding dimensions. 289 !----------------------------------------------------------------------------- --290 USE netcdf, ONLY : NF90_OPEN, NF90_INQ_VARID, NF90_INQUIRE_VARIABLE,&291 NF90_CLOSE, NF90_INQ_DIMID, NF90_INQUIRE_DIMENSION,&292 NF90_GET_VAR,NF90_GET_ATT288 !----------------------------------------------------------------------------- 289 USE netcdf, ONLY: NF90_OPEN, NF90_INQ_VARID, NF90_INQUIRE_VARIABLE, & 290 NF90_CLOSE, NF90_INQ_DIMID, NF90_INQUIRE_DIMENSION, NF90_GET_VAR, & 291 NF90_GET_ATT 293 292 USE dimphy, ONLY : klon 294 293 USE phys_state_var_mod, ONLY : pctsrf 295 294 USE control_mod 295 use pchsp_95_m, only: pchsp_95 296 use pchfe_95_m, only: pchfe_95 297 use arth_m, only: arth 298 296 299 IMPLICIT NONE 297 300 #include "dimensions.h" … … 300 303 #include "indicesol.h" 301 304 #include "iniprint.h" 302 !----------------------------------------------------------------------------- --305 !----------------------------------------------------------------------------- 303 306 ! Arguments: 304 307 CHARACTER(LEN=*), INTENT(IN) :: fnam ! NetCDF file name … … 306 309 LOGICAL, INTENT(IN) :: ibar ! interp on pressure levels 307 310 INTEGER, INTENT(IN) :: ndays ! current year number of days 308 REAL, POINTER, DIMENSION(:, :) :: champo ! output field = f(t)309 LOGICAL, OPTIONAL, INTENT(IN) :: flag ! extrapol. (SST) 310 REAL, OPTIONAL, DIMENSION(iim, jjp1), INTENT(IN) :: mask311 REAL, POINTER, DIMENSION(:, :) :: champo ! output field = f(t) 312 LOGICAL, OPTIONAL, INTENT(IN) :: flag ! extrapol. (SST) old ice (SIC) 313 REAL, OPTIONAL, DIMENSION(iim, jjp1), INTENT(IN) :: mask 311 314 LOGICAL, OPTIONAL, INTENT(IN) :: lCPL ! Coupled model flag (for ICE) 312 !------------------------------------------------------------------------------ -315 !------------------------------------------------------------------------------ 313 316 ! Local variables: 314 317 !--- NetCDF 315 INTEGER :: ierr,ncid, varid ! NetCDF identifiers318 INTEGER :: ncid, varid ! NetCDF identifiers 316 319 CHARACTER(LEN=30) :: dnam ! dimension name 317 320 CHARACTER(LEN=80) :: varname ! NetCDF variable name … … 323 326 !--- fields 324 327 INTEGER :: imdep, jmdep, lmdep ! dimensions of 'champ' 325 REAL, ALLOCATABLE, DIMENSION(:, :) :: champ! wanted field on initial grid328 REAL, ALLOCATABLE, DIMENSION(:, :) :: champ ! wanted field on initial grid 326 329 REAL, ALLOCATABLE, DIMENSION(:) :: yder, timeyear 327 REAL, DIMENSION(iim,jjp1) :: champint ! interpolated field 328 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: champtime 329 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: champan 330 REAL :: time, by 330 REAL, DIMENSION(iim, jjp1) :: champint ! interpolated field 331 REAL, ALLOCATABLE, DIMENSION(:, :, :) :: champtime 332 REAL, ALLOCATABLE, DIMENSION(:, :, :) :: champan 331 333 !--- input files 332 334 CHARACTER(LEN=20) :: cal_in ! calendar … … 334 336 !--- misc 335 337 INTEGER :: i, j, k, l ! loop counters 336 REAL, ALLOCATABLE, DIMENSION(:, :) :: work ! used for extrapolation338 REAL, ALLOCATABLE, DIMENSION(:, :) :: work ! used for extrapolation 337 339 CHARACTER(LEN=25) :: title ! for messages 338 340 LOGICAL :: extrp ! flag for extrapolation 339 341 REAL :: chmin, chmax 340 !------------------------------------------------------------------------------- 341 !---Variables depending on keyword 'mode' -------------------------------------- 342 INTEGER ierr 343 integer n_extrap ! number of extrapolated points 344 logical skip 345 !------------------------------------------------------------------------------ 346 !---Variables depending on keyword 'mode' ------------------------------------- 342 347 NULLIFY(champo) 343 348 SELECT CASE(mode) … … 352 357 END IF 353 358 354 !--- GETTING SOME DIMENSIONAL VARIABLES FROM FILE ----------------------------- -355 ierr=NF90_OPEN(fnam, NF90_NOWRITE,ncid); CALL ncerr(ierr,fnam)356 ierr=NF90_INQ_VARID(ncid, varname,varid); CALL ncerr(ierr,fnam)357 ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dids); CALL ncerr(ierr,fnam)359 !--- GETTING SOME DIMENSIONAL VARIABLES FROM FILE ----------------------------- 360 ierr=NF90_OPEN(fnam, NF90_NOWRITE, ncid); CALL ncerr(ierr, fnam) 361 ierr=NF90_INQ_VARID(ncid, varname, varid); CALL ncerr(ierr, fnam) 362 ierr=NF90_INQUIRE_VARIABLE(ncid, varid, dimids=dids); CALL ncerr(ierr, fnam) 358 363 359 364 !--- Longitude 360 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(1),name=dnam,len=imdep)361 CALL ncerr(ierr, fnam); ALLOCATE(dlon_ini(imdep),dlon(imdep))362 ierr=NF90_INQ_VARID(ncid, dnam,varid); CALL ncerr(ierr,fnam)363 ierr=NF90_GET_VAR(ncid, varid,dlon_ini); CALL ncerr(ierr,fnam)364 WRITE(lunout, *) 'variable ', dnam, 'dimension ', imdep365 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(1), name=dnam, len=imdep) 366 CALL ncerr(ierr, fnam); ALLOCATE(dlon_ini(imdep), dlon(imdep)) 367 ierr=NF90_INQ_VARID(ncid, dnam, varid); CALL ncerr(ierr, fnam) 368 ierr=NF90_GET_VAR(ncid, varid, dlon_ini); CALL ncerr(ierr, fnam) 369 WRITE(lunout, *) 'variable ', dnam, 'dimension ', imdep 365 370 366 371 !--- Latitude 367 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(2),name=dnam,len=jmdep)368 CALL ncerr(ierr, fnam); ALLOCATE(dlat_ini(jmdep),dlat(jmdep))369 ierr=NF90_INQ_VARID(ncid, dnam,varid); CALL ncerr(ierr,fnam)370 ierr=NF90_GET_VAR(ncid, varid,dlat_ini); CALL ncerr(ierr,fnam)371 WRITE(lunout, *) 'variable ', dnam, 'dimension ', jmdep372 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(2), name=dnam, len=jmdep) 373 CALL ncerr(ierr, fnam); ALLOCATE(dlat_ini(jmdep), dlat(jmdep)) 374 ierr=NF90_INQ_VARID(ncid, dnam, varid); CALL ncerr(ierr, fnam) 375 ierr=NF90_GET_VAR(ncid, varid, dlat_ini); CALL ncerr(ierr, fnam) 376 WRITE(lunout, *) 'variable ', dnam, 'dimension ', jmdep 372 377 373 378 !--- Time (variable is not needed - it is rebuilt - but calendar is) 374 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(3),name=dnam,len=lmdep)375 CALL ncerr(ierr, fnam); ALLOCATE(timeyear(lmdep))376 ierr=NF90_INQ_VARID(ncid, dnam,varid); CALL ncerr(ierr,fnam)379 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(3), name=dnam, len=lmdep) 380 CALL ncerr(ierr, fnam); ALLOCATE(timeyear(lmdep)) 381 ierr=NF90_INQ_VARID(ncid, dnam, varid); CALL ncerr(ierr, fnam) 377 382 cal_in=' ' 378 ierr=NF90_GET_ATT(ncid, varid,'calendar',cal_in)383 ierr=NF90_GET_ATT(ncid, varid, 'calendar', cal_in) 379 384 IF(ierr/=NF90_NOERR) THEN 380 385 SELECT CASE(mode) 381 CASE('RUG', 'ALB'); cal_in='360d'382 CASE('SIC', 'SST'); cal_in='gregorian'386 CASE('RUG', 'ALB'); cal_in='360d' 387 CASE('SIC', 'SST'); cal_in='gregorian' 383 388 END SELECT 384 WRITE(lunout, *)'ATTENTION: variable ''time'' sans attribut ''calendrier'' d&385 &ans '//TRIM(fnam)//'. On choisit la valeur par defaut.'389 WRITE(lunout, *)'ATTENTION: variable "time" sans attribut "calendrier" ' & 390 // 'dans '//TRIM(fnam)//'. On choisit la valeur par defaut.' 386 391 END IF 387 WRITE(lunout,*) 'variable ', dnam, 'dimension ', lmdep, 'calendrier ', cal_in 388 389 !--- CONSTRUCTING THE INPUT TIME VECTOR FOR INTERPOLATION ---------------------- 392 WRITE(lunout, *) 'variable ', dnam, 'dimension ', lmdep, 'calendrier ', & 393 cal_in 394 395 !--- CONSTRUCTING THE INPUT TIME VECTOR FOR INTERPOLATION -------------------- 390 396 !--- Determining input file number of days, depending on calendar 391 ndays_in=year_len(anneeref, cal_in)397 ndays_in=year_len(anneeref, cal_in) 392 398 393 399 !--- Time vector reconstruction (time vector from file is not trusted) 394 400 !--- If input records are not monthly, time sampling has to be constant ! 395 timeyear=mid_months(anneeref,cal_in,lmdep) 396 IF(lmdep/=12) WRITE(lunout,'(a,i3,a)')'Note: les fichiers de '//TRIM(mode) & 397 //' ne comportent pas 12, mais ',lmdep,' enregistrements.' 398 399 !--- GETTING THE FIELD AND INTERPOLATING IT ------------------------------------ 400 ALLOCATE(champ(imdep,jmdep),champtime(iim,jjp1,lmdep)) 401 IF(extrp) ALLOCATE(work(imdep,jmdep)) 402 403 WRITE(lunout,*) 404 WRITE(lunout,'(a,i3,a)')'LECTURE ET INTERPOLATION HORIZ. DE ',lmdep,' CHAMPS.' 405 ierr=NF90_INQ_VARID(ncid,varname,varid); CALL ncerr(ierr,fnam) 406 DO l=1,lmdep 407 ierr=NF90_GET_VAR(ncid,varid,champ,(/1,1,l/),(/imdep,jmdep,1/)) 408 CALL ncerr(ierr,fnam) 409 CALL conf_dat2d(title,imdep,jmdep,dlon_ini,dlat_ini,dlon,dlat,champ,ibar) 410 411 IF(extrp) CALL extrapol(champ,imdep,jmdep,999999.,.TRUE.,.TRUE.,2,work) 401 timeyear=mid_months(anneeref, cal_in, lmdep) 402 IF (lmdep /= 12) WRITE(lunout, '(a, i3, a)') 'Note : les fichiers de ' & 403 // TRIM(mode) // ' ne comportent pas 12, mais ', lmdep, & 404 ' enregistrements.' 405 406 !--- GETTING THE FIELD AND INTERPOLATING IT ---------------------------------- 407 ALLOCATE(champ(imdep, jmdep), champtime(iim, jjp1, lmdep)) 408 IF(extrp) ALLOCATE(work(imdep, jmdep)) 409 410 WRITE(lunout, *) 411 WRITE(lunout, '(a, i3, a)')'LECTURE ET INTERPOLATION HORIZ. DE ', lmdep, & 412 ' CHAMPS.' 413 ierr=NF90_INQ_VARID(ncid, varname, varid); CALL ncerr(ierr, fnam) 414 DO l=1, lmdep 415 ierr=NF90_GET_VAR(ncid, varid, champ, (/1, 1, l/), (/imdep, jmdep, 1/)) 416 CALL ncerr(ierr, fnam) 417 CALL conf_dat2d(title, imdep, jmdep, dlon_ini, dlat_ini, dlon, dlat, & 418 champ, ibar) 419 420 IF (extrp) CALL extrapol(champ, imdep, jmdep, 999999., .TRUE., .TRUE., 2, & 421 work) 412 422 413 423 IF(ibar.AND..NOT.(mode=='SIC'.AND.flag)) THEN 414 424 IF(l==1) THEN 415 WRITE(lunout, *)&425 WRITE(lunout, *) & 416 426 '-------------------------------------------------------------------------' 417 WRITE(lunout, *)&418 ' $$$Utilisation de l''interpolation barycentrique pour '//TRIM(title)//' $$$'419 WRITE(lunout, *)&427 WRITE(lunout, *) & 428 'Utilisation de l''interpolation barycentrique pour '//TRIM(title)//' $$$' 429 WRITE(lunout, *) & 420 430 '-------------------------------------------------------------------------' 421 431 END IF … … 433 443 CASE('SIC'); CALL sea_ice (imdep, jmdep, dlon, dlat, champ, & 434 444 iim, jjp1, rlonv, rlatu, champint) 435 CASE('SST', 'ALB'); CALL grille_m(imdep, jmdep, dlon, dlat, champ, &445 CASE('SST', 'ALB'); CALL grille_m(imdep, jmdep, dlon, dlat, champ, & 436 446 iim, jjp1, rlonv, rlatu, champint) 437 447 END SELECT 438 448 END IF 439 champtime(:, :,l)=champint449 champtime(:, :, l)=champint 440 450 END DO 441 ierr=NF90_CLOSE(ncid); CALL ncerr(ierr,fnam)442 443 DEALLOCATE(dlon_ini, dlat_ini,dlon,dlat,champ)451 ierr=NF90_CLOSE(ncid); CALL ncerr(ierr, fnam) 452 453 DEALLOCATE(dlon_ini, dlat_ini, dlon, dlat, champ) 444 454 IF(extrp) DEALLOCATE(work) 445 455 446 !--- TIME INTERPOLATION -------------------------------------------------------- 447 WRITE(lunout,*) 448 WRITE(lunout,*)'INTERPOLATION TEMPORELLE.' 449 WRITE(lunout,"(2x,' Vecteur temps en entree: ',10f6.1)") timeyear 450 WRITE(lunout,"(2x,' Vecteur temps en sortie de 0 a ',i3)") ndays 451 ALLOCATE(yder(lmdep),champan(iip1,jjp1,ndays)) 452 DO j=1,jjp1 453 DO i=1,iim 454 CALL spline(timeyear,champtime(i,j,:),lmdep,1.e30,1.e30,yder) 455 DO k=1,ndays 456 time=FLOAT((k-1)*ndays_in)/FLOAT(ndays) 457 CALL splint(timeyear,champtime(i,j,:),yder,lmdep,time,by) 458 champan(i,j,k) = by 459 END DO 456 !--- TIME INTERPOLATION ------------------------------------------------------ 457 WRITE(lunout, *) 458 WRITE(lunout, *)'INTERPOLATION TEMPORELLE.' 459 WRITE(lunout, "(2x, ' Vecteur temps en entree: ', 10f6.1)") timeyear 460 WRITE(lunout, "(2x, ' Vecteur temps en sortie de 0 a ', i3)") ndays 461 ALLOCATE(yder(lmdep), champan(iip1, jjp1, ndays)) 462 skip = .false. 463 n_extrap = 0 464 DO j=1, jjp1 465 DO i=1, iim 466 yder = pchsp_95(timeyear, champtime(i, j, :), ibeg=2, iend=2, & 467 vc_beg=0., vc_end=0.) 468 CALL pchfe_95(timeyear, champtime(i, j, :), yder, skip, & 469 arth(0., real(ndays_in) / ndays, ndays), champan(i, j, :), ierr) 470 if (ierr < 0) stop 1 471 n_extrap = n_extrap + ierr 460 472 END DO 461 473 END DO 462 champan(iip1,:,:)=champan(1,:,:) 463 DEALLOCATE(yder,champtime,timeyear) 474 if (n_extrap /= 0) then 475 print *, "get_2Dfield pchfe_95: n_extrap = ", n_extrap 476 end if 477 champan(iip1, :, :)=champan(1, :, :) 478 DEALLOCATE(yder, champtime, timeyear) 464 479 465 480 !--- Checking the result 466 DO j=1, jjp1467 CALL minmax(iip1, champan(1,j,10),chmin,chmax)468 WRITE(lunout, *)' '//TRIM(title)//' au temps 10 ',chmin,chmax,j481 DO j=1, jjp1 482 CALL minmax(iip1, champan(1, j, 10), chmin, chmax) 483 WRITE(lunout, *)' '//TRIM(title)//' au temps 10 ', chmin, chmax, j 469 484 END DO 470 485 471 !--- SPECIAL FILTER FOR SST: SST>271.38 -------------------------------------- --486 !--- SPECIAL FILTER FOR SST: SST>271.38 -------------------------------------- 472 487 IF(mode=='SST') THEN 473 WRITE(lunout, *) 'Filtrage de la SST: SST >= 271.38'488 WRITE(lunout, *) 'Filtrage de la SST: SST >= 271.38' 474 489 WHERE(champan<271.38) champan=271.38 475 490 END IF 476 491 477 !--- SPECIAL FILTER FOR SIC: 0.0<SIC<1.0 ------------------------------------- --492 !--- SPECIAL FILTER FOR SIC: 0.0<SIC<1.0 ------------------------------------- 478 493 IF(mode=='SIC') THEN 479 WRITE(lunout, *) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0'480 IF(.NOT.lCPL) champan(:, :,:)=champan(:,:,:)/100.481 champan(iip1, :,:)=champan(1,:,:)494 WRITE(lunout, *) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0' 495 IF(.NOT.lCPL) champan(:, :, :)=champan(:, :, :)/100. 496 champan(iip1, :, :)=champan(1, :, :) 482 497 WHERE(champan>1.0) champan=1.0 483 498 WHERE(champan<0.0) champan=0.0 484 499 END IF 485 500 486 !--- DYNAMICAL TO PHYSICAL GRID ---------------------------------------------- --487 ALLOCATE(champo(klon, ndays))488 DO k=1, ndays489 CALL gr_dyn_fi(1, iip1,jjp1,klon,champan(1,1,k),champo(1,k))501 !--- DYNAMICAL TO PHYSICAL GRID ---------------------------------------------- 502 ALLOCATE(champo(klon, ndays)) 503 DO k=1, ndays 504 CALL gr_dyn_fi(1, iip1, jjp1, klon, champan(1, 1, k), champo(1, k)) 490 505 END DO 491 506 DEALLOCATE(champan) -
LMDZ4/trunk/libf/dyn3d/startvar.F90
r1323 r1425 643 643 !------------------------------------------------------------------------------- 644 644 ! 645 SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in, lat_in, jml2,lon_in2,& 646 lat_in2, pls_in, var3d, ibar) 647 ! 648 !------------------------------------------------------------------------------- 645 SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in, lat_in, jml2, & 646 lon_in2, lat_in2, pls_in, var3d, ibar) 647 648 use pchsp_95_m, only: pchsp_95 649 use pchfe_95_m, only: pchfe_95 650 649 651 ! Arguments: 650 652 CHARACTER(LEN=*), INTENT(IN) :: varname … … 655 657 REAL, DIMENSION(iml), INTENT(IN) :: lon_in2 656 658 REAL, DIMENSION(jml2), INTENT(IN) :: lat_in2 657 REAL, DIMENSION(iml, jml,lml), INTENT(IN) :: pls_in658 REAL, DIMENSION(iml, jml,lml), INTENT(OUT) :: var3d659 REAL, DIMENSION(iml, jml, lml), INTENT(IN) :: pls_in 660 REAL, DIMENSION(iml, jml, lml), INTENT(OUT) :: var3d 659 661 LOGICAL, INTENT(IN) :: ibar 660 !---------------------------------------------------------------------------- ---662 !---------------------------------------------------------------------------- 661 663 ! Local variables: 662 664 #include "iniprint.h" 663 LOGICAL :: check=.TRUE. 664 REAL :: bx, by, chmin, chmax 665 INTEGER :: ii, ij, il 666 REAL, DIMENSION(:,:,:), ALLOCATABLE :: var_tmp3d 665 LOGICAL:: check=.TRUE., skip 666 REAL chmin, chmax 667 INTEGER ii, ij, il, ierr 668 integer n_extrap ! number of extrapolated points 669 REAL, DIMENSION(iml, jml, llm_dyn):: var_tmp3d 667 670 REAL, DIMENSION(:), ALLOCATABLE :: lon_rad, lat_rad, lon_ini, lat_ini 668 REAL, DIMENSION(:), ALLOCATABLE :: lev_dyn, ax, ay, yder 669 INTEGER, DIMENSION(:), ALLOCATABLE :: lind 670 !------------------------------------------------------------------------------- 671 IF(check) WRITE(lunout,*)'Going into flinget to extract the 3D field.' 672 IF(check) WRITE(lunout,*)fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, ttm_dyn 673 IF(check) WRITE(lunout,*)'Allocating space for interpolation',iml,jml,llm_dyn 674 675 IF(.NOT.ALLOCATED(var_ana3d)) ALLOCATE(var_ana3d(iml_dyn,jml_dyn,llm_dyn)) 676 CALL flinget(fid_dyn,varname,iml_dyn,jml_dyn,llm_dyn,ttm_dyn,1,1,var_ana3d) 671 REAL, DIMENSION(llm_dyn):: lev_dyn, ax, ay, yder 672 673 !--------------------------------------------------------------------------- 674 IF(check) WRITE(lunout, *)'Going into flinget to extract the 3D field.' 675 IF(check) WRITE(lunout, *) fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, & 676 ttm_dyn 677 IF(check) WRITE(lunout, *) 'Allocating space for interpolation', iml, jml, & 678 llm_dyn 679 680 IF(.NOT.ALLOCATED(var_ana3d)) ALLOCATE(var_ana3d(iml_dyn, jml_dyn, llm_dyn)) 681 CALL flinget(fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, ttm_dyn, 1, 1, & 682 var_ana3d) 677 683 678 684 !--- IF ANGLES ARE IN DEGREES, THEY ARE CONVERTED INTO RADIANS 679 ALLOCATE(lon_ini(iml_dyn), lat_ini(jml_dyn))680 lon_ini(:)=lon_dyn(:, 1); IF(MAXVAL(lon_dyn)>pi) lon_ini=lon_ini*deg2rad681 lat_ini(:)=lat_dyn(1, :); IF(MAXVAL(lat_dyn)>pi) lat_ini=lat_ini*deg2rad685 ALLOCATE(lon_ini(iml_dyn), lat_ini(jml_dyn)) 686 lon_ini(:)=lon_dyn(:, 1); IF(MAXVAL(lon_dyn)>pi) lon_ini=lon_ini*deg2rad 687 lat_ini(:)=lat_dyn(1, :); IF(MAXVAL(lat_dyn)>pi) lat_ini=lat_ini*deg2rad 682 688 683 689 !--- FIELDS ARE PROCESSED TO BE ON STANDARD ANGULAR DOMAINS 684 ALLOCATE(lon_rad(iml_dyn), lat_rad(jml_dyn),lev_dyn(llm_dyn))685 CALL conf_dat3d (varname, iml_dyn, jml_dyn, llm_dyn, lon_ini, lat_ini, 690 ALLOCATE(lon_rad(iml_dyn), lat_rad(jml_dyn)) 691 CALL conf_dat3d (varname, iml_dyn, jml_dyn, llm_dyn, lon_ini, lat_ini, & 686 692 levdyn_ini, lon_rad, lat_rad, lev_dyn, var_ana3d, ibar) 687 DEALLOCATE(lon_ini, lat_ini)693 DEALLOCATE(lon_ini, lat_ini) 688 694 689 695 !--- COMPUTING THE REQUIRED FIELDS USING ROUTINE grid_noro 690 ALLOCATE(var_tmp3d(iml,jml,llm_dyn)) 691 DO il=1,llm_dyn 692 CALL interp_startvar(varname, ibar, il==1, & 693 iml_dyn, jml_dyn, lon_rad, lat_rad, var_ana3d(:,:,il), iml, jml, jml2, & 694 lon_in, lat_in, lon_in2, lat_in2, var_tmp3d(:,:,il)) 696 DO il=1, llm_dyn 697 CALL interp_startvar(varname, ibar, il==1, iml_dyn, jml_dyn, lon_rad, & 698 lat_rad, var_ana3d(:, :, il), iml, jml, jml2, lon_in, lat_in, & 699 lon_in2, lat_in2, var_tmp3d(:, :, il)) 695 700 END DO 696 DEALLOCATE(lon_rad,lat_rad) 697 698 ALLOCATE(lind(llm_dyn)) 699 DO il=1,llm_dyn 700 lind(il) = llm_dyn-il+1 701 DEALLOCATE(lon_rad, lat_rad) 702 703 !--- VERTICAL INTERPOLATION IS PERFORMED FROM TOP OF ATMOSPHERE TO GROUND 704 ax = lev_dyn(llm_dyn:1:-1) 705 skip = .false. 706 n_extrap = 0 707 DO ij=1, jml 708 DO ii=1, iml-1 709 ay = var_tmp3d(ii, ij, llm_dyn:1:-1) 710 yder = pchsp_95(ax, ay, ibeg=2, iend=2, vc_beg=0., vc_end=0.) 711 CALL pchfe_95(ax, ay, yder, skip, pls_in(ii, ij, lml:1:-1), & 712 var3d(ii, ij, lml:1:-1), ierr) 713 if (ierr < 0) stop 1 714 n_extrap = n_extrap + ierr 715 END DO 701 716 END DO 702 703 !--- VERTICAL INTERPOLATION IS PERFORMED FROM TOP OF ATMOSPHERE TO GROUND 704 ALLOCATE(ax(llm_dyn),ay(llm_dyn),yder(llm_dyn)) 705 DO ij=1,jml 706 DO ii=1,iml-1 707 ax(:)=lev_dyn(lind(:)) 708 ay(:)=var_tmp3d(ii,ij,lind(:)) 709 CALL SPLINE(ax, ay, llm_dyn, 1.e30, 1.e30, yder) 710 DO il=1,lml 711 bx=pls_in(ii,ij,il) 712 CALL SPLINT(ax, ay, yder, llm_dyn, bx, by) 713 var3d(ii,ij,il) = by 714 END DO 715 END DO 716 var3d(iml,ij,:) = var3d(1,ij,:) 717 if (n_extrap /= 0) then 718 print *, "start_inter_3d pchfe_95: n_extrap = ", n_extrap 719 end if 720 var3d(iml, :, :) = var3d(1, :, :) 721 722 DO il=1, lml 723 CALL minmax(iml*jml, var3d(1, 1, il), chmin, chmax) 724 WRITE(lunout, *)' '//TRIM(varname)//' min max l ', il, chmin, chmax 717 725 END DO 718 DEALLOCATE(var_tmp3d,lev_dyn,ax,ay,yder,lind)719 720 DO il=1,lml721 CALL minmax(iml*jml,var3d(1,1,il),chmin,chmax)722 WRITE(lunout,*)' '//TRIM(varname)//' min max l ',il,chmin,chmax723 END DO724 725 RETURN726 726 727 727 END SUBROUTINE start_inter_3d -
LMDZ4/trunk/libf/dyn3dpar/abort_gcm.F
r1279 r1425 23 23 C ierr = severity of situation ( = 0 normal ) 24 24 25 character (len=*) ::modname25 character(len=*) modname 26 26 integer ierr 27 character (len=*) ::message27 character(len=*) message 28 28 29 29 write(lunout,*) 'in abort_gcm' … … 45 45 if (ierr .eq. 0) then 46 46 write(lunout,*) 'Everything is cool' 47 stop 47 48 else 48 49 write(lunout,*) 'Houston, we have a problem ', ierr 49 STOP50 stop 1 50 51 endif 51 52 END -
LMDZ4/trunk/libf/dyn3dpar/ce0l.F90
r1403 r1425 5 5 ! 6 6 PROGRAM ce0l 7 !8 7 !------------------------------------------------------------------------------- 9 8 ! Purpose: Calls etat0, creates initial states and limit_netcdf … … 104 103 #endif 105 104 ! of #ifndef CPP_EARTH #else 106 STOP107 105 108 106 END PROGRAM ce0l -
LMDZ4/trunk/libf/dyn3dpar/etat0_netcdf.F90
r1406 r1425 11 11 ! Note: This routine is designed to work for Earth 12 12 !------------------------------------------------------------------------------- 13 USE control_mod 13 14 #ifdef CPP_EARTH 14 15 USE startvar … … 28 29 USE netcdf, ONLY : NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR 29 30 #endif 30 USE control_mod31 31 IMPLICIT NONE 32 32 !------------------------------------------------------------------------------- … … 114 114 !------------------------------------------------------------------------------- 115 115 REAL :: alp_offset 116 LOGICALfound116 logical found 117 117 118 118 !--- Constants … … 505 505 wake_cstar(:) = 0. 506 506 wake_fip(:) = 0. 507 wake_pe = 0. 508 fm_therm = 0. 509 entr_therm = 0. 510 detr_therm = 0. 511 507 512 CALL fonte_neige_init(run_off_lic_0) 508 513 CALL pbl_surface_init( qsol, fder, snsrf, qsolsrf, evap, frugs, agesno, tsoil ) -
LMDZ4/trunk/libf/dyn3dpar/limit_netcdf.F90
r1404 r1425 20 20 ! * 12/2009: D. Cugnet (f77->f90, calendars, files from coupled runs) 21 21 !------------------------------------------------------------------------------- 22 USE control_mod 22 23 #ifdef CPP_EARTH 23 24 USE dimphy … … 27 28 NF90_DEF_DIM, NF90_DEF_VAR, NF90_PUT_VAR, NF90_PUT_ATT, & 28 29 NF90_NOERR, NF90_NOWRITE, NF90_DOUBLE, NF90_GLOBAL, & 29 NF90_CLOBBER, NF90_ENDDEF, NF90_UNLIMITED 30 NF90_CLOBBER, NF90_ENDDEF, NF90_UNLIMITED, NF90_FLOAT 30 31 USE inter_barxy_m, only: inter_barxy 31 32 #endif 32 USE control_mod33 33 IMPLICIT NONE 34 34 !------------------------------------------------------------------------------- … … 267 267 #endif 268 268 ! of #ifdef CPP_EARTH 269 STOP270 269 271 270 … … 281 280 SUBROUTINE get_2Dfield(fnam, mode, ibar, ndays, champo, flag, mask, lCPL) 282 281 ! 283 !----------------------------------------------------------------------------- --282 !----------------------------------------------------------------------------- 284 283 ! Comments: 285 284 ! There are two assumptions concerning the NetCDF files, that are satisfied … … 287 286 ! 1) The last dimension of the variables used is the time record. 288 287 ! 2) Dimensional variables have the same names as corresponding dimensions. 289 !----------------------------------------------------------------------------- --290 USE netcdf, ONLY : NF90_OPEN, NF90_INQ_VARID, NF90_INQUIRE_VARIABLE,&291 NF90_CLOSE, NF90_INQ_DIMID, NF90_INQUIRE_DIMENSION,&292 NF90_GET_VAR,NF90_GET_ATT288 !----------------------------------------------------------------------------- 289 USE netcdf, ONLY: NF90_OPEN, NF90_INQ_VARID, NF90_INQUIRE_VARIABLE, & 290 NF90_CLOSE, NF90_INQ_DIMID, NF90_INQUIRE_DIMENSION, NF90_GET_VAR, & 291 NF90_GET_ATT 293 292 USE dimphy, ONLY : klon 294 293 USE phys_state_var_mod, ONLY : pctsrf 295 294 USE control_mod 295 use pchsp_95_m, only: pchsp_95 296 use pchfe_95_m, only: pchfe_95 297 use arth_m, only: arth 298 296 299 IMPLICIT NONE 297 300 #include "dimensions.h" … … 300 303 #include "indicesol.h" 301 304 #include "iniprint.h" 302 !----------------------------------------------------------------------------- --305 !----------------------------------------------------------------------------- 303 306 ! Arguments: 304 307 CHARACTER(LEN=*), INTENT(IN) :: fnam ! NetCDF file name … … 306 309 LOGICAL, INTENT(IN) :: ibar ! interp on pressure levels 307 310 INTEGER, INTENT(IN) :: ndays ! current year number of days 308 REAL, POINTER, DIMENSION(:, :) :: champo ! output field = f(t)309 LOGICAL, OPTIONAL, INTENT(IN) :: flag ! extrapol. (SST) 310 REAL, OPTIONAL, DIMENSION(iim, jjp1), INTENT(IN) :: mask311 REAL, POINTER, DIMENSION(:, :) :: champo ! output field = f(t) 312 LOGICAL, OPTIONAL, INTENT(IN) :: flag ! extrapol. (SST) old ice (SIC) 313 REAL, OPTIONAL, DIMENSION(iim, jjp1), INTENT(IN) :: mask 311 314 LOGICAL, OPTIONAL, INTENT(IN) :: lCPL ! Coupled model flag (for ICE) 312 !------------------------------------------------------------------------------ -315 !------------------------------------------------------------------------------ 313 316 ! Local variables: 314 317 !--- NetCDF 315 INTEGER :: ierr,ncid, varid ! NetCDF identifiers318 INTEGER :: ncid, varid ! NetCDF identifiers 316 319 CHARACTER(LEN=30) :: dnam ! dimension name 317 320 CHARACTER(LEN=80) :: varname ! NetCDF variable name … … 323 326 !--- fields 324 327 INTEGER :: imdep, jmdep, lmdep ! dimensions of 'champ' 325 REAL, ALLOCATABLE, DIMENSION(:, :) :: champ! wanted field on initial grid328 REAL, ALLOCATABLE, DIMENSION(:, :) :: champ ! wanted field on initial grid 326 329 REAL, ALLOCATABLE, DIMENSION(:) :: yder, timeyear 327 REAL, DIMENSION(iim,jjp1) :: champint ! interpolated field 328 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: champtime 329 REAL, ALLOCATABLE, DIMENSION(:,:,:) :: champan 330 REAL :: time, by 330 REAL, DIMENSION(iim, jjp1) :: champint ! interpolated field 331 REAL, ALLOCATABLE, DIMENSION(:, :, :) :: champtime 332 REAL, ALLOCATABLE, DIMENSION(:, :, :) :: champan 331 333 !--- input files 332 334 CHARACTER(LEN=20) :: cal_in ! calendar … … 334 336 !--- misc 335 337 INTEGER :: i, j, k, l ! loop counters 336 REAL, ALLOCATABLE, DIMENSION(:, :) :: work ! used for extrapolation338 REAL, ALLOCATABLE, DIMENSION(:, :) :: work ! used for extrapolation 337 339 CHARACTER(LEN=25) :: title ! for messages 338 340 LOGICAL :: extrp ! flag for extrapolation 339 341 REAL :: chmin, chmax 340 !------------------------------------------------------------------------------- 341 !---Variables depending on keyword 'mode' -------------------------------------- 342 INTEGER ierr 343 integer n_extrap ! number of extrapolated points 344 logical skip 345 !------------------------------------------------------------------------------ 346 !---Variables depending on keyword 'mode' ------------------------------------- 342 347 NULLIFY(champo) 343 348 SELECT CASE(mode) … … 347 352 CASE('ALB'); varname='ALBEDO'; title='Albedo' 348 353 END SELECT 349 extrp=.FALSE. 350 IF ( PRESENT(flag) ) THEN 351 IF ( flag .AND. mode=='SST' ) extrp=.TRUE. 352 END IF 353 354 355 !--- GETTING SOME DIMENSIONAL VARIABLES FROM FILE ------------------------------ 356 ierr=NF90_OPEN(fnam,NF90_NOWRITE,ncid); CALL ncerr(ierr,fnam) 357 ierr=NF90_INQ_VARID(ncid,varname,varid); CALL ncerr(ierr,fnam) 358 ierr=NF90_INQUIRE_VARIABLE(ncid,varid,dimids=dids); CALL ncerr(ierr,fnam) 354 extrp=.FALSE. 355 IF ( PRESENT(flag) ) THEN 356 IF ( flag .AND. mode=='SST' ) extrp=.TRUE. 357 END IF 358 359 !--- GETTING SOME DIMENSIONAL VARIABLES FROM FILE ----------------------------- 360 ierr=NF90_OPEN(fnam, NF90_NOWRITE, ncid); CALL ncerr(ierr, fnam) 361 ierr=NF90_INQ_VARID(ncid, varname, varid); CALL ncerr(ierr, fnam) 362 ierr=NF90_INQUIRE_VARIABLE(ncid, varid, dimids=dids); CALL ncerr(ierr, fnam) 359 363 360 364 !--- Longitude 361 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(1),name=dnam,len=imdep)362 CALL ncerr(ierr, fnam); ALLOCATE(dlon_ini(imdep),dlon(imdep))363 ierr=NF90_INQ_VARID(ncid, dnam,varid); CALL ncerr(ierr,fnam)364 ierr=NF90_GET_VAR(ncid, varid,dlon_ini); CALL ncerr(ierr,fnam)365 WRITE(lunout, *) 'variable ', dnam, 'dimension ', imdep365 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(1), name=dnam, len=imdep) 366 CALL ncerr(ierr, fnam); ALLOCATE(dlon_ini(imdep), dlon(imdep)) 367 ierr=NF90_INQ_VARID(ncid, dnam, varid); CALL ncerr(ierr, fnam) 368 ierr=NF90_GET_VAR(ncid, varid, dlon_ini); CALL ncerr(ierr, fnam) 369 WRITE(lunout, *) 'variable ', dnam, 'dimension ', imdep 366 370 367 371 !--- Latitude 368 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(2),name=dnam,len=jmdep)369 CALL ncerr(ierr, fnam); ALLOCATE(dlat_ini(jmdep),dlat(jmdep))370 ierr=NF90_INQ_VARID(ncid, dnam,varid); CALL ncerr(ierr,fnam)371 ierr=NF90_GET_VAR(ncid, varid,dlat_ini); CALL ncerr(ierr,fnam)372 WRITE(lunout, *) 'variable ', dnam, 'dimension ', jmdep372 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(2), name=dnam, len=jmdep) 373 CALL ncerr(ierr, fnam); ALLOCATE(dlat_ini(jmdep), dlat(jmdep)) 374 ierr=NF90_INQ_VARID(ncid, dnam, varid); CALL ncerr(ierr, fnam) 375 ierr=NF90_GET_VAR(ncid, varid, dlat_ini); CALL ncerr(ierr, fnam) 376 WRITE(lunout, *) 'variable ', dnam, 'dimension ', jmdep 373 377 374 378 !--- Time (variable is not needed - it is rebuilt - but calendar is) 375 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(3),name=dnam,len=lmdep)376 CALL ncerr(ierr, fnam); ALLOCATE(timeyear(lmdep))377 ierr=NF90_INQ_VARID(ncid, dnam,varid); CALL ncerr(ierr,fnam)379 ierr=NF90_INQUIRE_DIMENSION(ncid, dids(3), name=dnam, len=lmdep) 380 CALL ncerr(ierr, fnam); ALLOCATE(timeyear(lmdep)) 381 ierr=NF90_INQ_VARID(ncid, dnam, varid); CALL ncerr(ierr, fnam) 378 382 cal_in=' ' 379 ierr=NF90_GET_ATT(ncid, varid,'calendar',cal_in)383 ierr=NF90_GET_ATT(ncid, varid, 'calendar', cal_in) 380 384 IF(ierr/=NF90_NOERR) THEN 381 385 SELECT CASE(mode) 382 CASE('RUG', 'ALB'); cal_in='360d'383 CASE('SIC', 'SST'); cal_in='gregorian'386 CASE('RUG', 'ALB'); cal_in='360d' 387 CASE('SIC', 'SST'); cal_in='gregorian' 384 388 END SELECT 385 WRITE(lunout, *)'ATTENTION: variable ''time'' sans attribut ''calendrier'' d&386 &ans '//TRIM(fnam)//'. On choisit la valeur par defaut.'389 WRITE(lunout, *)'ATTENTION: variable "time" sans attribut "calendrier" ' & 390 // 'dans '//TRIM(fnam)//'. On choisit la valeur par defaut.' 387 391 END IF 388 WRITE(lunout,*) 'variable ', dnam, 'dimension ', lmdep, 'calendrier ', cal_in 389 390 !--- CONSTRUCTING THE INPUT TIME VECTOR FOR INTERPOLATION ---------------------- 392 WRITE(lunout, *) 'variable ', dnam, 'dimension ', lmdep, 'calendrier ', & 393 cal_in 394 395 !--- CONSTRUCTING THE INPUT TIME VECTOR FOR INTERPOLATION -------------------- 391 396 !--- Determining input file number of days, depending on calendar 392 ndays_in=year_len(anneeref, cal_in)397 ndays_in=year_len(anneeref, cal_in) 393 398 394 399 !--- Time vector reconstruction (time vector from file is not trusted) 395 400 !--- If input records are not monthly, time sampling has to be constant ! 396 timeyear=mid_months(anneeref,cal_in,lmdep) 397 IF(lmdep/=12) WRITE(lunout,'(a,i3,a)')'Note: les fichiers de '//TRIM(mode) & 398 //' ne comportent pas 12, mais ',lmdep,' enregistrements.' 399 400 !--- GETTING THE FIELD AND INTERPOLATING IT ------------------------------------ 401 ALLOCATE(champ(imdep,jmdep),champtime(iim,jjp1,lmdep)) 402 IF(extrp) ALLOCATE(work(imdep,jmdep)) 403 404 WRITE(lunout,*) 405 WRITE(lunout,'(a,i3,a)')'LECTURE ET INTERPOLATION HORIZ. DE ',lmdep,' CHAMPS.' 406 ierr=NF90_INQ_VARID(ncid,varname,varid); CALL ncerr(ierr,fnam) 407 DO l=1,lmdep 408 ierr=NF90_GET_VAR(ncid,varid,champ,(/1,1,l/),(/imdep,jmdep,1/)) 409 CALL ncerr(ierr,fnam) 410 CALL conf_dat2d(title,imdep,jmdep,dlon_ini,dlat_ini,dlon,dlat,champ,ibar) 411 412 IF(extrp) CALL extrapol(champ,imdep,jmdep,999999.,.TRUE.,.TRUE.,2,work) 401 timeyear=mid_months(anneeref, cal_in, lmdep) 402 IF (lmdep /= 12) WRITE(lunout, '(a, i3, a)') 'Note : les fichiers de ' & 403 // TRIM(mode) // ' ne comportent pas 12, mais ', lmdep, & 404 ' enregistrements.' 405 406 !--- GETTING THE FIELD AND INTERPOLATING IT ---------------------------------- 407 ALLOCATE(champ(imdep, jmdep), champtime(iim, jjp1, lmdep)) 408 IF(extrp) ALLOCATE(work(imdep, jmdep)) 409 410 WRITE(lunout, *) 411 WRITE(lunout, '(a, i3, a)')'LECTURE ET INTERPOLATION HORIZ. DE ', lmdep, & 412 ' CHAMPS.' 413 ierr=NF90_INQ_VARID(ncid, varname, varid); CALL ncerr(ierr, fnam) 414 DO l=1, lmdep 415 ierr=NF90_GET_VAR(ncid, varid, champ, (/1, 1, l/), (/imdep, jmdep, 1/)) 416 CALL ncerr(ierr, fnam) 417 CALL conf_dat2d(title, imdep, jmdep, dlon_ini, dlat_ini, dlon, dlat, & 418 champ, ibar) 419 420 IF (extrp) CALL extrapol(champ, imdep, jmdep, 999999., .TRUE., .TRUE., 2, & 421 work) 413 422 414 423 IF(ibar.AND..NOT.(mode=='SIC'.AND.flag)) THEN 415 424 IF(l==1) THEN 416 WRITE(lunout, *)&425 WRITE(lunout, *) & 417 426 '-------------------------------------------------------------------------' 418 WRITE(lunout, *)&419 ' $$$Utilisation de l''interpolation barycentrique pour '//TRIM(title)//' $$$'420 WRITE(lunout, *)&427 WRITE(lunout, *) & 428 'Utilisation de l''interpolation barycentrique pour '//TRIM(title)//' $$$' 429 WRITE(lunout, *) & 421 430 '-------------------------------------------------------------------------' 422 431 END IF … … 434 443 CASE('SIC'); CALL sea_ice (imdep, jmdep, dlon, dlat, champ, & 435 444 iim, jjp1, rlonv, rlatu, champint) 436 CASE('SST', 'ALB'); CALL grille_m(imdep, jmdep, dlon, dlat, champ, &445 CASE('SST', 'ALB'); CALL grille_m(imdep, jmdep, dlon, dlat, champ, & 437 446 iim, jjp1, rlonv, rlatu, champint) 438 447 END SELECT 439 448 END IF 440 champtime(:, :,l)=champint449 champtime(:, :, l)=champint 441 450 END DO 442 ierr=NF90_CLOSE(ncid); CALL ncerr(ierr,fnam)443 444 DEALLOCATE(dlon_ini, dlat_ini,dlon,dlat,champ)451 ierr=NF90_CLOSE(ncid); CALL ncerr(ierr, fnam) 452 453 DEALLOCATE(dlon_ini, dlat_ini, dlon, dlat, champ) 445 454 IF(extrp) DEALLOCATE(work) 446 455 447 !--- TIME INTERPOLATION -------------------------------------------------------- 448 WRITE(lunout,*) 449 WRITE(lunout,*)'INTERPOLATION TEMPORELLE.' 450 WRITE(lunout,"(2x,' Vecteur temps en entree: ',10f6.1)") timeyear 451 WRITE(lunout,"(2x,' Vecteur temps en sortie de 0 a ',i3)") ndays 452 ALLOCATE(yder(lmdep),champan(iip1,jjp1,ndays)) 453 DO j=1,jjp1 454 DO i=1,iim 455 CALL spline(timeyear,champtime(i,j,:),lmdep,1.e30,1.e30,yder) 456 DO k=1,ndays 457 time=FLOAT((k-1)*ndays_in)/FLOAT(ndays) 458 CALL splint(timeyear,champtime(i,j,:),yder,lmdep,time,by) 459 champan(i,j,k) = by 460 END DO 456 !--- TIME INTERPOLATION ------------------------------------------------------ 457 WRITE(lunout, *) 458 WRITE(lunout, *)'INTERPOLATION TEMPORELLE.' 459 WRITE(lunout, "(2x, ' Vecteur temps en entree: ', 10f6.1)") timeyear 460 WRITE(lunout, "(2x, ' Vecteur temps en sortie de 0 a ', i3)") ndays 461 ALLOCATE(yder(lmdep), champan(iip1, jjp1, ndays)) 462 skip = .false. 463 n_extrap = 0 464 DO j=1, jjp1 465 DO i=1, iim 466 yder = pchsp_95(timeyear, champtime(i, j, :), ibeg=2, iend=2, & 467 vc_beg=0., vc_end=0.) 468 CALL pchfe_95(timeyear, champtime(i, j, :), yder, skip, & 469 arth(0., real(ndays_in) / ndays, ndays), champan(i, j, :), ierr) 470 if (ierr < 0) stop 1 471 n_extrap = n_extrap + ierr 461 472 END DO 462 473 END DO 463 champan(iip1,:,:)=champan(1,:,:) 464 DEALLOCATE(yder,champtime,timeyear) 474 if (n_extrap /= 0) then 475 print *, "get_2Dfield pchfe_95: n_extrap = ", n_extrap 476 end if 477 champan(iip1, :, :)=champan(1, :, :) 478 DEALLOCATE(yder, champtime, timeyear) 465 479 466 480 !--- Checking the result 467 DO j=1, jjp1468 CALL minmax(iip1, champan(1,j,10),chmin,chmax)469 WRITE(lunout, *)' '//TRIM(title)//' au temps 10 ',chmin,chmax,j481 DO j=1, jjp1 482 CALL minmax(iip1, champan(1, j, 10), chmin, chmax) 483 WRITE(lunout, *)' '//TRIM(title)//' au temps 10 ', chmin, chmax, j 470 484 END DO 471 485 472 !--- SPECIAL FILTER FOR SST: SST>271.38 -------------------------------------- --486 !--- SPECIAL FILTER FOR SST: SST>271.38 -------------------------------------- 473 487 IF(mode=='SST') THEN 474 WRITE(lunout, *) 'Filtrage de la SST: SST >= 271.38'488 WRITE(lunout, *) 'Filtrage de la SST: SST >= 271.38' 475 489 WHERE(champan<271.38) champan=271.38 476 490 END IF 477 491 478 !--- SPECIAL FILTER FOR SIC: 0.0<SIC<1.0 ------------------------------------- --492 !--- SPECIAL FILTER FOR SIC: 0.0<SIC<1.0 ------------------------------------- 479 493 IF(mode=='SIC') THEN 480 WRITE(lunout, *) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0'481 IF(.NOT.lCPL) champan(:, :,:)=champan(:,:,:)/100.482 champan(iip1, :,:)=champan(1,:,:)494 WRITE(lunout, *) 'Filtrage de la SIC: 0.0 < Sea-ice < 1.0' 495 IF(.NOT.lCPL) champan(:, :, :)=champan(:, :, :)/100. 496 champan(iip1, :, :)=champan(1, :, :) 483 497 WHERE(champan>1.0) champan=1.0 484 498 WHERE(champan<0.0) champan=0.0 485 499 END IF 486 500 487 !--- DYNAMICAL TO PHYSICAL GRID ---------------------------------------------- --488 ALLOCATE(champo(klon, ndays))489 DO k=1, ndays490 CALL gr_dyn_fi(1, iip1,jjp1,klon,champan(1,1,k),champo(1,k))501 !--- DYNAMICAL TO PHYSICAL GRID ---------------------------------------------- 502 ALLOCATE(champo(klon, ndays)) 503 DO k=1, ndays 504 CALL gr_dyn_fi(1, iip1, jjp1, klon, champan(1, 1, k), champo(1, k)) 491 505 END DO 492 506 DEALLOCATE(champan) -
LMDZ4/trunk/libf/dyn3dpar/startvar.F90
r1323 r1425 643 643 !------------------------------------------------------------------------------- 644 644 ! 645 SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in, lat_in, jml2,lon_in2,& 646 lat_in2, pls_in, var3d, ibar) 647 ! 648 !------------------------------------------------------------------------------- 645 SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in, lat_in, jml2, & 646 lon_in2, lat_in2, pls_in, var3d, ibar) 647 648 use pchsp_95_m, only: pchsp_95 649 use pchfe_95_m, only: pchfe_95 650 649 651 ! Arguments: 650 652 CHARACTER(LEN=*), INTENT(IN) :: varname … … 655 657 REAL, DIMENSION(iml), INTENT(IN) :: lon_in2 656 658 REAL, DIMENSION(jml2), INTENT(IN) :: lat_in2 657 REAL, DIMENSION(iml, jml,lml), INTENT(IN) :: pls_in658 REAL, DIMENSION(iml, jml,lml), INTENT(OUT) :: var3d659 REAL, DIMENSION(iml, jml, lml), INTENT(IN) :: pls_in 660 REAL, DIMENSION(iml, jml, lml), INTENT(OUT) :: var3d 659 661 LOGICAL, INTENT(IN) :: ibar 660 !---------------------------------------------------------------------------- ---662 !---------------------------------------------------------------------------- 661 663 ! Local variables: 662 664 #include "iniprint.h" 663 LOGICAL :: check=.TRUE. 664 REAL :: bx, by, chmin, chmax 665 INTEGER :: ii, ij, il 666 REAL, DIMENSION(:,:,:), ALLOCATABLE :: var_tmp3d 665 LOGICAL:: check=.TRUE., skip 666 REAL chmin, chmax 667 INTEGER ii, ij, il, ierr 668 integer n_extrap ! number of extrapolated points 669 REAL, DIMENSION(iml, jml, llm_dyn):: var_tmp3d 667 670 REAL, DIMENSION(:), ALLOCATABLE :: lon_rad, lat_rad, lon_ini, lat_ini 668 REAL, DIMENSION(:), ALLOCATABLE :: lev_dyn, ax, ay, yder 669 INTEGER, DIMENSION(:), ALLOCATABLE :: lind 670 !------------------------------------------------------------------------------- 671 IF(check) WRITE(lunout,*)'Going into flinget to extract the 3D field.' 672 IF(check) WRITE(lunout,*)fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, ttm_dyn 673 IF(check) WRITE(lunout,*)'Allocating space for interpolation',iml,jml,llm_dyn 674 675 IF(.NOT.ALLOCATED(var_ana3d)) ALLOCATE(var_ana3d(iml_dyn,jml_dyn,llm_dyn)) 676 CALL flinget(fid_dyn,varname,iml_dyn,jml_dyn,llm_dyn,ttm_dyn,1,1,var_ana3d) 671 REAL, DIMENSION(llm_dyn):: lev_dyn, ax, ay, yder 672 673 !--------------------------------------------------------------------------- 674 IF(check) WRITE(lunout, *)'Going into flinget to extract the 3D field.' 675 IF(check) WRITE(lunout, *) fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, & 676 ttm_dyn 677 IF(check) WRITE(lunout, *) 'Allocating space for interpolation', iml, jml, & 678 llm_dyn 679 680 IF(.NOT.ALLOCATED(var_ana3d)) ALLOCATE(var_ana3d(iml_dyn, jml_dyn, llm_dyn)) 681 CALL flinget(fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, ttm_dyn, 1, 1, & 682 var_ana3d) 677 683 678 684 !--- IF ANGLES ARE IN DEGREES, THEY ARE CONVERTED INTO RADIANS 679 ALLOCATE(lon_ini(iml_dyn), lat_ini(jml_dyn))680 lon_ini(:)=lon_dyn(:, 1); IF(MAXVAL(lon_dyn)>pi) lon_ini=lon_ini*deg2rad681 lat_ini(:)=lat_dyn(1, :); IF(MAXVAL(lat_dyn)>pi) lat_ini=lat_ini*deg2rad685 ALLOCATE(lon_ini(iml_dyn), lat_ini(jml_dyn)) 686 lon_ini(:)=lon_dyn(:, 1); IF(MAXVAL(lon_dyn)>pi) lon_ini=lon_ini*deg2rad 687 lat_ini(:)=lat_dyn(1, :); IF(MAXVAL(lat_dyn)>pi) lat_ini=lat_ini*deg2rad 682 688 683 689 !--- FIELDS ARE PROCESSED TO BE ON STANDARD ANGULAR DOMAINS 684 ALLOCATE(lon_rad(iml_dyn), lat_rad(jml_dyn),lev_dyn(llm_dyn))685 CALL conf_dat3d (varname, iml_dyn, jml_dyn, llm_dyn, lon_ini, lat_ini, 690 ALLOCATE(lon_rad(iml_dyn), lat_rad(jml_dyn)) 691 CALL conf_dat3d (varname, iml_dyn, jml_dyn, llm_dyn, lon_ini, lat_ini, & 686 692 levdyn_ini, lon_rad, lat_rad, lev_dyn, var_ana3d, ibar) 687 DEALLOCATE(lon_ini, lat_ini)693 DEALLOCATE(lon_ini, lat_ini) 688 694 689 695 !--- COMPUTING THE REQUIRED FIELDS USING ROUTINE grid_noro 690 ALLOCATE(var_tmp3d(iml,jml,llm_dyn)) 691 DO il=1,llm_dyn 692 CALL interp_startvar(varname, ibar, il==1, & 693 iml_dyn, jml_dyn, lon_rad, lat_rad, var_ana3d(:,:,il), iml, jml, jml2, & 694 lon_in, lat_in, lon_in2, lat_in2, var_tmp3d(:,:,il)) 696 DO il=1, llm_dyn 697 CALL interp_startvar(varname, ibar, il==1, iml_dyn, jml_dyn, lon_rad, & 698 lat_rad, var_ana3d(:, :, il), iml, jml, jml2, lon_in, lat_in, & 699 lon_in2, lat_in2, var_tmp3d(:, :, il)) 695 700 END DO 696 DEALLOCATE(lon_rad,lat_rad) 697 698 ALLOCATE(lind(llm_dyn)) 699 DO il=1,llm_dyn 700 lind(il) = llm_dyn-il+1 701 DEALLOCATE(lon_rad, lat_rad) 702 703 !--- VERTICAL INTERPOLATION IS PERFORMED FROM TOP OF ATMOSPHERE TO GROUND 704 ax = lev_dyn(llm_dyn:1:-1) 705 skip = .false. 706 n_extrap = 0 707 DO ij=1, jml 708 DO ii=1, iml-1 709 ay = var_tmp3d(ii, ij, llm_dyn:1:-1) 710 yder = pchsp_95(ax, ay, ibeg=2, iend=2, vc_beg=0., vc_end=0.) 711 CALL pchfe_95(ax, ay, yder, skip, pls_in(ii, ij, lml:1:-1), & 712 var3d(ii, ij, lml:1:-1), ierr) 713 if (ierr < 0) stop 1 714 n_extrap = n_extrap + ierr 715 END DO 701 716 END DO 702 703 !--- VERTICAL INTERPOLATION IS PERFORMED FROM TOP OF ATMOSPHERE TO GROUND 704 ALLOCATE(ax(llm_dyn),ay(llm_dyn),yder(llm_dyn)) 705 DO ij=1,jml 706 DO ii=1,iml-1 707 ax(:)=lev_dyn(lind(:)) 708 ay(:)=var_tmp3d(ii,ij,lind(:)) 709 CALL SPLINE(ax, ay, llm_dyn, 1.e30, 1.e30, yder) 710 DO il=1,lml 711 bx=pls_in(ii,ij,il) 712 CALL SPLINT(ax, ay, yder, llm_dyn, bx, by) 713 var3d(ii,ij,il) = by 714 END DO 715 END DO 716 var3d(iml,ij,:) = var3d(1,ij,:) 717 if (n_extrap /= 0) then 718 print *, "start_inter_3d pchfe_95: n_extrap = ", n_extrap 719 end if 720 var3d(iml, :, :) = var3d(1, :, :) 721 722 DO il=1, lml 723 CALL minmax(iml*jml, var3d(1, 1, il), chmin, chmax) 724 WRITE(lunout, *)' '//TRIM(varname)//' min max l ', il, chmin, chmax 717 725 END DO 718 DEALLOCATE(var_tmp3d,lev_dyn,ax,ay,yder,lind)719 720 DO il=1,lml721 CALL minmax(iml*jml,var3d(1,1,il),chmin,chmax)722 WRITE(lunout,*)' '//TRIM(varname)//' min max l ',il,chmin,chmax723 END DO724 725 RETURN726 726 727 727 END SUBROUTINE start_inter_3d -
LMDZ4/trunk/libf/phylmd/physiq.F
r1422 r1425 1127 1127 1128 1128 integer, save:: read_climoz ! read ozone climatology 1129 C (let it keep the default OpenMP shared attribute) 1129 1130 C Allowed values are 0, 1 and 2 1130 1131 C 0: do not read an ozone climatology … … 1134 1135 1135 1136 integer, save:: ncid_climoz ! NetCDF file containing ozone climatologies 1137 C (let it keep the default OpenMP shared attribute) 1136 1138 1137 1139 real, pointer, save:: press_climoz(:) 1140 C (let it keep the default OpenMP shared attribute) 1138 1141 ! edges of pressure intervals for ozone climatologies, in Pa, in strictly 1139 1142 ! ascending order
Note: See TracChangeset
for help on using the changeset viewer.