Index: LMDZ5/trunk/libf/phylmd/YOEMETH.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/YOEMETH.F90	(revision 2136)
+++ LMDZ5/trunk/libf/phylmd/YOEMETH.F90	(revision 2136)
@@ -0,0 +1,46 @@
+MODULE YOEMETH
+
+IMPLICIT NONE
+
+SAVE
+
+!     -----------------------------------------------------------------
+!     ** YOEMETH - CONTROL PARAMETERS FOR METHANE OXIDATION
+!     -----------------------------------------------------------------
+
+!     * E.C.M.W.F. PHYSICS PACKAGE *
+
+!     C. JAKOB        E.C.M.W.F.          98/04/07
+!     D. Cugnet       Adapted for LMDZ    12/02/24
+
+!      NAME     TYPE      PURPOSE
+!      ----     ----      -------
+
+!     *RALPHA1* REAL      CONSTANT IN TIME SCALE 1 CALCULATIONS
+!     *RALPHA2* REAL      CONSTANT IN TIME SCALE 2 CALCULATIONS
+!     *RQLIM*   REAL      UPPERLIMIT OD SPECIFIC HUMIDITY FOR 
+!                         METHANE OXIDATION TO BE ACTIVE
+!     *RPBOTOX* REAL      PRESSURE BELOW WHICH METHANE OXIDATION
+!                         IS CONSIDERED ACTIVE
+!     *RPBOTPH* REAL      PRESSURE BELOW WHICH H2O PHOTOLYSIS
+!                         IS CONSIDERED ACTIVE
+!     *RPTOPOX* REAL      PRESSURE BELOW WHICH SHORTEST TIME SCALE
+!                         IS USED IN METHANE OXIDATION
+!     *RPTOPPH* REAL      PRESSURE BELOW WHICH SHORTEST TIME SCALE
+!                         IS USED IN H2O PHOTOLYISIS
+!     *RALPHA3* REAL      CONSTANT IN TIME SCALE 2 CALCULATIONS
+!     *RLOGPPH* REAL      CONSTANT IN TIME SCALE 2 CALCULATIONS
+
+REAL :: RALPHA1
+REAL :: RALPHA2
+REAL :: RQLIM
+REAL :: RPBOTOX
+REAL :: RPBOTPH
+REAL :: RPTOPOX
+REAL :: RPTOPPH
+REAL :: RALPHA3
+REAL :: RLOGPPH
+
+END MODULE YOEMETH
+
+
Index: LMDZ5/trunk/libf/phylmd/clesphys.h
===================================================================
--- LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 2136)
@@ -77,4 +77,5 @@
        LOGICAL :: ok_strato
        LOGICAL :: ok_hines, ok_gwd_rando
+       LOGICAL :: ok_qch4
        LOGICAL :: ok_conserv_q
 
@@ -114,5 +115,5 @@
      &     , ip_ebil_phy                                                &
      &     , ok_lic_melt,           aer_type                            &
-     &     , iflag_rrtm, ok_strato,ok_hines                             &
+     &     , iflag_rrtm, ok_strato,ok_hines, ok_qch4                    &
      &     , iflag_ice_thermo, ok_gwd_rando, NSW                        &
      &     , ok_conserv_q, ok_all_xml
Index: LMDZ5/trunk/libf/phylmd/conf_phys_m.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/conf_phys_m.F90	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/conf_phys_m.F90	(revision 2136)
@@ -189,4 +189,5 @@
     LOGICAL,SAVE :: ok_hines_omp, ok_gwd_rando_omp
     real, SAVE:: GWD_RANDO_RUWMAX_omp, gwd_rando_sat_omp
+    LOGICAL,SAVE :: ok_qch4_omp
     LOGICAL,SAVE      :: carbon_cycle_tr_omp
     LOGICAL,SAVE      :: carbon_cycle_cpl_omp
@@ -1725,4 +1726,13 @@
     gwd_rando_sat_omp = 0.25
     CALL getin('gwd_rando_sat', gwd_rando_sat_omp)
+
+    !Config  key = ok_qch4
+    !Config  Desc = activation de la parametrisation du methane
+    !Config  Def  = .FALSE.
+    !Config  Help = Clef controlant l'activation de la parametrisation
+    !               de l'humidite due a oxydation+photolyse du methane strato
+
+    ok_qch4_omp=.FALSE.
+    CALL getin('ok_qch4',ok_qch4_omp)
 
     !Config Key  = OK_LES                                               
