| Directory: | ./ |
|---|---|
| File: | dyn/addfi.f |
| Date: | 2022-01-11 19:19:34 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 51 | 56 | 91.1% |
| Branches: | 45 | 52 | 86.5% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | ! | ||
| 2 | ! $Id: addfi.F 2598 2016-07-22 09:28:39Z emillour $ | ||
| 3 | ! | ||
| 4 | 480 | SUBROUTINE addfi(pdt, leapf, forward, | |
| 5 | S pucov, pvcov, pteta, pq , pps , | ||
| 6 | S pdufi, pdvfi, pdhfi,pdqfi, pdpfi ) | ||
| 7 | |||
| 8 | USE infotrac, ONLY : nqtot | ||
| 9 | USE control_mod, ONLY : planet_type | ||
| 10 | IMPLICIT NONE | ||
| 11 | c | ||
| 12 | c======================================================================= | ||
| 13 | c | ||
| 14 | c Addition of the physical tendencies | ||
| 15 | c | ||
| 16 | c Interface : | ||
| 17 | c ----------- | ||
| 18 | c | ||
| 19 | c Input : | ||
| 20 | c ------- | ||
| 21 | c pdt time step of integration | ||
| 22 | c leapf logical | ||
| 23 | c forward logical | ||
| 24 | c pucov(ip1jmp1,llm) first component of the covariant velocity | ||
| 25 | c pvcov(ip1ip1jm,llm) second component of the covariant velocity | ||
| 26 | c pteta(ip1jmp1,llm) potential temperature | ||
| 27 | c pts(ip1jmp1,llm) surface temperature | ||
| 28 | c pdufi(ip1jmp1,llm) | | ||
| 29 | c pdvfi(ip1jm,llm) | respective | ||
| 30 | c pdhfi(ip1jmp1) | tendencies | ||
| 31 | c pdtsfi(ip1jmp1) | | ||
| 32 | c | ||
| 33 | c Output : | ||
| 34 | c -------- | ||
| 35 | c pucov | ||
| 36 | c pvcov | ||
| 37 | c ph | ||
| 38 | c pts | ||
| 39 | c | ||
| 40 | c | ||
| 41 | c======================================================================= | ||
| 42 | c | ||
| 43 | c----------------------------------------------------------------------- | ||
| 44 | c | ||
| 45 | c 0. Declarations : | ||
| 46 | c ------------------ | ||
| 47 | c | ||
| 48 | include "dimensions.h" | ||
| 49 | include "paramet.h" | ||
| 50 | include "comgeom.h" | ||
| 51 | c | ||
| 52 | c Arguments : | ||
| 53 | c ----------- | ||
| 54 | c | ||
| 55 | REAL,INTENT(IN) :: pdt ! time step for the integration (s) | ||
| 56 | c | ||
| 57 | REAL,INTENT(INOUT) :: pvcov(ip1jm,llm) ! covariant meridional wind | ||
| 58 | REAL,INTENT(INOUT) :: pucov(ip1jmp1,llm) ! covariant zonal wind | ||
| 59 | REAL,INTENT(INOUT) :: pteta(ip1jmp1,llm) ! potential temperature | ||
| 60 | REAL,INTENT(INOUT) :: pq(ip1jmp1,llm,nqtot) ! tracers | ||
| 61 | REAL,INTENT(INOUT) :: pps(ip1jmp1) ! surface pressure (Pa) | ||
| 62 | c respective tendencies (.../s) to add | ||
| 63 | REAL,INTENT(IN) :: pdvfi(ip1jm,llm) | ||
| 64 | REAL,INTENT(IN) :: pdufi(ip1jmp1,llm) | ||
| 65 | REAL,INTENT(IN) :: pdqfi(ip1jmp1,llm,nqtot) | ||
| 66 | REAL,INTENT(IN) :: pdhfi(ip1jmp1,llm) | ||
| 67 | REAL,INTENT(IN) :: pdpfi(ip1jmp1) | ||
| 68 | c | ||
| 69 | LOGICAL,INTENT(IN) :: leapf,forward ! not used | ||
| 70 | c | ||
| 71 | c | ||
| 72 | c Local variables : | ||
| 73 | c ----------------- | ||
| 74 | c | ||
| 75 | REAL xpn(iim),xps(iim),tpn,tps | ||
| 76 | INTEGER j,k,iq,ij | ||
| 77 | REAL,PARAMETER :: qtestw = 1.0e-15 | ||
| 78 | REAL,PARAMETER :: qtestt = 1.0e-40 | ||
| 79 | |||
| 80 | REAL SSUM | ||
| 81 | c | ||
| 82 | c----------------------------------------------------------------------- | ||
| 83 | |||
| 84 |
2/2✓ Branch 0 taken 18720 times.
✓ Branch 1 taken 480 times.
|
19200 | DO k = 1,llm |
| 85 |
2/2✓ Branch 0 taken 20386080 times.
✓ Branch 1 taken 18720 times.
|
20405280 | DO j = 1,ip1jmp1 |
| 86 | 20404800 | pteta(j,k)= pteta(j,k) + pdhfi(j,k) * pdt | |
| 87 | ENDDO | ||
| 88 | ENDDO | ||
| 89 | |||
| 90 |
2/2✓ Branch 0 taken 18720 times.
✓ Branch 1 taken 480 times.
|
19200 | DO k = 1, llm |
| 91 |
2/2✓ Branch 0 taken 599040 times.
✓ Branch 1 taken 18720 times.
|
617760 | DO ij = 1, iim |
| 92 | 599040 | xpn(ij) = aire( ij ) * pteta( ij ,k) | |
| 93 | 617760 | xps(ij) = aire(ij+ip1jm) * pteta(ij+ip1jm,k) | |
| 94 | ENDDO | ||
| 95 | 18720 | tpn = SSUM(iim,xpn,1)/ apoln | |
| 96 | 18720 | tps = SSUM(iim,xps,1)/ apols | |
| 97 | |||
| 98 |
2/2✓ Branch 0 taken 617760 times.
✓ Branch 1 taken 18720 times.
|
636960 | DO ij = 1, iip1 |
| 99 | 617760 | pteta( ij ,k) = tpn | |
| 100 | 636480 | pteta(ij+ip1jm,k) = tps | |
| 101 | ENDDO | ||
| 102 | ENDDO | ||
| 103 | c | ||
| 104 | |||
| 105 |
2/2✓ Branch 0 taken 18720 times.
✓ Branch 1 taken 480 times.
|
19200 | DO k = 1,llm |
| 106 |
2/2✓ Branch 0 taken 19150560 times.
✓ Branch 1 taken 18720 times.
|
19169760 | DO j = iip2,ip1jm |
| 107 | 19169280 | pucov(j,k)= pucov(j,k) + pdufi(j,k) * pdt | |
| 108 | ENDDO | ||
| 109 | ENDDO | ||
| 110 | |||
| 111 |
2/2✓ Branch 0 taken 18720 times.
✓ Branch 1 taken 480 times.
|
19200 | DO k = 1,llm |
| 112 |
2/2✓ Branch 0 taken 19768320 times.
✓ Branch 1 taken 18720 times.
|
19787520 | DO j = 1,ip1jm |
| 113 | 19787040 | pvcov(j,k)= pvcov(j,k) + pdvfi(j,k) * pdt | |
| 114 | ENDDO | ||
| 115 | ENDDO | ||
| 116 | |||
| 117 | c | ||
| 118 |
2/2✓ Branch 0 taken 522720 times.
✓ Branch 1 taken 480 times.
|
523200 | DO j = 1,ip1jmp1 |
| 119 | 523200 | pps(j) = pps(j) + pdpfi(j) * pdt | |
| 120 | ENDDO | ||
| 121 | |||
| 122 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if (planet_type=="earth") then |
| 123 | ! earth case, special treatment for first 2 tracers (water) | ||
| 124 |
2/2✓ Branch 0 taken 960 times.
✓ Branch 1 taken 480 times.
|
1440 | DO iq = 1, 2 |
| 125 |
2/2✓ Branch 0 taken 37440 times.
✓ Branch 1 taken 960 times.
|
38880 | DO k = 1,llm |
| 126 |
2/2✓ Branch 0 taken 40772160 times.
✓ Branch 1 taken 37440 times.
|
40810560 | DO j = 1,ip1jmp1 |
| 127 | 40772160 | pq(j,k,iq)= pq(j,k,iq) + pdqfi(j,k,iq) * pdt | |
| 128 | 40809600 | pq(j,k,iq)= AMAX1( pq(j,k,iq), qtestw ) | |
| 129 | ENDDO | ||
| 130 | ENDDO | ||
| 131 | ENDDO | ||
| 132 | |||
| 133 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 1440 times.
|
1920 | DO iq = 3, nqtot |
| 134 |
2/2✓ Branch 0 taken 56160 times.
✓ Branch 1 taken 1440 times.
|
58080 | DO k = 1,llm |
| 135 |
2/2✓ Branch 0 taken 61158240 times.
✓ Branch 1 taken 56160 times.
|
61215840 | DO j = 1,ip1jmp1 |
| 136 | 61158240 | pq(j,k,iq)= pq(j,k,iq) + pdqfi(j,k,iq) * pdt | |
| 137 | 61214400 | pq(j,k,iq)= AMAX1( pq(j,k,iq), qtestt ) | |
| 138 | ENDDO | ||
| 139 | ENDDO | ||
| 140 | ENDDO | ||
| 141 | else | ||
| 142 | ! general case, treat all tracers equally) | ||
| 143 | ✗ | DO iq = 1, nqtot | |
| 144 | ✗ | DO k = 1,llm | |
| 145 | ✗ | DO j = 1,ip1jmp1 | |
| 146 | ✗ | pq(j,k,iq)= pq(j,k,iq) + pdqfi(j,k,iq) * pdt | |
| 147 | ✗ | pq(j,k,iq)= AMAX1( pq(j,k,iq), qtestt ) | |
| 148 | ENDDO | ||
| 149 | ENDDO | ||
| 150 | ENDDO | ||
| 151 | endif ! of if (planet_type=="earth") | ||
| 152 | |||
| 153 | |||
| 154 |
2/2✓ Branch 0 taken 15360 times.
✓ Branch 1 taken 480 times.
|
15840 | DO ij = 1, iim |
| 155 | 15360 | xpn(ij) = aire( ij ) * pps( ij ) | |
| 156 | 15840 | xps(ij) = aire(ij+ip1jm) * pps(ij+ip1jm ) | |
| 157 | ENDDO | ||
| 158 | 480 | tpn = SSUM(iim,xpn,1)/apoln | |
| 159 | 480 | tps = SSUM(iim,xps,1)/apols | |
| 160 | |||
| 161 |
2/2✓ Branch 0 taken 15840 times.
✓ Branch 1 taken 480 times.
|
16320 | DO ij = 1, iip1 |
| 162 | 15840 | pps ( ij ) = tpn | |
| 163 | 16320 | pps ( ij+ip1jm ) = tps | |
| 164 | ENDDO | ||
| 165 | |||
| 166 | |||
| 167 |
2/2✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 480 times.
|
2880 | DO iq = 1, nqtot |
| 168 |
2/2✓ Branch 0 taken 93600 times.
✓ Branch 1 taken 2400 times.
|
96480 | DO k = 1, llm |
| 169 |
2/2✓ Branch 0 taken 2995200 times.
✓ Branch 1 taken 93600 times.
|
3088800 | DO ij = 1, iim |
| 170 | 2995200 | xpn(ij) = aire( ij ) * pq( ij ,k,iq) | |
| 171 | 3088800 | xps(ij) = aire(ij+ip1jm) * pq(ij+ip1jm,k,iq) | |
| 172 | ENDDO | ||
| 173 | 93600 | tpn = SSUM(iim,xpn,1)/apoln | |
| 174 | 93600 | tps = SSUM(iim,xps,1)/apols | |
| 175 | |||
| 176 |
2/2✓ Branch 0 taken 3088800 times.
✓ Branch 1 taken 93600 times.
|
3184800 | DO ij = 1, iip1 |
| 177 | 3088800 | pq ( ij ,k,iq) = tpn | |
| 178 | 3182400 | pq (ij+ip1jm,k,iq) = tps | |
| 179 | ENDDO | ||
| 180 | ENDDO | ||
| 181 | ENDDO | ||
| 182 | |||
| 183 | 480 | RETURN | |
| 184 | END | ||
| 185 |