Index: dynamico_lmdz/simple_physics/phyparam/param/phyparam.F90
===================================================================
--- dynamico_lmdz/simple_physics/phyparam/param/phyparam.F90	(revision 4212)
+++ dynamico_lmdz/simple_physics/phyparam/param/phyparam.F90	(revision 4213)
@@ -1,5 +1,25 @@
 MODULE phyparam_mod
   IMPLICIT NONE
-    
+  PRIVATE
+  SAVE
+
+  REAL, PARAMETER :: solarcst=1370., stephan=5.67e-08
+    
+  REAL, ALLOCATABLE :: tsurf(:),tsoil(:,:),rnatur(:), &
+       capcal(:),fluxgrd(:), &
+       dtrad(:,:),fluxrad(:), &
+       q2(:,:),q2l(:,:), &
+       albedo(:),emissiv(:),z0(:),inertie(:)
+  !$OMP THREADPRIVATE( tsurf,tsoil,rnatur)
+  !$OMP THREADPRIVATE( capcal,fluxgrd,dtrad,fluxrad)
+  !$OMP THREADPRIVATE( q2,q2l)
+  !$OMP THREADPRIVATE( albedo,emissiv,z0,inertie)          
+
+  INTEGER :: icount
+  REAL    :: zday_last
+  !$OMP THREADPRIVATE( icount,zday_last)
+
+  PUBLIC :: phyparam
+
 CONTAINS
   
@@ -25,10 +45,6 @@
     USE radiative_lw, ONLY : lw
     USE surface
-    !     
+
     !=======================================================================
-    !
-    !   subject:
-    !   --------
-    !
     !   Organisation of the physical parametrisations of the LMD 
     !   20 parameters GCM for planetary atmospheres.
@@ -39,94 +55,39 @@
     !
     !   author: Frederic Hourdin 15 / 10 /93
-    !   -------
-    !
-    !   arguments:
-    !   ----------
-    !
-    !   input:
-    !   ------
-    !
-    !    ngrid                 Size of the horizontal grid.
-    !                          All internal loops are performed on that grid.
-    !    nlayer                Number of vertical layers.
-    !    nq                    Number of advected fields
-    !    firstcall             True at the first call
-    !    lastcall              True at the last call
-    !    rjourvrai                  Number of days counted from the North. Spring
-    !                          equinoxe.
-    !    gmtime                 hour (s)
-    !    ptimestep             timestep (s)
-    !    pplay(ngrid,nlayer+1) Pressure at the middle of the layers (Pa)
-    !    pplev(ngrid,nlayer+1) intermediate pressure levels (pa)
-    !    pphi(ngrid,nlayer)    Geopotential at the middle of the layers (m2s-2)
-    !    pu(ngrid,nlayer)      u component of the wind (ms-1)
-    !    pv(ngrid,nlayer)      v component of the wind (ms-1)
-    !    pt(ngrid,nlayer)      Temperature (K)
-    !    pq(ngrid,nlayer,nq)   Advected fields
-    !    pudyn(ngrid,nlayer)    \ 
-    !    pvdyn(ngrid,nlayer)     \ Dynamical temporal derivative for the
-    !    ptdyn(ngrid,nlayer)     / corresponding variables
-    !    pqdyn(ngrid,nlayer,nq) /
-    !    pw(ngrid,?)           vertical velocity
-    !
-    !   output:
-    !   -------
-    !
-    !    pdu(ngrid,nlayermx)        \
-    !    pdv(ngrid,nlayermx)         \  Temporal derivative of the corresponding
-    !    pdt(ngrid,nlayermx)         /  variables due to physical processes.
-    !    pdq(ngrid,nlayermx)      /
-    !    pdpsrf(ngrid)        /
-    !
     !=======================================================================
