Ignore:
Timestamp:
Nov 21, 2019, 4:43:45 PM (4 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/readaerosolstrato.F90

    r2745 r3605  
    77    USE phys_cal_mod, ONLY : mth_cur
    88    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, &
    9                                  grid2dto1d_glo
     9                                 grid2dto1d_glo, grid_type, unstructured
    1010    USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
    1111    USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     
    1515    USE aero_mod
    1616    USE dimphy
    17 
     17    USE print_control_mod, ONLY: prt_level,lunout
     18#ifdef CPP_XIOS
     19    USE xios
     20#endif
    1821    implicit none
    1922
     
    4346    real, allocatable:: tauaerstrat_mois(:, :, :)
    4447    real, allocatable:: tauaerstrat_mois_glo(:, :)
     48    real, allocatable:: tau_aer_strat_mpi(:, :)
    4549
    4650! For NetCDF:
     
    5862    data alpha_strat_wave/3.36780953,3.34667683,3.20444202,3.0293026,2.82108808/
    5963
     64    CHARACTER (len = 20)                      :: modname = 'readaerosolstrato'
     65    CHARACTER (len = 80)                      :: abort_message
     66
    6067!--------------------------------------------------------
    6168
     
    6976
    7077    IF (nbands.NE.2) THEN
    71         print *,'nbands doit etre egal a 2 dans readaerosolstrat'
    72         STOP
     78        abort_message='nbands doit etre egal a 2 dans readaerosolstrat'
     79        CALL abort_physic(modname,abort_message,1)
    7380    ENDIF
    7481
     
    7986    n_lev = size(lev)
    8087    IF (n_lev.NE.klev) THEN
    81        print *,'Le nombre de niveaux n est pas egal a klev'
    82        STOP
     88       abort_message='Le nombre de niveaux n est pas egal a klev'
     89       CALL abort_physic(modname,abort_message,1)
    8390    ENDIF
    8491
     
    8693    CALL nf95_gw_var(ncid_in, varid, latitude)
    8794    n_lat = size(latitude)
    88     print *, 'LAT aerosol strato=', n_lat, latitude
    89     IF (n_lat.NE.nbp_lat) THEN
    90        print *,'Le nombre de lat n est pas egal a nbp_lat'
    91        STOP
    92     ENDIF
    93 
     95    WRITE(lunout,*) 'LAT aerosol strato=', n_lat, latitude
     96    IF (grid_type/=unstructured) THEN
     97      IF (n_lat.NE.nbp_lat) THEN
     98         abort_message='Le nombre de lat n est pas egal a nbp_lat'
     99         CALL abort_physic(modname,abort_message,1)
     100      ENDIF
     101    ENDIF
     102   
    94103    CALL nf95_inq_varid(ncid_in, "LON", varid)
    95104    CALL nf95_gw_var(ncid_in, varid, longitude)
    96105    n_lon = size(longitude)
    97     print *, 'LON aerosol strato=', n_lon, longitude
    98     IF (n_lon.NE.nbp_lon) THEN
    99        print *,'Le nombre de lon n est pas egal a nbp_lon'
    100        STOP
    101     ENDIF
    102 
     106    IF (grid_type/=unstructured) THEN
     107      WRITE(lunout,*) 'LON aerosol strato=', n_lon, longitude
     108      IF (n_lon.NE.nbp_lon) THEN
     109         abort_message='Le nombre de lon n est pas egal a nbp_lon'
     110         CALL abort_physic(modname,abort_message,1)
     111      ENDIF
     112    ENDIF
     113   
    103114    CALL nf95_inq_varid(ncid_in, "TIME", varid)
    104115    CALL nf95_gw_var(ncid_in, varid, time)
    105116    n_month = size(time)
    106     print *, 'TIME aerosol strato=', n_month, time
     117    WRITE(lunout,*) 'TIME aerosol strato=', n_month, time
    107118    IF (n_month.NE.12) THEN
    108        print *,'Le nombre de month n est pas egal a 12'
    109        STOP
     119       abort_message='Le nombre de month n est pas egal a 12'
     120       CALL abort_physic(modname,abort_message,1)
    110121    ENDIF
    111122
     
    117128    CALL nf95_inq_varid(ncid_in, "TAUSTRAT", varid)
    118129    ncerr = nf90_get_var(ncid_in, varid, tauaerstrat)
    119     print *,'code erreur readaerosolstrato=', ncerr, varid
     130    WRITE(lunout,*) 'code erreur readaerosolstrato=', ncerr, varid
    120131
    121132    CALL nf95_close(ncid_in)
     
    123134!---select the correct month
    124135    IF (mth_cur.LT.1.OR.mth_cur.GT.12) THEN
    125       print *,'probleme avec le mois dans readaerosolstrat =', mth_cur
     136     WRITE(lunout,*) 'probleme avec le mois dans readaerosolstrat =', mth_cur
    126137    ENDIF
    127138    tauaerstrat_mois(:,:,:) = tauaerstrat(:,:,:,mth_cur)
     
    130141    CALL grid2dTo1d_glo(tauaerstrat_mois,tauaerstrat_mois_glo)
    131142
     143    ELSE
     144      ALLOCATE(tauaerstrat_mois(0,0,0))
    132145    ENDIF !--is_mpi_root and is_omp_root
    133146
    134147!$OMP BARRIER
    135148
     149    IF (grid_type==unstructured) THEN
     150#ifdef CPP_XIOS
     151      IF (is_omp_master) THEN
     152        CALL xios_send_field("taustrat_in",tauaerstrat_mois)
     153        ALLOCATE(tau_aer_strat_mpi(klon_mpi, klev))
     154        CALL xios_recv_field("taustrat_out",tau_aer_strat_mpi)
     155      ELSE
     156        ALLOCATE(tau_aer_strat_mpi(0,0))
     157      ENDIF
     158      CALL scatter_omp(tau_aer_strat_mpi,tau_aer_strat)
     159#endif
     160    ELSE 
    136161!--scatter on all proc
    137     CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
     162      CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
     163    ENDIF
    138164
    139165!--keep memory of previous month
Note: See TracChangeset for help on using the changeset viewer.