Changeset 4539


Ignore:
Timestamp:
May 17, 2023, 12:53:42 AM (12 months ago)
Author:
fhourdin
Message:

Modification for the new physiqex programme

Location:
LMDZ6/trunk/libf/phylmd
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/physiqex_mod.F90

    r4537 r4539  
    1717      USE geometry_mod, only : latitude
    1818!      USE comcstphy, only : rg
    19       USE iophy, only : histbeg_phy,histwrite_phy
    20       USE ioipsl, only : getin,histvert,histdef,histend,ymds2ju
    21       USE mod_phys_lmdz_para, only : jj_nb
     19      USE ioipsl, only : ymds2ju
    2220      USE phys_state_var_mod, only : phys_state_var_init
    23       USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat
    2421      USE phyetat0_mod, only: phyetat0
    25       USE iophy, ONLY : init_iophy_new
    26       USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
    27 
    28 
    29 #ifdef CPP_XIOS
    30       USE xios, ONLY: xios_update_calendar
    31       USE wxios, only: wxios_add_vaxis, wxios_set_cal, wxios_closedef
    32       USE iophy, ONLY: histwrite_phy
    33 #endif
     22      USE output_physiqex_mod, ONLY: output_physiqex
    3423
    3524      IMPLICIT none
     
    6958
    7059
    71 integer,save :: itau=0 ! counter to count number of calls to physics
    72 !$OMP THREADPRIVATE(itau)
    7360real :: temp_newton(klon,klev)
    7461integer :: k
     
    8269integer :: itau0
    8370real :: zjulian
    84 real :: dtime
    85 integer :: nhori ! horizontal coordinate ID
    86 integer,save :: nid_hist ! output file ID
    87 !$OMP THREADPRIVATE(nid_hist)
    88 integer :: zvertid ! vertical coordinate ID
    89 integer,save :: iwrite_phys ! output every iwrite_phys physics step
    90 !$OMP THREADPRIVATE(iwrite_phys)
    91 integer,save :: iwrite_phys_omp ! intermediate variable to read iwrite_phys
    92                                 ! (must be shared by all threads)
    93 real :: t_ops ! frequency of the IOIPSL operations (eg average over...)
    94 real :: t_wrt ! frequency of the IOIPSL outputs
    95 
    9671
    9772
     
    10883  call phys_state_var_init(1) ! some initializations, required before calling phyetat0
    10984  call phyetat0("startphy.nc", clesphy0, tabcntr0)
    110   CALL init_iophy_new(latitude_deg,longitude_deg)
    11185
    11286! Initialize outputs:
    11387  itau0=0
    114 !$OMP MASTER
    115   iwrite_phys_omp=1 !default: output every physics timestep
    116   ! NB: getin() is not threadsafe; only one thread should call it.
    117   call getin("iwrite_phys",iwrite_phys_omp)
    118 !$OMP END MASTER
    119 !$OMP BARRIER
    120   iwrite_phys=iwrite_phys_omp
    121   t_ops=pdtphys*iwrite_phys ! frequency of the IOIPSL operation
    122   t_wrt=pdtphys*iwrite_phys ! frequency of the outputs in the file
    12388  ! compute zjulian for annee0=1979 and month=1 dayref=1 and hour=0.0
    12489  !CALL ymds2ju(annee0, month, dayref, hour, zjulian)
    12590  call ymds2ju(1979, 1, 1, 0.0, zjulian)
    126   dtime=pdtphys
    12791
    12892#ifndef CPP_IOIPSL_NO_OUTPUT
    12993  ! Initialize IOIPSL output file
    130   call histbeg_phy("histins.nc",itau0,zjulian,dtime,nhori,nid_hist)
    13194#endif
    13295
     
    137100!------------------------------------------------------------
    138101
    139 ! increment local time counter itau
    140 itau=itau+1
    141102
    142103! set all tendencies to zero
     
    166127!------------------------------------------------------------
    167128
    168 print*,'PHYDEV: itau=',itau
    169129
    170 
    171 if(debut)then
    172 !$OMP MASTER
    173 #ifndef CPP_IOIPSL_NO_OUTPUT
    174 ! IOIPSL
    175   ! define vertical coordinate
    176   call histvert(nid_hist,"presnivs","Vertical levels","Pa",klev, &
    177                 presnivs,zvertid,'down')
    178   ! define variables which will be written in "histins.nc" file
    179   call histdef(nid_hist,'temperature','Atmospheric temperature','K', &
    180                nbp_lon,jj_nb,nhori,klev,1,klev,zvertid,32, &
    181                'inst(X)',t_ops,t_wrt)
    182   call histdef(nid_hist,'u','Eastward Zonal Wind','m/s', &
    183                nbp_lon,jj_nb,nhori,klev,1,klev,zvertid,32, &
    184                'inst(X)',t_ops,t_wrt)
    185   call histdef(nid_hist,'v','Northward Meridional Wind','m/s', &
    186                nbp_lon,jj_nb,nhori,klev,1,klev,zvertid,32, &
    187                'inst(X)',t_ops,t_wrt)
    188   call histdef(nid_hist,'ps','Surface Pressure','Pa', &
    189                nbp_lon,jj_nb,nhori,1,1,1,zvertid,32, &
    190                'inst(X)',t_ops,t_wrt)
    191   ! end definition sequence
    192   call histend(nid_hist)
    193 #endif
    194 
    195 #ifdef CPP_XIOS
    196 !XIOS
    197     ! Declare available vertical axes to be used in output files:   
    198     CALL wxios_add_vaxis("presnivs", klev, presnivs)
    199 
    200     ! Declare calendar and time step
    201     CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0)
    202    
    203     !Finalize the context:
    204     CALL wxios_closedef()
    205 #endif
    206 !$OMP END MASTER
    207 !$OMP BARRIER
    208 endif
    209 ! write some outputs:
    210 ! IOIPSL
    211 #ifndef CPP_IOIPSL_NO_OUTPUT
    212 if (modulo(itau,iwrite_phys)==0) then
    213   call histwrite_phy(nid_hist,.false.,"temperature",itau,t)
    214   call histwrite_phy(nid_hist,.false.,"u",itau,u)
    215   call histwrite_phy(nid_hist,.false.,"v",itau,v)
    216   call histwrite_phy(nid_hist,.false.,"ps",itau,paprs(:,1))
    217 endif
    218 #endif
    219 
    220 !XIOS
    221 #ifdef CPP_XIOS
    222 !$OMP MASTER
    223     !Increment XIOS time
    224     CALL xios_update_calendar(itau)
    225 !$OMP END MASTER
    226 !$OMP BARRIER
    227 
    228     !Send fields to XIOS: (NB these fields must also be defined as
    229     ! <field id="..." /> in iodef.xml to be correctly used
    230     CALL histwrite_phy("temperature",t)
    231     CALL histwrite_phy("temp_newton",temp_newton)
    232     CALL histwrite_phy("u",u)
    233     CALL histwrite_phy("v",v)
    234     CALL histwrite_phy("ps",paprs(:,1))
    235 #endif
     130call output_physiqex(debut,zjulian,pdtphys,presnivs,paprs,u,v,t)
    236131
    237132! if lastcall, then it is time to write "restartphy.nc" file
     
    240135endif
    241136
     137
    242138end subroutine physiqex
    243139
Note: See TracChangeset for help on using the changeset viewer.