-    !
-    !-----------------------------------------------------------------------
-    !
-    !    0.  Declarations :
-    !    ------------------
-
-#include "dimensions.h"
-    
-    !    Arguments :
-    !    -----------
-    
-    !    inputs:
-    !    -------
-    INTEGER ngrid,nlayer,nq
-    
-    REAL ptimestep
-    real zdtime
-    REAL pplev(ngrid,nlayer+1),pplay(ngrid,nlayer)
-    REAL pphi(ngrid,nlayer)
-    REAL pphis(ngrid)
-    REAL pu(ngrid,nlayer),pv(ngrid,nlayer)
-    REAL pt(ngrid,nlayer),pq(ngrid,nlayer,nq)
-    REAL pdu(ngrid,nlayer),pdv(ngrid,nlayer)
-    
-    !   dynamial tendencies
-    REAL pdtdyn(ngrid,nlayer),pdqdyn(ngrid,nlayer,nq)
-    REAL pdudyn(ngrid,nlayer),pdvdyn(ngrid,nlayer)
-    REAL pw(ngrid,nlayer)
-    
-    !   Time
-    real rjourvrai
-    REAL gmtime
-    
-    !     outputs:
-    !     --------
-    
-    !   physical tendencies
-    REAL pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq)
-    REAL pdpsrf(ngrid)
-    LOGICAL firstcall,lastcall
+
+    INTEGER, INTENT(IN) ::      &
+         ngrid,                 & ! Size of the horizontal grid.
+         nlayer,                & ! Number of vertical layers.
+         nq                       ! Number of advected fields (tracers)
+    LOGICAL, INTENT(IN) ::      &
+         firstcall,             & ! True at the first call 
+         lastcall                 ! True at the last call
+    REAL, INTENT(IN)    ::      &
+         rjourvrai,             & ! Number of days counted from the North. Spring equinox
+         gmtime,                & ! time of the day in seconds
+         ptimestep,             & ! timestep (s)
+         pplev(ngrid,nlayer+1), & ! Pressure at interfaces between layers (pa)
+         pplay(ngrid,nlayer),   & ! Pressure at the middle of the layers (Pa)
+         pphi(ngrid,nlayer),    & ! Geopotential at the middle of the layers (m2s-2)
+         pphis(ngrid),          & ! surface geopotential (unused)
+         pu(ngrid,nlayer),      & ! u component of the wind (ms-1)
+         pv(ngrid,nlayer),      & ! v component of the wind (ms-1)
+         pw(ngrid,nlayer),      & ! vertical velocity (unused)
+         pt(ngrid,nlayer),      & ! Temperature (K)
+         pq(ngrid,nlayer,nq)      ! Advected fields (unused)
+    REAL, INTENT(OUT)   ::      & ! output : physical tendencies
+         pdu(ngrid,nlayer),     &
+         pdv(ngrid,nlayer),     &
+         pdt(ngrid,nlayer),     &
+         pdq(ngrid,nlayer,nq),  &
+         pdpsrf(ngrid)
     
     !    Local variables :
-    !    -----------------
-    
-    INTEGER j,l,ig,ierr,aslun,nlevel,igout,it1,it2,isoil,iq
+    REAL, DIMENSION(ngrid) :: mu0,fract
+    INTEGER :: j,l,ig,ierr,aslun,nlevel,igout,it1,it2,isoil,iq
     INTEGER*4 day_ini
     !
-    REAL,DIMENSION(ngrid) :: mu0,fract
-    REAL zday
+    REAL :: zday, zdtime
     REAL zh(ngrid,nlayer),z1,z2
     REAL zzlev(ngrid,nlayer+1),zzlay(ngrid,nlayer)
@@ -142,5 +103,4 @@
     REAL zdtlw(ngrid,nlayer),zdtsw(ngrid,nlayer)
     REAL zfluxsw(ngrid),zfluxlw(ngrid)
-    character*2 str2
     REAL factq(nq),tauq(nq)
     character*3 nomq
@@ -149,27 +109,5 @@
     !   ----------------------
     
-    INTEGER, SAVE :: icount
-    real, SAVE :: zday_last
-    !$OMP THREADPRIVATE( icount,zday_last)
-    
     REAL zps_av
