Ignore:
Timestamp:
Nov 21, 2019, 4:43:45 PM (5 years ago)
Author:
lguez
Message:

Merge revisions 3427:3600 of trunk into branch Ocean_skin

Location:
LMDZ6/branches/Ocean_skin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Ocean_skin

  • LMDZ6/branches/Ocean_skin/libf/phylmd/limit_read_mod.F90

    r2788 r3605  
    11!
    2 ! $Header$
     2! $Id$
    33!
    44MODULE limit_read_mod
     
    3131!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    3232
     33
     34  SUBROUTINE init_limit_read(first_day)
     35  USE mod_grid_phy_lmdz
     36  USE surface_data
     37  USE mod_phys_lmdz_para
     38#ifdef CPP_XIOS
     39  USE XIOS
     40#endif
     41  IMPLICIT NONE
     42    INTEGER, INTENT(IN) :: first_day
     43   
     44   
     45    IF ( type_ocean /= 'couple') THEN
     46      IF (grid_type==unstructured) THEN
     47#ifdef CPP_XIOS
     48        IF (is_omp_master) CALL xios_set_file_attr("limit_read",enabled=.TRUE.,record_offset=first_day)
     49#endif
     50      ENDIF 
     51    ENDIF
     52
     53  END SUBROUTINE init_limit_read
     54 
    3355  SUBROUTINE limit_read_frac(itime, dtime, jour, pctsrf_new, is_modified)
    3456!
     
    150172    USE phys_cal_mod, ONLY : calend, year_len
    151173    USE print_control_mod, ONLY: lunout, prt_level
    152 
     174#ifdef CPP_XIOS
     175    USE XIOS, ONLY: xios_recv_field
     176#endif
     177   
    153178    IMPLICIT NONE
    154179   
     
    179204    REAL, DIMENSION(klon_glo)                 :: rug_glo  ! rugosity at global grid
    180205    REAL, DIMENSION(klon_glo)                 :: alb_glo  ! albedo at global grid
     206
     207    REAL, DIMENSION(klon_mpi,nbsrf)           :: pct_mpi  ! fraction at global grid
     208    REAL, DIMENSION(klon_mpi)                 :: sst_mpi  ! sea-surface temperature at global grid
     209    REAL, DIMENSION(klon_mpi)                 :: rug_mpi  ! rugosity at global grid
     210    REAL, DIMENSION(klon_mpi)                 :: alb_mpi  ! albedo at global grid
     211
    181212    CHARACTER(len=20)                         :: modname='limit_read_mod'     
    182213    CHARACTER(LEN=99)                         :: abort_message, calendar, str
     
    220251          END IF
    221252
    222           !--- ERROR IF FILE RECORDS NUMBER IS NOT EQUAL TO EXPECTED NUMBER OF DAYS
    223           ierr=NF90_INQUIRE(nid, UnlimitedDimID=ndimid)
     253          !--- ERROR IF FILE RECORDS NUMBER IS NOT EQUAL TO EXPECTED NUMBER OF DAYS         
     254          IF (grid_type==unstructured) THEN
     255            ierr=NF90_INQ_DIMID(nid,"time_year",ndimid)
     256          ELSE
     257            ierr=NF90_INQUIRE(nid, UnlimitedDimID=ndimid)
     258          ENDIF
    224259          ierr=NF90_INQUIRE_DIMENSION(nid, ndimid, len=nn)
    225           WRITE(abort_message,'(a,2(i3,a))')'limit.nc records number (',nn,') does no'//&
     260          WRITE(abort_message,'(a,2(i0,a))')'limit.nc records number (',nn,') does no'//&
    226261            't match year length (',year_len,')'
    227262          IF(nn/=year_len) CALL abort_physic(modname,abort_message,1)
    228263
    229264          !--- ERROR IF FILES AND LMDZ HORIZONTAL RESOLUTIONS DO NOT MATCH
    230           ierr=NF90_INQ_DIMID(nid, 'points_physiques', ndimid)
     265          IF (grid_type==unstructured) THEN
     266            ierr=NF90_INQ_DIMID(nid, 'cell', ndimid)
     267          ELSE
     268            ierr=NF90_INQ_DIMID(nid, 'points_physiques', ndimid)
     269          ENDIF
    231270          ierr=NF90_INQUIRE_DIMENSION(nid, ndimid, len=nn)
    232271          WRITE(abort_message,'(a,2(i0,a))')'limit.nc horizontal number of cells (',nn, &
     
    249288
    250289    is_modified = .FALSE.
    251     IF (MOD(itime-1, lmt_pas) == 0 .OR. jour_lu /= jour ) THEN   ! time to read
     290!ym    IF (MOD(itime-1, lmt_pas) == 0 .OR. jour_lu /= jour ) THEN   ! time to read
     291!  not REALLY PERIODIC
     292    IF (MOD(itime-1, lmt_pas) == 0 .OR. (jour_lu /= jour .AND. grid_type /= unstructured)) THEN   ! time to read
     293!    IF (MOD(itime-1, lmt_pas) == 0) THEN   ! time to read
    252294       jour_lu = jour
    253295       is_modified = .TRUE.
     296
     297      IF (grid_type==unstructured) THEN
     298
     299#ifdef CPP_XIOS
     300        IF ( type_ocean /= 'couple') THEN
     301
     302           IF (is_omp_master) CALL xios_recv_field("foce_limin",pct_mpi(:,is_oce))
     303           IF (is_omp_master) CALL xios_recv_field("fsic_limin",pct_mpi(:,is_sic))
     304  !         IF (read_continents .OR. itime == 1) THEN
     305           IF (is_omp_master) CALL xios_recv_field("fter_limin",pct_mpi(:,is_ter))
     306           IF (is_omp_master) CALL xios_recv_field("flic_limin",pct_mpi(:,is_lic))
     307  !         ENDIF
     308         ENDIF! type_ocean /= couple
     309         
     310         IF ( type_ocean /= 'couple') THEN                   
     311             IF (is_omp_master) CALL xios_recv_field("sst_limin",sst_mpi)
     312         ENDIF
     313       
     314         IF (.NOT. ok_veget) THEN
     315           IF (is_omp_master) CALL xios_recv_field("alb_limin",alb_mpi)
     316           IF (is_omp_master) CALL xios_recv_field("rug_limin",rug_mpi)
     317         ENDIF
     318
     319       IF ( type_ocean /= 'couple') THEN
     320          CALL Scatter_omp(sst_mpi,sst)
     321          CALL Scatter_omp(pct_mpi(:,is_oce),pctsrf(:,is_oce))
     322          CALL Scatter_omp(pct_mpi(:,is_sic),pctsrf(:,is_sic))
     323!          IF (read_continents .OR. itime == 1) THEN
     324             CALL Scatter_omp(pct_mpi(:,is_ter),pctsrf(:,is_ter))
     325             CALL Scatter_omp(pct_mpi(:,is_lic),pctsrf(:,is_lic))
     326!          END IF
     327       END IF
     328
     329       IF (.NOT. ok_veget) THEN
     330          CALL Scatter_omp(alb_mpi, albedo)
     331          CALL Scatter_omp(rug_mpi, rugos)
     332       END IF
     333#endif
     334
     335 
     336     ELSE      ! grid_type==regular
     337
    254338!$OMP MASTER  ! Only master thread
    255        IF (is_mpi_root) THEN ! Only master processus
     339       IF (is_mpi_root) THEN ! Only master processus!
    256340
    257341          ierr = NF90_OPEN ('limit.nc', NF90_NOWRITE, nid)
     
    371455       END IF
    372456
     457      ENDIF ! Grid type
     458
    373459    ENDIF ! time to read
    374460
Note: See TracChangeset for help on using the changeset viewer.