Ignore:
Timestamp:
Jan 8, 2016, 9:52:14 AM (9 years ago)
Author:
ymipsl
Message:
  • Switch to XIOS 2
  • Append main part of forcing configuration (LMDZ stand alone)
  • Create etat0 and limit from usual LMDZ input files, using XIOS 2 interpolation functionnalities
    • missing parametrization of gravity waves
    • missing aerosol
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/wxios.F90

    r3849 r3867  
    3131    SUBROUTINE reformadate(odate, ndate)
    3232        CHARACTER(len=*), INTENT(IN) :: odate
    33         CHARACTER(len=100), INTENT(OUT) :: ndate
     33        TYPE(xios_duration) :: ndate
    3434       
    3535        INTEGER :: i = 0
     
    4646        i = INDEX(odate, "day")
    4747        IF (i > 0) THEN
    48             ndate = odate(1:i-1)//"d"
     48            read(odate(1:i-1),*) ndate%day
    4949        END IF
    5050
    5151        i = INDEX(odate, "hr")
    5252        IF (i > 0) THEN
    53             ndate = odate(1:i-1)//"h"
     53            read(odate(1:i-1),*) ndate%hour
    5454        END IF
    5555
    5656        i = INDEX(odate, "mth")
    5757        IF (i > 0) THEN
    58             ndate = odate(1:i-1)//"mo"
     58            read(odate(1:i-1),*) ndate%month
    5959        END IF
    6060       
     
    135135    SUBROUTINE wxios_context_init()
    136136        USE print_control_mod, ONLY : prt_level, lunout
     137        USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY
    137138        IMPLICIT NONE
    138139
     
    141142!$OMP MASTER
    142143        !Initialisation du contexte:
    143         CALL xios_context_initialize(g_ctx_name, g_comm)
     144        CALL xios_context_initialize(g_ctx_name, COMM_LMDZ_PHY)
    144145        CALL xios_get_handle(g_ctx_name, xios_ctx)    !Récupération
    145146        CALL xios_set_current_context(xios_ctx)            !Activation
     
    186187     
    187188     !Variables pour xios:
    188      TYPE(xios_time) :: mdtime
     189     TYPE(xios_duration) :: mdtime
    189190     !REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0
    190191     
    191         mdtime = xios_time(0, 0, 0, 0, 0, pasdetemps)
     192        mdtime%second=pasdetemps
    192193
    193194        !Réglage du calendrier:
    194195        SELECT CASE (calendrier)
    195196            CASE('earth_360d')
    196                 CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "D360")
     197                CALL xios_define_calendar("D360")
    197198                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 360 jours/an'
    198199            CASE('earth_365d')
    199                 CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "NoLeap")
     200                CALL xios_define_calendar("NoLeap")
    200201                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 365 jours/an'
    201202            CASE('earth_366d')
    202                 CALL xios_set_context_attr_hdl(g_ctx, calendar_type= "Gregorian")
     203                CALL xios_define_calendar("Gregorian")
    203204                IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier gregorien'
    204205            CASE DEFAULT
     
    211212       
    212213        IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Time origin: ", date
    213        
    214         CALL xios_set_context_attr_hdl(g_ctx, time_origin = date)
     214
     215        CALL xios_set_time_origin(xios_date(annee,mois,jour,int(heure),0,0))
    215216
    216217        !Formatage de la date de debut:
     
    220221        IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Start date: ", date
    221222       
    222         CALL xios_set_context_attr_hdl(g_ctx, start_date = date)
     223        CALL xios_set_start_date(xios_date(ini_an,ini_mois,ini_jour,int(ini_heure),0,0))
    223224       
    224225        !Et enfin,le pas de temps:
     
    229230    SUBROUTINE wxios_set_timestep(ts)
    230231        REAL, INTENT(IN) :: ts
    231         TYPE(xios_time) :: mdtime     
    232 
    233         mdtime = xios_time(0, 0, 0, 0, 0, ts)
     232        TYPE(xios_duration) :: mdtime     
     233
     234        mdtime%timestep = ts
    234235
    235236        CALL xios_set_timestep(mdtime)
     
    285286       
    286287        !On parametrise le domaine:
    287         CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin, ni=ni)
    288         CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin, nj=nj, data_dim=2)
    289         CALL xios_set_domain_attr_hdl(dom, lonvalue=io_lon(ibegin:iend), latvalue=io_lat(jbegin:jend))
     288        CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin-1, ni=ni)
     289        CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin-1, nj=nj, data_dim=2)
     290        CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(ibegin:iend), latvalue_1d=io_lat(jbegin:jend))
    290291
    291292        IF (.NOT.is_sequential) THEN
     
    299300              WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,nj)=",mask(:,nj)
    300301            ENDIF
    301             CALL xios_set_domain_attr_hdl(dom, mask=mask)
     302            CALL xios_set_domain_attr_hdl(dom, mask_2d=mask)
    302303        END IF
    303304
     
    322323        REAL :: boundslon_mpi(klon_mpi,nvertex)
    323324        REAL :: boundslat_mpi(klon_mpi,nvertex)
    324         TYPE(xios_domain) :: dom
     325        TYPE(xios_domaingroup) :: dom
    325326
    326327
     
    331332
    332333!$OMP MASTER
    333         CALL xios_get_domain_handle("dom_glo", dom)
     334        CALL xios_get_domaingroup_handle("dom_glo", dom)
    334335       
    335336        !On parametrise le domaine:
    336         CALL xios_set_domain_attr_hdl(dom, ni_glo=klon_glo, ibegin=ij_begin, ni=ij_nb, data_dim=1, type="unstructured")
    337         CALL xios_set_domain_attr_hdl(dom, nvertex=nvertex, lonvalue=lon_mpi, latvalue=lat_mpi, bounds_lon=TRANSPOSE(boundslon_mpi), bounds_lat=TRANSPOSE(boundslat_mpi) )
     337        CALL xios_set_attr(dom, ni_glo=klon_glo, ibegin=ij_begin-1, ni=ij_nb, type="unstructured")
     338        CALL xios_set_attr(dom, nvertex=nvertex, lonvalue_1d=lon_mpi, latvalue_1d=lat_mpi, bounds_lon_1d=TRANSPOSE(boundslon_mpi), bounds_lat_1d=TRANSPOSE(boundslat_mpi) )
    338339!$OMP END MASTER
    339340
     
    375376       
    376377        ! Ehouarn: New way to declare axis, without axis_group:
    377         CALL xios_set_axis_attr(trim(axis_id),size=axis_size,value=axis_value)
     378        CALL xios_set_axis_attr(trim(axis_id),n_glo=axis_size,value=axis_value)
    378379       
    379380        !Vérification:
     
    400401        TYPE(xios_file) :: x_file
    401402        TYPE(xios_filegroup) :: x_fg
    402         CHARACTER(len=100) :: nffreq
     403!        CHARACTER(len=100) :: nffreq
     404        TYPE(xios_duration) :: nffreq
    403405       
    404406        !On regarde si le fichier n'est pas défini par XML:
     
    413415            !On configure:
    414416            CALL xios_set_file_attr_hdl(x_file, name="X"//fname,&
    415                 output_freq=TRIM(ADJUSTL(nffreq)), output_level=flvl, enabled=.TRUE.)
     417                output_freq=nffreq, output_level=flvl, enabled=.TRUE.)
    416418       
    417419            IF (xios_is_valid_file("X"//fname)) THEN
    418420                IF (prt_level >= 10) THEN
    419421                  WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname
    420                   WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     422                  WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl
    421423                ENDIF
    422424            ELSE
    423425                WRITE(lunout,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname)
    424                 WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     426                WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl
    425427            END IF
    426428        ELSE
     
    492494        TYPE(xios_field) :: field
    493495        TYPE(xios_fieldgroup) :: fieldgroup
     496        TYPE(xios_duration) :: freq_op
    494497        LOGICAL :: bool=.FALSE.
    495498        INTEGER :: lvl =0
     
    550553           
    551554            !L'operation, sa frequence:
    552             CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op="1ts", prec=4)
     555            freq_op%timestep=1
     556            CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op=freq_op, prec=4)
    553557
    554558           
Note: See TracChangeset for help on using the changeset viewer.