-    
-    real,allocatable,SAVE :: tsurf(:),tsoil(:,:),rnatur(:)
-    real,allocatable,SAVE :: capcal(:),fluxgrd(:)
-    real,allocatable,SAVE :: dtrad(:,:),fluxrad(:)
-    real,allocatable,SAVE ::  q2(:,:),q2l(:,:)
-    real,allocatable,SAVE ::  albedo(:),emissiv(:),z0(:),inertie(:)
-    real,SAVE :: solarcst=1370.
-    real,SAVE :: stephan=5.67e-08
-    
-    !$OMP THREADPRIVATE(tsurf,tsoil,rnatur)
-    !$OMP THREADPRIVATE( capcal,fluxgrd,dtrad,fluxrad)
-    !$OMP THREADPRIVATE( q2,q2l)
-    !$OMP THREADPRIVATE( albedo,emissiv,solarcst,z0,inertie)
-    !$OMP THREADPRIVATE( stephan)
-    
-    
-    EXTERNAL ismin,ismax
-    
     
     INTEGER        longcles
@@ -179,29 +117,4 @@
         
     print*,'OK DANS PHYPARAM'
-    
-    !-----------------------------------------------------------------------
-    !    1. Initialisations :
-    !    --------------------
-    
-    !     call initial0(ngrid*nlayermx*nqmx,pdq)
-    nlevel=nlayer+1
-    
-    !     print*,'OK ',nlevel
-    
-    igout=ngrid/2+1
-    !     print*,'OK PHYPARAM ',ngrid,igout
-    
-    
-    zday=rjourvrai+gmtime
-    
-    !     print*,'OK PHYPARAM 0A nq ',nq
-    tauq(1)=1800.
-    tauq(2)=10800.
-    tauq(3)=86400.
-    tauq(4)=864000.
-    !     print*,'OK PHYPARAM 0 B nq ',nq
-    factq(1:4)=(1.-exp(-ptimestep/tauq(1:4)))/ptimestep
-    
-    !     print*,'OK PHYPARAM 0 '
     print*,'nq ',nq
     print*,'latitude0',ngrid,lati(1:2),lati(ngrid-1:ngrid)
@@ -209,10 +122,14 @@
     print*,'size pdq ',ngrid*nlayer*4,ngrid*nlayer*nq, &
          &      size(pdq),size(lati),size(pq),size(factq)
-    do iq=1,4
-       do l=1,nlayer
-          pdq(1:ngrid,l,iq)= &
-               &      (1.+sin(lati(1:ngrid))-pq(1:ngrid,l,iq))*factq(iq)
-       enddo
-    enddo
+    
+    nlevel=nlayer+1
+    igout=ngrid/2+1    
+    zday=rjourvrai+gmtime
+
+    pdq(:,:,:) = 0. ! we do not use tracers in this physics package
+
+    !-----------------------------------------------------------------------
+    !    1. Initialisations :
+    !    --------------------
     
     IF(firstcall) THEN
@@ -235,14 +152,8 @@
        
        
-       do l=1,nlayer
-          pdq(:,l,5)=1.+sin(lati(:))/ptimestep
-       enddo
        PRINT*,'FIRSTCALL  '
        
        !         zday_last=rjourvrai
        zday_last=zday-ptimestep/unjours
-       !        CALL readfi(ngrid,nlayer,nsoilmx,ldrs,
-       !    .      day_ini,gmtime,albedo,inertie,emissiv,z0,rnatur,
-       !    .      q2,q2l,tsurf,tsoil)
        rnatur=1.
        emissiv(:)=(1.-rnatur(:))*emi_mer+rnatur(:)*emi_ter
@@ -362,10 +273,4 @@
              ztim2=COS(declin)*COS(2.*pi*(zday-.5))
              ztim3=-COS(declin)*SIN(2.*pi*(zday-.5))
