1 | MODULE lmdz_addfi |
---|
2 | IMPLICIT NONE; PRIVATE |
---|
3 | PUBLIC addfi |
---|
4 | |
---|
5 | CONTAINS |
---|
6 | |
---|
7 | SUBROUTINE addfi(pdt, leapf, forward, pucov, pvcov, pteta, pq, pps, pdufi, pdvfi, pdhfi, pdqfi, pdpfi) |
---|
8 | |
---|
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 |
---|
15 | |
---|
16 | IMPLICIT NONE |
---|
17 | |
---|
18 | !======================================================================= |
---|
19 | |
---|
20 | ! Addition of the physical tendencies |
---|
21 | |
---|
22 | ! Interface : |
---|
23 | ! ----------- |
---|
24 | |
---|
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) | |
---|
38 | |
---|
39 | ! Output : |
---|
40 | ! -------- |
---|
41 | ! pucov |
---|
42 | ! pvcov |
---|
43 | ! ph |
---|
44 | ! pts |
---|
45 | |
---|
46 | |
---|
47 | !======================================================================= |
---|
48 | ! ! |
---|
49 | ! Arguments : |
---|
50 | ! ----------- |
---|
51 | |
---|
52 | REAL, INTENT(IN) :: pdt ! time step for the integration (s) |
---|
53 | |
---|
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) |
---|
65 | |
---|
66 | LOGICAL, INTENT(IN) :: leapf, forward ! not used |
---|
67 | |
---|
68 | |
---|
69 | ! Local variables : |
---|
70 | ! ----------------- |
---|
71 | |
---|
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 |
---|
76 | |
---|
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 |
---|
83 | ENDDO |
---|
84 | |
---|
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 |
---|
97 | ENDDO |
---|
98 | ! |
---|
99 | |
---|
100 | DO k = 1, llm |
---|
101 | DO j = iip2, ip1jm |
---|
102 | pucov(j, k) = pucov(j, k) + pdufi(j, k) * pdt |
---|
103 | ENDDO |
---|
104 | ENDDO |
---|
105 | |
---|
106 | DO k = 1, llm |
---|
107 | DO j = 1, ip1jm |
---|
108 | pvcov(j, k) = pvcov(j, k) + pdvfi(j, k) * pdt |
---|
109 | ENDDO |
---|
110 | ENDDO |
---|
111 | |
---|
112 | DO j = 1, ip1jmp1 |
---|
113 | pps(j) = pps(j) + pdpfi(j) * pdt |
---|
114 | ENDDO |
---|
115 | |
---|
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 |
---|
124 | ENDDO |
---|
125 | ENDDO |
---|
126 | |
---|
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 |
---|
133 | ENDDO |
---|
134 | ENDDO |
---|
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 |
---|
143 | ENDDO |
---|
144 | ENDDO |
---|
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) |
---|
150 | ENDDO |
---|
151 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
152 | tps = SSUM(iim, xps, 1) / apols |
---|
153 | |
---|
154 | DO ij = 1, iip1 |
---|
155 | pps (ij) = tpn |
---|
156 | pps (ij + ip1jm) = tps |
---|
157 | ENDDO |
---|
158 | |
---|
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 |
---|
167 | |
---|
168 | DO ij = 1, iip1 |
---|
169 | pq (ij, k, iq) = tpn |
---|
170 | pq (ij + ip1jm, k, iq) = tps |
---|
171 | ENDDO |
---|
172 | ENDDO |
---|
173 | ENDDO |
---|
174 | |
---|
175 | END SUBROUTINE addfi |
---|
176 | END MODULE lmdz_addfi |
---|