/[lmdze]/trunk/Sources/phylmd/phystokenc.f
ViewVC logotype

Contents of /trunk/Sources/phylmd/phystokenc.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 201 - (show annotations)
Mon Jun 6 17:42:15 2016 UTC (7 years, 11 months ago) by guez
File size: 8240 byte(s)
Removed intermediary objects of cv_thermo_m, access suphec_m
directly. Procedure cv_thermo disappeared, all objects are named
constants.

In cv_driver and below, limited extents of arrays to what is needed.

lv, cpn and th in cv30_compress were set at level nl + 1 but lv1, cpn1
and th1 are not defined at this level. This did not lead to an error
because values at nl + 1 were not used.

Removed test on ok_sync in phystokenc because it is not read at run
time. Printing min and max of output NetCDF variables is heavy and
archaic.

Used histwrite_phy in phytrac.

1 module phystokenc_m
2
3 IMPLICIT NONE
4
5 contains
6
7 SUBROUTINE phystokenc(pdtphys, pt, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, &
8 pfm_therm, pentr_therm, pcoefh, yu1, yv1, ftsol, pctsrf, frac_impa, &
9 frac_nucl, pphis, paire, dtime)
10
11 ! From phylmd/phystokenc.F, version 1.2 2004/06/22 11:45:35
12 ! Author: Fr\'ed\'eric Hourdin
13 ! Objet : \'ecriture des variables pour transport offline
14
15 use gr_phy_write_m, only: gr_phy_write
16 USE histwrite_m, ONLY: histwrite
17 USE histsync_m, ONLY: histsync
18 USE dimens_m, ONLY: iim, jjm
19 USE indicesol, ONLY: nbsrf
20 use initphysto_m, only: initphysto
21 USE dimphy, ONLY: klev, klon
22 use time_phylmdz, only: itap
23 USE tracstoke, ONLY: istphy
24
25 REAL, INTENT (IN):: pdtphys ! pas d'integration pour la physique (seconde)
26 REAL, intent(in):: pt(klon, klev)
27
28 ! convection:
29
30 REAL, INTENT (IN):: pmfu(klon, klev) ! flux de masse dans le panache montant
31
32 REAL, intent(in):: pmfd(klon, klev)
33 ! flux de masse dans le panache descendant
34
35 REAL, intent(in):: pen_u(klon, klev) ! flux entraine dans le panache montant
36 REAL, intent(in):: pde_u(klon, klev) ! flux detraine dans le panache montant
37
38 REAL, intent(in):: pen_d(klon, klev)
39 ! flux entraine dans le panache descendant
40
41 REAL, intent(in):: pde_d(klon, klev)
42 ! flux detraine dans le panache descendant
43
44 ! Les Thermiques
45 REAL, intent(in):: pfm_therm(klon, klev+1)
46 REAL, intent(in):: pentr_therm(klon, klev)
47
48 ! Couche limite:
49 REAL, intent(in):: pcoefh(klon, klev) ! coeff melange Couche limite
50 REAL, intent(in):: yu1(klon)
51 REAL, intent(in):: yv1(klon)
52
53 ! Arguments necessaires pour les sources et puits de traceur
54
55 REAL, intent(in):: ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin)
56 REAL, intent(in):: pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)
57
58 ! Coefficients de lessivage:
59 REAL, intent(in):: frac_impa(klon, klev) ! facteur d'impaction
60 REAL, intent(in):: frac_nucl(klon, klev) ! facteur de nucleation
61
62 REAL, INTENT(IN):: pphis(klon)
63 real, intent(in):: paire(klon)
64 REAL, INTENT (IN):: dtime
65
66 ! Local:
67
68 real t(klon, klev)
69 INTEGER, SAVE:: physid
70
71 ! Les Thermiques
72
73 REAL fm_therm1(klon, klev)
74 REAL entr_therm(klon, klev)
75 REAL fm_therm(klon, klev)
76
77 INTEGER i, k
78
79 REAL, save:: mfu(klon, klev) ! flux de masse dans le panache montant
80 REAL mfd(klon, klev) ! flux de masse dans le panache descendant
81 REAL en_u(klon, klev) ! flux entraine dans le panache montant
82 REAL de_u(klon, klev) ! flux detraine dans le panache montant
83 REAL en_d(klon, klev) ! flux entraine dans le panache descendant
84 REAL de_d(klon, klev) ! flux detraine dans le panache descendant
85 REAL coefh(klon, klev) ! flux detraine dans le panache descendant
86
87 REAL pyu1(klon), pyv1(klon)
88 REAL pftsol(klon, nbsrf), ppsrf(klon, nbsrf)
89 REAL pftsol1(klon), pftsol2(klon), pftsol3(klon), pftsol4(klon)
90 REAL ppsrf1(klon), ppsrf2(klon), ppsrf3(klon), ppsrf4(klon)
91
92 REAL dtcum
93
94 INTEGER:: iadvtr = 0, irec = 1
95
96 SAVE t, mfd, en_u, de_u, en_d, de_d, coefh, dtcum
97 SAVE fm_therm, entr_therm
98 SAVE pyu1, pyv1, pftsol, ppsrf
99
100 !------------------------------------------------------
101
102 ! Couche limite:
103
104 IF (iadvtr==0) CALL initphysto('phystoke', dtime, dtime * istphy, &
105 dtime * istphy, physid)
106
107 CALL histwrite(physid, 'phis', itap, gr_phy_write(pphis))
108 CALL histwrite(physid, 'aire', itap, gr_phy_write(paire))
109 iadvtr = iadvtr + 1
110
111 IF (mod(iadvtr, istphy) == 1 .OR. istphy == 1) THEN
112 PRINT *, 'reinitialisation des champs cumules a iadvtr =', iadvtr
113 DO k = 1, klev
114 DO i = 1, klon
115 mfu(i, k) = 0.
116 mfd(i, k) = 0.
117 en_u(i, k) = 0.
118 de_u(i, k) = 0.
119 en_d(i, k) = 0.
120 de_d(i, k) = 0.
121 coefh(i, k) = 0.
122 t(i, k) = 0.
123 fm_therm(i, k) = 0.
124 entr_therm(i, k) = 0.
125 END DO
126 END DO
127 DO i = 1, klon
128 pyv1(i) = 0.
129 pyu1(i) = 0.
130 END DO
131 DO k = 1, nbsrf
132 DO i = 1, klon
133 pftsol(i, k) = 0.
134 ppsrf(i, k) = 0.
135 END DO
136 END DO
137
138 dtcum = 0.
139 END IF
140
141 DO k = 1, klev
142 DO i = 1, klon
143 mfu(i, k) = mfu(i, k) + pmfu(i, k) * pdtphys
144 mfd(i, k) = mfd(i, k) + pmfd(i, k) * pdtphys
145 en_u(i, k) = en_u(i, k) + pen_u(i, k) * pdtphys
146 de_u(i, k) = de_u(i, k) + pde_u(i, k) * pdtphys
147 en_d(i, k) = en_d(i, k) + pen_d(i, k) * pdtphys
148 de_d(i, k) = de_d(i, k) + pde_d(i, k) * pdtphys
149 coefh(i, k) = coefh(i, k) + pcoefh(i, k) * pdtphys
150 t(i, k) = t(i, k) + pt(i, k) * pdtphys
151 fm_therm(i, k) = fm_therm(i, k) + pfm_therm(i, k) * pdtphys
152 entr_therm(i, k) = entr_therm(i, k) + pentr_therm(i, k) * pdtphys
153 END DO
154 END DO
155 DO i = 1, klon
156 pyv1(i) = pyv1(i) + yv1(i) * pdtphys
157 pyu1(i) = pyu1(i) + yu1(i) * pdtphys
158 END DO
159 DO k = 1, nbsrf
160 DO i = 1, klon
161 pftsol(i, k) = pftsol(i, k) + ftsol(i, k) * pdtphys
162 ppsrf(i, k) = ppsrf(i, k) + pctsrf(i, k) * pdtphys
163 END DO
164 END DO
165
166 dtcum = dtcum + pdtphys
167
168 IF (mod(iadvtr, istphy) == 0) THEN
169 ! normalisation par le temps cumule
170 DO k = 1, klev
171 DO i = 1, klon
172 mfu(i, k) = mfu(i, k)/dtcum
173 mfd(i, k) = mfd(i, k)/dtcum
174 en_u(i, k) = en_u(i, k)/dtcum
175 de_u(i, k) = de_u(i, k)/dtcum
176 en_d(i, k) = en_d(i, k)/dtcum
177 de_d(i, k) = de_d(i, k)/dtcum
178 coefh(i, k) = coefh(i, k)/dtcum
179 t(i, k) = t(i, k)/dtcum
180 fm_therm(i, k) = fm_therm(i, k)/dtcum
181 entr_therm(i, k) = entr_therm(i, k)/dtcum
182 END DO
183 END DO
184 DO i = 1, klon
185 pyv1(i) = pyv1(i)/dtcum
186 pyu1(i) = pyu1(i)/dtcum
187 END DO
188 DO k = 1, nbsrf
189 DO i = 1, klon
190 pftsol(i, k) = pftsol(i, k)/dtcum
191 pftsol1(i) = pftsol(i, 1)
192 pftsol2(i) = pftsol(i, 2)
193 pftsol3(i) = pftsol(i, 3)
194 pftsol4(i) = pftsol(i, 4)
195
196 ppsrf(i, k) = ppsrf(i, k)/dtcum
197 ppsrf1(i) = ppsrf(i, 1)
198 ppsrf2(i) = ppsrf(i, 2)
199 ppsrf3(i) = ppsrf(i, 3)
200 ppsrf4(i) = ppsrf(i, 4)
201 END DO
202 END DO
203
204 ! \'Ecriture des champs
205
206 irec = irec + 1
207
208 CALL histwrite(physid, 't', itap, gr_phy_write(t))
209 CALL histwrite(physid, 'mfu', itap, gr_phy_write(mfu))
210 CALL histwrite(physid, 'mfd', itap, gr_phy_write(mfd))
211 CALL histwrite(physid, 'en_u', itap, gr_phy_write(en_u))
212 CALL histwrite(physid, 'de_u', itap, gr_phy_write(de_u))
213 CALL histwrite(physid, 'en_d', itap, gr_phy_write(en_d))
214 CALL histwrite(physid, 'de_d', itap, gr_phy_write(de_d))
215 CALL histwrite(physid, 'coefh', itap, gr_phy_write(coefh))
216 DO k = 1, klev
217 DO i = 1, klon
218 fm_therm1(i, k) = fm_therm(i, k)
219 END DO
220 END DO
221
222 CALL histwrite(physid, 'fm_th', itap, gr_phy_write(fm_therm1))
223 CALL histwrite(physid, 'en_th', itap, gr_phy_write(entr_therm))
224 CALL histwrite(physid, 'frac_impa', itap, gr_phy_write(frac_impa))
225 CALL histwrite(physid, 'frac_nucl', itap, gr_phy_write(frac_nucl))
226 CALL histwrite(physid, 'pyu1', itap, gr_phy_write(pyu1))
227 CALL histwrite(physid, 'pyv1', itap, gr_phy_write(pyv1))
228 CALL histwrite(physid, 'ftsol1', itap, gr_phy_write(pftsol1))
229 CALL histwrite(physid, 'ftsol2', itap, gr_phy_write(pftsol2))
230 CALL histwrite(physid, 'ftsol3', itap, gr_phy_write(pftsol3))
231 CALL histwrite(physid, 'ftsol4', itap, gr_phy_write(pftsol4))
232 CALL histwrite(physid, 'psrf1', itap, gr_phy_write(ppsrf1))
233 CALL histwrite(physid, 'psrf2', itap, gr_phy_write(ppsrf2))
234 CALL histwrite(physid, 'psrf3', itap, gr_phy_write(ppsrf3))
235 CALL histwrite(physid, 'psrf4', itap, gr_phy_write(ppsrf4))
236
237 CALL histsync(physid)
238 END IF
239
240 END SUBROUTINE phystokenc
241
242 end module phystokenc_m

  ViewVC Help
Powered by ViewVC 1.1.21