GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/methox.F90 Lines: 0 18 0.0 %
Date: 2023-06-30 12:51:15 Branches: 0 16 0.0 %

Line Branch Exec Source
1
SUBROUTINE METHOX(KIDIA,  KFDIA,  KLON,  KLEV,PQ,     PTENQ,  PAP )
2
3
!**** *METHOX*   - Calculate humidity tendencies from methane
4
!                  oxidation and photolysis
5
6
!**   INTERFACE.
7
!     ----------
8
!        CALL *METHOX* FROM *CALLPAR*
9
!              ------        -------
10
11
!        EXPLICIT ARGUMENTS :
12
!        --------------------
13
!     PARAMETER     DESCRIPTION                                   UNITS
14
!     ---------     -----------                                   -----
15
!     INPUT PARAMETERS (INTEGER):
16
17
!    *KIDIA*        START POINT
18
!    *KFDIA*        END POINT
19
!    *KLON*         NUMBER OF GRID POINTS PER PACKET
20
!    *KLEV*         NUMBER OF LEVELS
21
22
!     INPUT PARAMETERS (REAL):
23
24
!    *PAP*          PRESSURE                                      PA
25
!    *PQ*           SPECIFIC HUMIDITY                             KG/KG
26
27
!     UPDATED PARAMETERS (REAL):
28
29
!    *PTENQ*        TENDENCY OF SPECIFIC HUMIDITY                 KG/(KG*S)
30
31
!        NONE
32
33
!        IMPLICIT ARGUMENTS :
34
!        --------------------
35
!        MODULE YOEMETH
36
!        MODULE YOMCST
37
38
!     METHOD.
39
!     -------
40
!        SEE RD-MEMO R60.1/AJS/31
41
42
!     EXTERNALS.
43
!     ----------
44
!        NONE
45
46
!     REFERENCE.
47
!     ----------
48
!        SEE RD-MEMO R60.1/AJS/31
49
50
!     AUTHOR.
51
!     -------
52
!        C.JAKOB   *ECMWF*
53
54
!     MODIFICATIONS.
55
!     --------------
56
!        ORIGINAL : 98-04-07
57
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
58
!        D. Cugnet     24-Feb-2012 Adapted for LMDZ
59
!     ------------------------------------------------------------------
60
61
USE YOEMETH   , ONLY : RALPHA1 ,RALPHA2  ,RQLIM   ,&
62
 & RPBOTOX,  RPBOTPH ,RPTOPOX  ,RPTOPPH ,&
63
 & RALPHA3,  RLOGPPH
64
65
IMPLICIT NONE
66
67
INCLUDE "YOMCST.h"
68
69
INTEGER,INTENT(IN)    :: KLON
70
INTEGER,INTENT(IN)    :: KLEV
71
INTEGER,INTENT(IN)    :: KIDIA
72
INTEGER,INTENT(IN)    :: KFDIA
73
REAL   ,INTENT(IN)    :: PQ(KLON,KLEV)
74
REAL   ,INTENT(INOUT) :: PTENQ(KLON,KLEV)
75
REAL   ,INTENT(IN)    :: PAP(KLON,KLEV)
76
LOGICAL :: LLOXID,         LLPHOTO
77
78
INTEGER :: JK, JL
79
80
REAL :: ZARG, ZPRATIO, ZTAU1, ZTAU2, ZTDAYS
81
82
DO JK=1,KLEV
83
  DO JL=KIDIA,KFDIA
84
85
    LLOXID=PAP(JL,JK) < RPBOTOX.AND.PQ(JL,JK) < RQLIM
86
    LLPHOTO=PAP(JL,JK) < RPBOTPH
87
88
!     METHANE OXIDATION
89
90
    IF(LLOXID) THEN
91
      IF(PAP(JL,JK) <= RPTOPOX) THEN
92
        ZTDAYS=100.
93
      ELSE
94
        ZPRATIO=(LOG(PAP(JL,JK)/RPTOPOX))**4./LOG(RPBOTOX/PAP(JL,JK))
95
        ZTDAYS=100.*(1+RALPHA1*ZPRATIO)
96
      ENDIF
97
      ZTAU1=86400.*ZTDAYS
98
      PTENQ(JL,JK)=PTENQ(JL,JK)+(RQLIM-PQ(JL,JK))/ZTAU1
99
    ENDIF
100
101
!     PHOTOLYSIS
102
103
    IF(LLPHOTO) THEN
104
      IF(PAP(JL,JK) <= RPTOPPH) THEN
105
        ZTDAYS=3.
106
      ELSE
107
        ZARG=RALPHA2-RALPHA3*(1+COS((RPI*LOG(PAP(JL,JK)/RPBOTPH))/RLOGPPH))
108
        ZTDAYS=1.0/(EXP(ZARG)-0.01)
109
      ENDIF
110
      ZTAU2=86400.*ZTDAYS
111
      PTENQ(JL,JK)=PTENQ(JL,JK)-PQ(JL,JK)/ZTAU2
112
    ENDIF
113
  ENDDO
114
ENDDO
115
116
END SUBROUTINE METHOX
117
118