@@ -1955,4 +1965,5 @@
     GWD_RANDO_RUWMAX = GWD_RANDO_RUWMAX_omp
     gwd_rando_sat = gwd_rando_sat_omp
+    ok_qch4 = ok_qch4_omp
     ok_LES = ok_LES_omp
     callstats = callstats_omp
@@ -2147,4 +2158,5 @@
     write(lunout,*) 'ok_hines = ',  ok_hines
     write(lunout,*) 'ok_gwd_rando = ',  ok_gwd_rando
+    write(lunout,*) 'ok_qch4 = ',  ok_qch4
     write(lunout,*) 'GWD_RANDO_RUWMAX = ', GWD_RANDO_RUWMAX
     write(lunout,*) 'gwd_rando_sat = ', gwd_rando_sat
Index: LMDZ5/trunk/libf/phylmd/methox.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/methox.F90	(revision 2136)
+++ LMDZ5/trunk/libf/phylmd/methox.F90	(revision 2136)
@@ -0,0 +1,118 @@
+SUBROUTINE METHOX(KIDIA,  KFDIA,  KLON,  KLEV,PQ,     PTENQ,  PAP )
+
+!**** *METHOX*   - Calculate humidity tendencies from methane
+!                  oxidation and photolysis
+
+!**   INTERFACE.
+!     ----------
+!        CALL *METHOX* FROM *CALLPAR*
+!              ------        -------
+
+!        EXPLICIT ARGUMENTS :
+!        --------------------
+!     PARAMETER     DESCRIPTION                                   UNITS
+!     ---------     -----------                                   -----
+!     INPUT PARAMETERS (INTEGER):
+
+!    *KIDIA*        START POINT
+!    *KFDIA*        END POINT
+!    *KLON*         NUMBER OF GRID POINTS PER PACKET
+!    *KLEV*         NUMBER OF LEVELS
+
+!     INPUT PARAMETERS (REAL):
+
+!    *PAP*          PRESSURE                                      PA
+!    *PQ*           SPECIFIC HUMIDITY                             KG/KG
+
+!     UPDATED PARAMETERS (REAL):
+
+!    *PTENQ*        TENDENCY OF SPECIFIC HUMIDITY                 KG/(KG*S)
+
+!        NONE
+
+!        IMPLICIT ARGUMENTS :
+!        --------------------
+!        MODULE YOEMETH
+!        MODULE YOMCST
+
+!     METHOD.
+!     -------
+!        SEE RD-MEMO R60.1/AJS/31
+
+!     EXTERNALS.
+!     ----------
+!        NONE
+
+!     REFERENCE.
+!     ----------
+!        SEE RD-MEMO R60.1/AJS/31
+
+!     AUTHOR.
+!     -------
+!        C.JAKOB   *ECMWF*
+
+!     MODIFICATIONS.
+!     --------------
+!        ORIGINAL : 98-04-07
+!        M.Hamrud      01-Oct-2003 CY28 Cleaning
+!        D. Cugnet     24-Feb-2012 Adapted for LMDZ
+!     ------------------------------------------------------------------
+
+USE YOEMETH   , ONLY : RALPHA1 ,RALPHA2  ,RQLIM   ,&
+ & RPBOTOX,  RPBOTPH ,RPTOPOX  ,RPTOPPH ,&
+ & RALPHA3,  RLOGPPH  
+
+IMPLICIT NONE
+
+#include "YOMCST.h"
+
+INTEGER,INTENT(IN)    :: KLON 
+INTEGER,INTENT(IN)    :: KLEV 
+INTEGER,INTENT(IN)    :: KIDIA 
+INTEGER,INTENT(IN)    :: KFDIA 
+REAL   ,INTENT(IN)    :: PQ(KLON,KLEV) 
+REAL   ,INTENT(INOUT) :: PTENQ(KLON,KLEV) 
+REAL   ,INTENT(IN)    :: PAP(KLON,KLEV) 
+LOGICAL :: LLOXID,         LLPHOTO
+
+INTEGER :: JK, JL
+
+REAL :: ZARG, ZPRATIO, ZTAU1, ZTAU2, ZTDAYS
+
+DO JK=1,KLEV
+  DO JL=KIDIA,KFDIA
+
+    LLOXID=PAP(JL,JK) < RPBOTOX.AND.PQ(JL,JK) < RQLIM
+    LLPHOTO=PAP(JL,JK) < RPBOTPH
+
+!     METHANE OXIDATION
+
+    IF(LLOXID) THEN
+      IF(PAP(JL,JK) <= RPTOPOX) THEN
+        ZTDAYS=100.
+      ELSE
+        ZPRATIO=(LOG(PAP(JL,JK)/RPTOPOX))**4./LOG(RPBOTOX/PAP(JL,JK))
+        ZTDAYS=100.*(1+RALPHA1*ZPRATIO)
+      ENDIF
+      ZTAU1=86400.*ZTDAYS
+      PTENQ(JL,JK)=PTENQ(JL,JK)+(RQLIM-PQ(JL,JK))/ZTAU1
+    ENDIF
+
+!     PHOTOLYSIS
+
+    IF(LLPHOTO) THEN
+      IF(PAP(JL,JK) <= RPTOPPH) THEN
+        ZTDAYS=3.
+      ELSE
+        ZARG=RALPHA2-RALPHA3*(1+COS((RPI*LOG(PAP(JL,JK)/RPBOTPH))/RLOGPPH))
+        ZTDAYS=1.0/(EXP(ZARG)-0.01)
+      ENDIF
+      ZTAU2=86400.*ZTDAYS
+      PTENQ(JL,JK)=PTENQ(JL,JK)-PQ(JL,JK)/ZTAU2
+    ENDIF
+  ENDDO
+ENDDO
+
+END SUBROUTINE METHOX
+
+
Index: LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90	(revision 2136)
@@ -73,4 +73,7 @@
       REAL, SAVE, ALLOCATABLE :: d_t_hin(:,:)
       !$OMP THREADPRIVATE(d_t_hin)
