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