Ignore:
Timestamp:
Jan 17, 2018, 4:20:00 PM (7 years ago)
Author:
jvatant
Message:

Merge EM modifs on phy_common and xios
from LMDZ.GENERIC to LMDZ.TITAN.
See logs from r1673, r1682 and r1760
--JVO

Location:
trunk/LMDZ.TITAN/libf/phytitan
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/phytitan/inifis_mod.F90

    r1843 r1896  
    99             prad,pg,pr,pcpp)
    1010
     11  use init_print_control_mod, only: init_print_control
    1112  use radinc_h, only: ini_radinc_h
    1213  use datafile_mod
     
    7475  REAL SSUM
    7576 
     77  ! Initialize flags lunout, prt_level, debug (in print_control_mod)
     78  CALL init_print_control
     79
    7680  ! initialize constants in comcstfi_mod
    7781  rad=prad
  • trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90

    r1844 r1896  
    3939      use vertical_layers_mod, only: presnivs, pseudoalt
    4040      use ioipsl_getin_p_mod, only: getin_p
     41      use mod_phys_lmdz_omp_data, ONLY: is_omp_master
    4142#ifdef CPP_XIOS     
    4243      use xios_output_mod, only: initialize_xios_output, &
    4344                                 update_xios_timestep, &
    4445                                 send_xios_field
     46      use wxios, only: wxios_context_init, xios_context_finalize
    4547#endif
    4648      implicit none
     
    520522
    521523
     524#ifdef CPP_XIOS
     525        ! Initialize XIOS context
     526        write(*,*) "physiq: call wxios_context_init"
     527        CALL wxios_context_init
     528#endif
     529
    522530!        Read 'startfi.nc' file.
    523531!        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    625633                                     presnivs,pseudoalt)
    626634#endif
     635         write(*,*) "physiq: end of firstcall"
    627636      endif ! end of 'firstcall'
    628637
     
    13281337                          tsurf,tsoil,emis,q2,qsurf_hist,tankCH4)
    13291338         endif
    1330          
    1331       endif ! end of 'lastcall'
     1339    endif ! end of 'lastcall'
    13321340
    13331341
     
    15191527      CALL send_xios_field("u",zu)
    15201528      CALL send_xios_field("v",zv)
    1521      
     1529
     1530      if (lastcall.and.is_omp_master) then
     1531        write(*,*) "physiq: call xios_context_finalize"
     1532        call xios_context_finalize
     1533      endif
    15221534#endif
    15231535
  • trunk/LMDZ.TITAN/libf/phytitan/xios_output_mod.F90

    r1626 r1896  
    2626                                mpi_size, mpi_rank, klon_mpi, &
    2727                                is_sequential, is_south_pole_dyn
    28   USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo
     28  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid_type, unstructured
    2929  USE print_control_mod, ONLY: lunout, prt_level
    3030  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
    3131  USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
    3232  USE nrtype, ONLY: pi
    33   USE wxios
     33#ifdef CPP_XIOS
     34  USE xios
     35#endif
     36  USE wxios, ONLY: wxios_domain_param, wxios_domain_param_unstructured, wxios_closedef
    3437  IMPLICIT NONE
    3538 
     
    6063    ! 2. Declare horizontal domain
    6164    ! Set values for the mask:
    62     IF (mpi_rank == 0) THEN
    63         data_ibegin = 0
    64     ELSE
    65         data_ibegin = ii_begin - 1
    66     END IF
    67 
    68     IF (mpi_rank == mpi_size-1) THEN
    69         data_iend = nbp_lon
    70     ELSE
    71         data_iend = ii_end + 1
    72     END IF
    73 
    74     if (prt_level>=10) then
    75       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
    76       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
    77       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    78       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    79       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
    80     endif
    81 
     65!    IF (mpi_rank == 0) THEN
     66!        data_ibegin = 0
     67!    ELSE
     68!        data_ibegin = ii_begin - 1
     69!    END IF
     70
     71!    IF (mpi_rank == mpi_size-1) THEN
     72!        data_iend = nbp_lon
     73!    ELSE
     74!        data_iend = ii_end + 1
     75!    END IF
     76
     77!    if (prt_level>=10) then
     78!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
     79!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
     80!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     81!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     82!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
     83!    endif
     84
     85!$OMP END MASTER
     86!$OMP BARRIER
    8287    ! Initialize the XIOS domain coreesponding to this process:
    8388    if (prt_level>=10) write(lunout,*) "initialize_xios_output: call wxios_domain_param"
    84     CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
    85                             1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
    86                             klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
    87                             lat_reg*(180./pi), lon_reg*(180./pi),                       &
    88                             is_south_pole_dyn,mpi_rank)
    89 
     89!    CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
     90!                            1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
     91!                            klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
     92!                            lat_reg*(180./pi), lon_reg*(180./pi),                       &
     93!                            is_south_pole_dyn,mpi_rank)
     94
     95    IF (grid_type==unstructured) THEN
     96      CALL wxios_domain_param_unstructured("dom_glo")
     97    ELSE
     98      CALL wxios_domain_param("dom_glo")
     99    ENDIF
     100
     101!$OMP MASTER
    90102    ! 3. Declare calendar and time step
    91     if (prt_level>=10) write(lunout,*) "initialize_xios_output: build calendar"
     103    if (prt_level>=10) then
     104     write(lunout,*) "initialize_xios_output: build calendar"
     105    endif
    92106    timestep%second=dtphys
    93     ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
    94     time_origin=xios_date(1,1,1,0,0,0)
    95     ! start date of the simulation (i.e time elapsed since last Ls=0)
    96     start_date=xios_date(1,1,1,0,0,nint((day+timeofday)*daysec))
     107    if (nint(dtphys).ne.dtphys) then
     108      write(*,*) "initialize_xios_output: warning physics timestep is not an integer!"
     109    endif
     110    if (nint(daysec).ne.daysec) then
     111      write(*,*) "initialize_xios_output: warning day length is not an integer!"
     112    endif
     113    ! Important: do no operations involving dates and calendars
     114    ! before defining the calendar!
    97115    CALL xios_define_calendar(type="user_defined", &
    98116                              timestep=timestep, &
    99117                              day_length=nint(daysec), &
    100                               start_date=start_date, &
    101                               time_origin=time_origin, &
    102118                              month_lengths=[30,30,30,30,30,30,30,30,30,30,30,30])
    103    
     119    !NB: it would make more sense to define months and their length in the
     120    ! xml files and not to have them hard coded here.... to be improved...
     121   
     122    ! time origin of the simulation (default: 1st year/1st month/1st day, Ls=0)
     123    time_origin=xios_date(1,1,1,0,0,0)
     124    CALL xios_set_time_origin(time_origin=time_origin)
     125!    if (prt_level>=10) then
     126     write(lunout,*) "initialize_xios_output: time_origin=",time_origin
     127!    endif
     128
     129    ! Now define the start time of this simulation
     130    ! NB: we substract dtphys because we want to set the origin of the time axis
     131    start_date=time_origin+xios_duration(0,0,day,0,0,timeofday*daysec-dtphys)
     132    call xios_set_start_date(start_date=start_date)
     133    if (prt_level>=10) then
     134     write(lunout,*) "initialize_xios_output: start_date=",start_date
     135    endif
     136
    104137    ! 4. Finalize the context:
    105138    if (prt_level>=10) write(*,*) "initialize_xios_output: call wxios_closedef"
Note: See TracChangeset for help on using the changeset viewer.