-             !           call dump2d(iim,jjm-1,lati(2),'LATI  0   ')
-             !           call dump2d(iim,jjm-1,long(2),'LONG  0   ')
-             !           call dump2d(iim,jjm-1,sinlon(2),'sinlon0   ')
-             !           call dump2d(iim,jjm-1,coslon(2),'coslon0   ')
-             !           call dump2d(iim,jjm-1,sinlat(2),'sinlat   ')
-             !           call dump2d(iim,jjm-1,coslat(2),'coslat   ')
              CALL solang(ngrid,sinlon,coslon,sinlat,coslat, &
              &         ztim1,ztim2,ztim3,                   &
@@ -385,11 +290,6 @@
        ELSE
           print*,'declin,ngrid,rad',declin,ngrid,rad
-          
-          !           call dump2d(iim,jjm-1,lati(2),'LATI      ')
           CALL mucorr(ngrid,declin,lati,mu0,fract,10000.,rad)
        ENDIF
-       !           call dump2d(iim,jjm-1,fract(2),'FRACT A   ')
-       !           call dump2d(iim,jjm-1,mu0(2),'MU0 A     ')
-       
        
        !    2.2 Calcul of the radiative tendencies and fluxes:
@@ -399,10 +299,4 @@
        
        zinsol=solarcst/(dist_sol*dist_sol)
-       print*,iim,jjm,llm,ngrid,nlayer,ngridmax,nlayer
-       print*,'iim,jjm,llm,ngrid,nlayer,ngridmax,nlayer'
-       !           call dump2d(iim,jjm-1,albedo(2),'ALBEDO    ')
-       !           call dump2d(iim,jjm-1,mu0(2),'MU0       ')
-       !           call dump2d(iim,jjm-1,fract(2),'FRACT     ')
-       !           call dump2d(iim,jjm-1,lati(2),'LATI      ')
        zps_av=1.e5
        if (firstcall) then
@@ -414,6 +308,4 @@
        &              zfluxsw,zdtsw,                &
        &              lverbose)
