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