+! tendance due a l'oxydation du methane
+      REAL, SAVE, ALLOCATABLE :: d_q_ch4(:,:)
+      !$OMP THREADPRIVATE(d_q_ch4)
 
 ! tendance du a la conersion Ec -> E thermique
@@ -338,4 +341,5 @@
       allocate(topswcf_aero(klon,3), solswcf_aero(klon,3))
       allocate(d_u_hin(klon,klev),d_v_hin(klon,klev),d_t_hin(klon,klev))
+      allocate(d_q_ch4(klon,klev))
 !      allocate(tausum_aero(klon,nwave,naero_spc))
 !      allocate(tau3d_aero(klon,klev,nwave,naero_spc)) 
@@ -535,4 +539,5 @@
       deallocate(load_tmp7)
       deallocate(d_u_hin,d_v_hin,d_t_hin)
+      deallocate(d_q_ch4)
 
 !IM ajout variables CFMIP2/CMIP5
@@ -603,3 +608,3 @@
 END SUBROUTINE phys_local_var_end
 
-END MODULE phys_local_var_mod
+END MODULE phys_local_var_mod 
Index: LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/phys_output_ctrlout_mod.F90	(revision 2136)
@@ -1100,4 +1100,6 @@
   TYPE(ctrl_out), SAVE :: o_dthin = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     'dthin', 'Hines GWD dT', 'K/s', (/ ('', i=1, 9) /))
+  TYPE(ctrl_out), SAVE :: o_dqch4 = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
+    'dqch4', 'H2O due to CH4 oxidation & photolysis', '(kg/kg)/s', (/ ('', i=1, 9) /))
 
   type(ctrl_out), save:: o_du_gwd_rando &
Index: LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90	(revision 2136)
@@ -130,5 +130,5 @@
          o_duvdf, o_dvvdf, o_duoro, o_dvoro, &
          o_dtoro, o_dulif, o_dvlif, o_dtlif, &
-         o_duhin, o_dvhin, o_dthin, o_rsu, &
+         o_duhin, o_dvhin, o_dthin, o_dqch4, o_rsu, &
          o_rsd, o_rlu, o_rld, o_rsucs, o_rsdcs, &
          o_rlucs, o_rldcs, o_tnt, o_tntr, &
@@ -217,5 +217,5 @@
          d_v_vdf, d_u_oro, d_v_oro, d_t_oro, d_u_lif, &
          d_v_lif, d_t_lif, d_u_hin, d_v_hin, d_t_hin, &
-         pmfd, pmfu, ref_liq, ref_ice, rhwriteSTD
+         d_q_ch4, pmfd, pmfu, ref_liq, ref_ice, rhwriteSTD
 
     USE phys_output_var_mod, only: vars_defined, snow_o, zfra_o, bils_diss, &
@@ -1153,4 +1153,8 @@
        end IF
 
