[5186] | 1 | MODULE lmdz_addfi |
---|
| 2 | IMPLICIT NONE; PRIVATE |
---|
| 3 | PUBLIC addfi |
---|
[5099] | 4 | |
---|
[5186] | 5 | CONTAINS |
---|
[1146] | 6 | |
---|
[5186] | 7 | SUBROUTINE addfi(pdt, leapf, forward, pucov, pvcov, pteta, pq, pps, pdufi, pdvfi, pdhfi, pdqfi, pdpfi) |
---|
[5159] | 8 | |
---|
[5186] | 9 | USE lmdz_infotrac, ONLY: nqtot |
---|
| 10 | USE control_mod, ONLY: planet_type |
---|
| 11 | USE lmdz_ssum_scopy, ONLY: ssum |
---|
| 12 | USE lmdz_comgeom |
---|
| 13 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 14 | USE lmdz_paramet |
---|
[5159] | 15 | |
---|
[5186] | 16 | IMPLICIT NONE |
---|
[5159] | 17 | |
---|
[5186] | 18 | !======================================================================= |
---|
[5159] | 19 | |
---|
[5186] | 20 | ! Addition of the physical tendencies |
---|
[5159] | 21 | |
---|
[5186] | 22 | ! Interface : |
---|
| 23 | ! ----------- |
---|
[5159] | 24 | |
---|
[5186] | 25 | ! Input : |
---|
| 26 | ! ------- |
---|
| 27 | ! pdt time step of integration |
---|
| 28 | ! leapf logical |
---|
| 29 | ! forward logical |
---|
| 30 | ! pucov(ip1jmp1,llm) first component of the covariant velocity |
---|
| 31 | ! pvcov(ip1ip1jm,llm) second component of the covariant velocity |
---|
| 32 | ! pteta(ip1jmp1,llm) potential temperature |
---|
| 33 | ! pts(ip1jmp1,llm) surface temperature |
---|
| 34 | ! pdufi(ip1jmp1,llm) | |
---|
| 35 | ! pdvfi(ip1jm,llm) | respective |
---|
| 36 | ! pdhfi(ip1jmp1) | tendencies |
---|
| 37 | ! pdtsfi(ip1jmp1) | |
---|
[5159] | 38 | |
---|
[5186] | 39 | ! Output : |
---|
| 40 | ! -------- |
---|
| 41 | ! pucov |
---|
| 42 | ! pvcov |
---|
| 43 | ! ph |
---|
| 44 | ! pts |
---|
[5159] | 45 | |
---|
| 46 | |
---|
[5186] | 47 | !======================================================================= |
---|
| 48 | ! ! |
---|
| 49 | ! Arguments : |
---|
| 50 | ! ----------- |
---|
[5159] | 51 | |
---|
[5186] | 52 | REAL, INTENT(IN) :: pdt ! time step for the integration (s) |
---|
[5159] | 53 | |
---|
[5186] | 54 | REAL, INTENT(INOUT) :: pvcov(ip1jm, llm) ! covariant meridional wind |
---|
| 55 | REAL, INTENT(INOUT) :: pucov(ip1jmp1, llm) ! covariant zonal wind |
---|
| 56 | REAL, INTENT(INOUT) :: pteta(ip1jmp1, llm) ! potential temperature |
---|
| 57 | REAL, INTENT(INOUT) :: pq(ip1jmp1, llm, nqtot) ! tracers |
---|
| 58 | REAL, INTENT(INOUT) :: pps(ip1jmp1) ! surface pressure (Pa) |
---|
| 59 | ! respective tendencies (.../s) to add |
---|
| 60 | REAL, INTENT(IN) :: pdvfi(ip1jm, llm) |
---|
| 61 | REAL, INTENT(IN) :: pdufi(ip1jmp1, llm) |
---|
| 62 | REAL, INTENT(IN) :: pdqfi(ip1jmp1, llm, nqtot) |
---|
| 63 | REAL, INTENT(IN) :: pdhfi(ip1jmp1, llm) |
---|
| 64 | REAL, INTENT(IN) :: pdpfi(ip1jmp1) |
---|
[5159] | 65 | |
---|
[5186] | 66 | LOGICAL, INTENT(IN) :: leapf, forward ! not used |
---|
[5159] | 67 | |
---|
| 68 | |
---|
[5186] | 69 | ! Local variables : |
---|
| 70 | ! ----------------- |
---|
[5159] | 71 | |
---|
[5186] | 72 | REAL :: xpn(iim), xps(iim), tpn, tps |
---|
| 73 | INTEGER :: j, k, iq, ij |
---|
| 74 | REAL, PARAMETER :: qtestw = 1.0e-15 |
---|
| 75 | REAL, PARAMETER :: qtestt = 1.0e-40 |
---|
[524] | 76 | |
---|
[5186] | 77 | !----------------------------------------------------------------------- |
---|
| 78 | |
---|
| 79 | DO k = 1, llm |
---|
| 80 | DO j = 1, ip1jmp1 |
---|
| 81 | pteta(j, k) = pteta(j, k) + pdhfi(j, k) * pdt |
---|
| 82 | ENDDO |
---|
[5103] | 83 | ENDDO |
---|
[524] | 84 | |
---|
[5186] | 85 | DO k = 1, llm |
---|
| 86 | DO ij = 1, iim |
---|
| 87 | xpn(ij) = aire(ij) * pteta(ij, k) |
---|
| 88 | xps(ij) = aire(ij + ip1jm) * pteta(ij + ip1jm, k) |
---|
| 89 | ENDDO |
---|
| 90 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
| 91 | tps = SSUM(iim, xps, 1) / apols |
---|
| 92 | |
---|
| 93 | DO ij = 1, iip1 |
---|
| 94 | pteta(ij, k) = tpn |
---|
| 95 | pteta(ij + ip1jm, k) = tps |
---|
| 96 | ENDDO |
---|
[5103] | 97 | ENDDO |
---|
[5186] | 98 | ! |
---|
[524] | 99 | |
---|
[5186] | 100 | DO k = 1, llm |
---|
| 101 | DO j = iip2, ip1jm |
---|
| 102 | pucov(j, k) = pucov(j, k) + pdufi(j, k) * pdt |
---|
| 103 | ENDDO |
---|
[5103] | 104 | ENDDO |
---|
[524] | 105 | |
---|
[5186] | 106 | DO k = 1, llm |
---|
| 107 | DO j = 1, ip1jm |
---|
| 108 | pvcov(j, k) = pvcov(j, k) + pdvfi(j, k) * pdt |
---|
| 109 | ENDDO |
---|
[5103] | 110 | ENDDO |
---|
[524] | 111 | |
---|
[5186] | 112 | DO j = 1, ip1jmp1 |
---|
| 113 | pps(j) = pps(j) + pdpfi(j) * pdt |
---|
[5103] | 114 | ENDDO |
---|
| 115 | |
---|
[5186] | 116 | IF (planet_type=="earth") THEN |
---|
| 117 | ! earth case, special treatment for first 2 tracers (water) |
---|
| 118 | DO iq = 1, 2 |
---|
| 119 | DO k = 1, llm |
---|
| 120 | DO j = 1, ip1jmp1 |
---|
| 121 | pq(j, k, iq) = pq(j, k, iq) + pdqfi(j, k, iq) * pdt |
---|
| 122 | pq(j, k, iq) = AMAX1(pq(j, k, iq), qtestw) |
---|
| 123 | ENDDO |
---|
[5103] | 124 | ENDDO |
---|
[524] | 125 | ENDDO |
---|
| 126 | |
---|
[5186] | 127 | DO iq = 3, nqtot |
---|
| 128 | DO k = 1, llm |
---|
| 129 | DO j = 1, ip1jmp1 |
---|
| 130 | pq(j, k, iq) = pq(j, k, iq) + pdqfi(j, k, iq) * pdt |
---|
| 131 | pq(j, k, iq) = AMAX1(pq(j, k, iq), qtestt) |
---|
| 132 | ENDDO |
---|
[5103] | 133 | ENDDO |
---|
[524] | 134 | ENDDO |
---|
[5186] | 135 | else |
---|
| 136 | ! general case, treat all tracers equally) |
---|
| 137 | DO iq = 1, nqtot |
---|
| 138 | DO k = 1, llm |
---|
| 139 | DO j = 1, ip1jmp1 |
---|
| 140 | pq(j, k, iq) = pq(j, k, iq) + pdqfi(j, k, iq) * pdt |
---|
| 141 | pq(j, k, iq) = AMAX1(pq(j, k, iq), qtestt) |
---|
| 142 | ENDDO |
---|
[5103] | 143 | ENDDO |
---|
| 144 | ENDDO |
---|
[5186] | 145 | ENDIF ! of if (planet_type=="earth") |
---|
| 146 | |
---|
| 147 | DO ij = 1, iim |
---|
| 148 | xpn(ij) = aire(ij) * pps(ij) |
---|
| 149 | xps(ij) = aire(ij + ip1jm) * pps(ij + ip1jm) |
---|
[5103] | 150 | ENDDO |
---|
[5186] | 151 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
| 152 | tps = SSUM(iim, xps, 1) / apols |
---|
[524] | 153 | |
---|
[5186] | 154 | DO ij = 1, iip1 |
---|
| 155 | pps (ij) = tpn |
---|
| 156 | pps (ij + ip1jm) = tps |
---|
| 157 | ENDDO |
---|
[524] | 158 | |
---|
[5186] | 159 | DO iq = 1, nqtot |
---|
| 160 | DO k = 1, llm |
---|
| 161 | DO ij = 1, iim |
---|
| 162 | xpn(ij) = aire(ij) * pq(ij, k, iq) |
---|
| 163 | xps(ij) = aire(ij + ip1jm) * pq(ij + ip1jm, k, iq) |
---|
| 164 | ENDDO |
---|
| 165 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
| 166 | tps = SSUM(iim, xps, 1) / apols |
---|
[524] | 167 | |
---|
[5186] | 168 | DO ij = 1, iip1 |
---|
| 169 | pq (ij, k, iq) = tpn |
---|
| 170 | pq (ij + ip1jm, k, iq) = tps |
---|
| 171 | ENDDO |
---|
[524] | 172 | ENDDO |
---|
[5103] | 173 | ENDDO |
---|
[524] | 174 | |
---|
[5186] | 175 | END SUBROUTINE addfi |
---|
| 176 | END MODULE lmdz_addfi |
---|