-       !           call dump2d(iim,jjm-1,zfluxsw(2),'SWS 1     ')
-       !           stop
        
        CALL lw(ngrid,nlayer,coefir,emissiv, &
@@ -579,5 +471,4 @@
     !   --------
     
-    !           call dump2d(iim,jjm-1,zfluxsw(2),'SWS 2     ')
     print*,'zday, zday_last ',zday,zday_last,icount
     if(abs(zday-zday_last-period_sort)<=ptimestep/unjours/10.) then
@@ -590,20 +481,20 @@
        enddo
        
-       call iophys_ecrit('u',llm,'Vent zonal moy','m/s',pu)
-       call iophys_ecrit('v',llm,'Vent meridien moy','m/s',pv)
-       call iophys_ecrit('temp',llm,'Temperature','K',pt)
-       call iophys_ecrit('geop',llm,'Geopotential','m2/s2',pphi)
-       call iophys_ecrit('plev',llm,'plev','Pa',pplev(:,1:nlayer))
-       
-       call iophys_ecrit('du',llm,'du',' ',pdu)
-       call iophys_ecrit('dv',llm,'du',' ',pdv)
-       call iophys_ecrit('dt',llm,'du',' ',pdt)
-       call iophys_ecrit('dtsw',llm,'dtsw',' ',zdtsw)
-       call iophys_ecrit('dtlw',llm,'dtlw',' ',zdtlw)
+       call iophys_ecrit('u',nlayer,'Vent zonal moy','m/s',pu)
+       call iophys_ecrit('v',nlayer,'Vent meridien moy','m/s',pv)
+       call iophys_ecrit('temp',nlayer,'Temperature','K',pt)
+       call iophys_ecrit('geop',nlayer,'Geopotential','m2/s2',pphi)
+       call iophys_ecrit('plev',nlayer,'plev','Pa',pplev(:,1:nlayer))
+       
+       call iophys_ecrit('du',nlayer,'du',' ',pdu)
+       call iophys_ecrit('dv',nlayer,'du',' ',pdv)
+       call iophys_ecrit('dt',nlayer,'du',' ',pdt)
+       call iophys_ecrit('dtsw',nlayer,'dtsw',' ',zdtsw)
+       call iophys_ecrit('dtlw',nlayer,'dtlw',' ',zdtlw)
        
        do iq=1,nq
           nomq="tr."
           write(nomq(2:3),'(i1.1)') iq
-          call iophys_ecrit(nomq,llm,nomq,' ',pq(:,:,iq))
+          call iophys_ecrit(nomq,nlayer,nomq,' ',pq(:,:,iq))
        enddo
        
@@ -627,22 +518,11 @@
        call iotd_fin
        PRINT*,'Ecriture du fichier de reinitialiastion de la physique'
-       !        if (ierr.ne.0) then
-       !          write(6,*)' Pb d''ouverture du fichier restart'
-       !          write(6,*)' ierr = ', ierr
-       !          call exit(1)
-       !        endif
        write(75)  tsurf,tsoil
-       !    s             (tsurf(1),ig=1,iim+1),
-       !    s             ( (tsurf(ig),ig=(j-2)*iim+2,(j-1)*iim+1),
-       !    s              tsurf((j-2)*iim+2) ,j=2,jjm),
-       !    s              (tsurf(ngridmax),ig=1,iim+1),
-       !    s         (   (tsoil(1,l),ig=1,iim+1),
-       !    s             ( (tsoil(ig,l),ig=(j-2)*iim+2,(j-1)*iim+1),
-       !    s              tsoil((j-2)*iim+2,l) ,ig=2,jjm),
-       !    s              (tsoil(ngridmax,l),ig=1,iim+1)
-       !    s          ,l=1,nsoilmx)
     ENDIF    
     
   END SUBROUTINE phyparam
 
+
+  SUBROUTINE alloc_phyparam
+  END SUBROUTINE alloc_phyparam
 END MODULE phyparam_mod
Index: dynamico_lmdz/simple_physics/phyparam/param/physiq_mod.F90
===================================================================
--- dynamico_lmdz/simple_physics/phyparam/param/physiq_mod.F90	(revision 4212)
+++ 	(revision )
@@ -1,211 +1,0 @@
-! $Id: physiq.F 1565 2011-08-31 12:53:29Z jghattas $
-MODULE physiq_mod
-  USE dimphy, only : klon,klev
-
-  IMPLICIT NONE
-  PRIVATE
-  SAVE
-
-  REAL, PARAMETER :: oneday = 86400. ! hard-coded 
-
-  INTEGER :: itau=0 ! counter to count number of calls to physics
-!$OMP THREADPRIVATE(itau)
-  INTEGER :: nid_hist ! NetCDF ID of output file
-!$OMP THREADPRIVATE(nid_hist)
-
-  INTEGER :: iwrite_phys ! output every iwrite_phys physics step
-
-  PUBLIC :: physiq
-
-CONTAINS
-
-  SUBROUTINE physiq (nlon,nlev, &
-       &            debut,lafin,pdtphys, &
-       &            paprs,pplay,pphi,pphis,presnivs, &
-       &            u,v,t,qx, &
-       &            flxmass_w, &
-       &            d_u, d_v, d_t, d_qx, d_ps)
-    
-    USE infotrac_phy, only : nqtot
-    USE phyparam_mod, ONLY : phyparam
-    !
-    ! Routine argument:
-    !
-    integer,intent(in) :: nlon ! number of atmospheric colums
-    integer,intent(in) :: nlev ! number of vertical levels (should be =klev)
-    logical,intent(in) :: debut ! signals first call to physics
-    logical,intent(in) :: lafin ! signals last call to physics
-    real,intent(in) :: pdtphys ! physics time step (s)
-    real,intent(in) :: paprs(klon,klev+1) ! interlayer pressure (Pa)
-    real,intent(in) :: pplay(klon,klev) ! mid-layer pressure (Pa)
-    real,intent(in) :: pphi(klon,klev) ! geopotential at mid-layer
-    real,intent(in) :: pphis(klon) ! surface geopotential
-    real,intent(in) :: presnivs(klev) ! pseudo-pressure (Pa) of mid-layers
-    real,intent(in) :: u(klon,klev) ! eastward zonal wind (m/s)
-    real,intent(in) :: v(klon,klev) ! northward meridional wind (m/s)
-    real,intent(in) :: t(klon,klev) ! temperature (K)
-    real,intent(in) :: qx(klon,klev,nqtot) ! tracers (.../kg_air)
-    real,intent(in) :: flxmass_w(klon,klev) ! vertical mass flux
-    real,intent(out) :: d_u(klon,klev) ! physics tendency on u (m/s/s)
-    real,intent(out) :: d_v(klon,klev) ! physics tendency on v (m/s/s)
-    real,intent(out) :: d_t(klon,klev) ! physics tendency on t (K/s)
-    real,intent(out) :: d_qx(klon,klev,nqtot) ! physics tendency on tracers
-    real,intent(out) :: d_ps(klon) ! physics tendency on surface pressure
-    
-    logical, save :: first=.true.
-    !$OMP THREADPRIVATE(first)
-    
-    ! For I/Os
-    REAL,SAVE :: rjourvrai=0.
-    REAL,SAVE :: gmtime=0.
-    !$OMP THREADPRIVATE(rjourvrai,gmtime)
-        
-    ! initializations
-    if (debut) CALL init_physiq_mod(pdtphys, presnivs) ! Things to do only for the first call to physics 
-    
-    ! increment local time counter itau
-    itau=itau+1
-    gmtime=gmtime+pdtphys/oneday
-    IF (gmtime>=1.) THEN
-       gmtime=gmtime-1.
-       rjourvrai=rjourvrai+1.
-    ENDIF
-    
-    CALL phyparam(klon,klev,nqtot, &
-         debut,lafin, &
-         rjourvrai,gmtime,pdtphys, &
-         paprs,pplay,pphi,pphis,presnivs, &
-         u,v,t,qx, &
-         flxmass_w, &
-         d_u,d_v,d_t,d_qx,d_ps) 
-    
-    print*,'PHYDEV: itau=',itau
-
-    CALL write_hist(paprs, t, u, v)      ! write some outputs
-
-    ! if lastcall, then it is time to write "restartphy.nc" file
-    IF (lafin) CALL phyredem("restartphy.nc")
-    
-  END SUBROUTINE physiq
-
-  SUBROUTINE init_physiq_mod(dtime, presnivs)
-    USE iophy, only : histbeg_phy
-    USE phys_state_var_mod, only : phys_state_var_init
-    USE ioipsl, only : getin,histvert,histdef,histend,ymds2ju
-    USE mod_phys_lmdz_para, only : jj_nb
-    USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat
-    REAL, INTENT(IN) :: dtime
-    REAL, INTENT(IN) :: presnivs(klev) ! pseudo-pressure (Pa) of mid-layers
-
-    ! For I/Os
-    INTEGER, PARAMETER :: itau0=0, annee0=1979, month=1, dayref=1
-    REAL, PARAMETER :: hour=0.0
-    INTEGER :: nid_hori    ! NetCDF ID of horizontal coordinate
-    INTEGER :: nid_vert ! NetCDF ID of vertical coordinate
-    REAL :: t_ops ! frequency of the IOIPSL operations (eg average over...)
-    REAL :: t_wrt ! frequency of the IOIPSL outputs
-    REAL :: zjulian
-
-    ! load initial conditions for physics (including the grid)
-    call phys_state_var_init() ! some initializations, required before calling phyetat0
-    call phyetat0("startphy.nc")
-    
-    ! Initialize outputs:
-
-    ! NB: getin() is not threadsafe; only one thread should call it.
-    !$OMP MASTER
-    iwrite_phys=1 !default: output every physics timestep
-    call getin("iwrite_phys",iwrite_phys)
-    !$OMP END MASTER
-    !$OMP BARRIER
-
-    t_ops=dtime*iwrite_phys ! frequency of the IOIPSL operation
-    t_wrt=dtime*iwrite_phys ! frequency of the outputs in the file
-
-    ! compute zjulian for annee0=1979 and month=1 dayref=1 and hour=0.0
-    CALL ymds2ju(annee0, month, dayref, hour, zjulian)
-#ifndef CPP_IOIPSL_NO_OUTPUT
-    ! Initialize IOIPSL output file
-    call histbeg_phy("histins.nc",itau0,zjulian,dtime,nid_hori,nid_hist)
-#endif
-    
-    !$OMP MASTER
-    
-#ifndef CPP_IOIPSL_NO_OUTPUT 
-    ! IOIPSL
-    ! define vertical coordinate
-    call histvert(nid_hist,"presnivs","Vertical levels","Pa",klev, &
-         presnivs,nid_vert,'down')
-    ! define variables which will be written in "histins.nc" file
-    call histdef(nid_hist,'temperature','Atmospheric temperature','K', &
-         nbp_lon,jj_nb,nid_hori,klev,1,klev,nid_vert,32, &
-         'inst(X)',t_ops,t_wrt)
-    call histdef(nid_hist,'u','Eastward Zonal Wind','m/s', &
-         nbp_lon,jj_nb,nid_hori,klev,1,klev,nid_vert,32, &
-         'inst(X)',t_ops,t_wrt)
-    call histdef(nid_hist,'v','Northward Meridional Wind','m/s', &
-         nbp_lon,jj_nb,nid_hori,klev,1,klev,nid_vert,32, &
-         'inst(X)',t_ops,t_wrt)
-    call histdef(nid_hist,'ps','Surface Pressure','Pa', &
-         nbp_lon,jj_nb,nid_hori,1,1,1,nid_vert,32, &
-         'inst(X)',t_ops,t_wrt)
-    ! end definition sequence
-    call histend(nid_hist)
-#endif
-    
-#ifdef CPP_XIOS
-    !XIOS
-    ! Declare available vertical axes to be used in output files:    
-    CALL wxios_add_vaxis("presnivs", klev, presnivs)
-    
-    ! Declare calendar and time step
-    CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0)
-    
-    !Finalize the context:
-    CALL wxios_closedef()
-#endif
-    !$OMP END MASTER
-    !$OMP BARRIER
-  END SUBROUTINE init_physiq_mod
-  
-  SUBROUTINE write_hist(paprs, t, u, v)
-    USE iophy, only : histwrite_phy
-#ifdef CPP_XIOS
-    USE xios, ONLY: xios_update_calendar
-    USE wxios, only: wxios_add_vaxis, wxios_set_cal, wxios_closedef
-    USE iophy, ONLY: histwrite_phy
-#endif
-    REAL, INTENT(IN) :: paprs(klon,klev+1), & ! interlayer pressure (Pa)
-         &              t(klon,klev),       & ! temperature (K)
-         &              u(klon,klev),       & ! eastward zonal wind (m/s)
-         &              v(klon,klev)          ! northward meridional wind (m/s)
-    ! output using IOIPSL
-#ifndef CPP_IOIPSL_NO_OUTPUT 
-    if (modulo(itau,iwrite_phys)==0) then
-       call histwrite_phy(nid_hist,.false.,"temperature",itau,t)
-       call histwrite_phy(nid_hist,.false.,"u",itau,u)
-       call histwrite_phy(nid_hist,.false.,"v",itau,v)
-       call histwrite_phy(nid_hist,.false.,"ps",itau,paprs(:,1))
-    endif
-#endif
-    
-    ! output using XIOS
-#ifdef CPP_XIOS
-    !$OMP MASTER
-    !Increment XIOS time
-    CALL xios_update_calendar(itau)
-    !$OMP END MASTER
-    !$OMP BARRIER
-    
-    !Send fields to XIOS: (NB these fields must also be defined as
-    ! <field id="..." /> in iodef.xml to be correctly used
-    CALL histwrite_phy("temperature",t)
-    CALL histwrite_phy("temp_newton",temp_newton)
-    CALL histwrite_phy("u",u)
-    CALL histwrite_phy("v",v)
-    CALL histwrite_phy("ps",paprs(:,1))
-#endif
-    
-  END SUBROUTINE write_hist
-  
-END MODULE physiq_mod