+       IF (ok_qch4) then
+          CALL histwrite_phy(o_dqch4, d_q_ch4 / pdtphys)
+       ENDIF
+
        CALL histwrite_phy(o_rsu, swup)
        CALL histwrite_phy(o_rsd, swdn)
Index: LMDZ5/trunk/libf/phylmd/physiq.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/physiq.F90	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/physiq.F90	(revision 2136)
@@ -3495,4 +3495,11 @@
           , fs_bound, fq_bound )
   END IF
+
+  !DC Calcul de la tendance due au methane
+  IF(ok_qch4) THEN
+     CALL METHOX(1,klon,klon,klev,q_seri,d_q_ch4,pplay)
+  ! ajout de la tendance d'humidite due au methane
+     CALL add_phys_tend(du0,dv0,dt0,d_q_ch4*dtime,dql0,'q_ch4')
+  END IF
   !
   !
Index: LMDZ5/trunk/libf/phylmd/sumethox.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/sumethox.F90	(revision 2136)
+++ LMDZ5/trunk/libf/phylmd/sumethox.F90	(revision 2136)
@@ -0,0 +1,69 @@
+SUBROUTINE SUMETHOX
+
+!**** *SUCLDP*   - INITIALIZE MODULE YOEMETH CONTROLLING *METHOX*
+
+!     PURPOSE.
+!     --------
+!           INITIALIZE YOEMETH
+
+!**   INTERFACE.
+!     ----------
+!        CALL *SUMETHOX* FROM *SUPHEC*
+!              --------        ------
+
+!        EXPLICIT ARGUMENTS :
+!        --------------------
+!        NONE
+
+!        IMPLICIT ARGUMENTS :
+!        --------------------
+!        MODULE YOEMETH
+
+!     METHOD.
+!     -------
+!        SEE DOCUMENTATION
+
+!     EXTERNALS.
+!     ----------
+!        NONE
+
+!     REFERENCE.
+!     ----------
+!        ECMWF RESEARCH DEPARTMENT DOCUMENTATION OF THE
+!     "INTEGRATED FORECASTING SYSTEM"
+
+!     AUTHOR.
+!     -------
+!        C.JAKOB   *ECMWF*
+
+!     MODIFICATIONS.
+!     --------------
+!        ORIGINAL : 98-04-07
+!        Modified : 02-01-29  A.Simmons: increase RQLIM from 3.75e-6
+!        M.Hamrud      01-Oct-2003 CY28 Cleaning
+!        D. Cugnet     24-Feb-2012 Adapted for LMDZ
+!     ------------------------------------------------------------------
+
+USE YOEMETH   , ONLY : RALPHA1 ,RALPHA2  ,RQLIM   ,&
+ & RPBOTOX,  RPBOTPH ,RPTOPOX  ,RPTOPPH ,&
+ & RALPHA3,  RLOGPPH  
+
+!*       1.    SET VALUES
+!              ----------
+
+IMPLICIT NONE
+RALPHA1=(19.*LOG(10.))/(LOG(20.)**4)
+RALPHA2=LOG(1.0/3.+0.01)
+RQLIM=4.25E-6
+RPBOTOX=10000.
+RPBOTPH=20.
+RPTOPOX=50.
+RPTOPPH=0.1
+RALPHA3=0.5*(LOG(100.)+RALPHA2)
+RLOGPPH=LOG(RPTOPPH/RPBOTPH)
+
+!     -----------------------------------------------------------------
+
+END SUBROUTINE SUMETHOX
+
+
Index: LMDZ5/trunk/libf/phylmd/suphel.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/suphel.F90	(revision 2128)
+++ LMDZ5/trunk/libf/phylmd/suphel.F90	(revision 2136)
@@ -192,5 +192,6 @@
   ! ------------------------------------------------------------------
 
-  ! calculer les constantes pour les fonctions thermodynamiques
+  ! *       10.   CONSTANTS FOR THERMODYNAMICAL FUNCTIONS.
+  ! ----------------------------------------
 
   rvtmp2 = rcpv/rcpd - 1.
@@ -204,4 +205,11 @@
   r5ies = r3ies*(rtt-r4ies)
 
+  ! ------------------------------------------------------------------
+
+  ! *       10.   CONSTANTS FOR METHANE OXIDATION AND PHOTOLYSIS.
+  ! -----------------------------------------------
+
+  CALL SUMETHOX()
+
   RETURN
 END SUBROUTINE suphel
