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