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

Annotation of /trunk/Sources/phylmd/ini_histins.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 191 - (hide annotations)
Mon May 9 19:56:28 2016 UTC (8 years ago) by guez
File size: 12343 byte(s)
Extracted the call to read_comdissnew out of conf_gcm.

Made ok_instan a variable of module clesphys, itau_phy a variable of
module phyetat0_m, nid_ins a variable of module ini_histins_m, itap a
variable of new module time_phylmdz, so that histwrite_phy can be
called from any procedure without the need to cascade those variables
into that procedure. Made itau_w a variable of module time_phylmdz so
that it is computed only once per time step of physics.

Extracted variables of module clesphys which were in namelist
conf_phys_nml into their own namelist, clesphys_nml, and created
procedure read_clesphys reading clesphys_nml, to avoid side effect.

No need for double precision in procedure getso4fromfile. Assume there
is a single variable for the whole year in the NetCDF file instead of
one variable per month.

Created generic procedure histwrite_phy and removed procedure
write_histins, following LMDZ. histwrite_phy has only two arguments,
can be called from anywhere, and should manage the logic of writing or
not writing into various history files with various operations. So the
test on ok_instan goes inside histwrite_phy.

Test for raz_date in phyetat0 instead of physiq to avoid side effect.

Created procedure increment_itap to avoid side effect.

Removed unnecessary differences between procedures readsulfate and
readsulfate_pi.

1 guez 34 module ini_histins_m
2    
3     implicit none
4    
5 guez 191 integer, save:: nid_ins
6    
7 guez 34 contains
8    
9 guez 191 subroutine ini_histins(dtime)
10 guez 34
11     ! From phylmd/ini_histins.h, v 1.2 2005/05/25 13:10:09
12    
13 guez 191 use clesphys, only: ecrit_ins, ok_instan
14 guez 183 use clesphys2, only: conv_emanuel
15 guez 159 use dimens_m, only: iim, jjm, llm, nqmx
16 guez 34 use dimphy, only: klon
17 guez 92 use disvert_m, only: presnivs
18 guez 190 use dynetat0_m, only: day_ref, annee_ref, rlatu, rlonv
19 guez 61 USE histbeg_totreg_m, ONLY : histbeg_totreg
20     USE histdef_m, ONLY : histdef
21     USE histend_m, ONLY : histend
22     USE histvert_m, ONLY : histvert
23 guez 92 use indicesol, only: nbsrf, clnsurf
24 guez 159 use iniadvtrac_m, only: tname, ttext
25 guez 190 use nr_util, only: pi
26 guez 191 use phyetat0_m, only: itau_phy
27 guez 92 USE ymds2ju_m, only: ymds2ju
28 guez 34
29     REAL, intent(in):: dtime ! pas temporel de la physique (s)
30    
31 guez 175 ! Local:
32 guez 34 real zjulian, zsto, zout
33 guez 190 integer nhori, nvert, nsrf, iq, it
34 guez 34
35     !-------------------------------------------------------------------
36    
37     IF (ok_instan) THEN
38     zsto = dtime * ecrit_ins
39     zout = dtime * ecrit_ins
40 guez 129 CALL ymds2ju(annee_ref, 1, day_ref, 0.0, zjulian)
41 guez 190 CALL histbeg_totreg("histins", rlonv(:iim) / pi * 180., &
42     rlatu / pi * 180., 1, iim, &
43     1, jjm + 1, itau_phy, zjulian, dtime, nhori, nid_ins)
44 guez 34 write(*, *)'Inst ', itau_phy, zjulian
45     CALL histvert(nid_ins, "presnivs", "Vertical levels", "mb", &
46 guez 67 presnivs/100., nvert)
47 guez 34 CALL histdef(nid_ins, "phis", "Surface geop. height", "-", &
48     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
49     "once", zsto, zout)
50     CALL histdef(nid_ins, "aire", "Grid area", "-", &
51     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
52     "once", zsto, zout)
53    
54     ! Champs 2D:
55    
56     CALL histdef(nid_ins, "tsol", "Surface Temperature", "K", &
57     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
58     "inst(X)", zsto, zout)
59    
60     CALL histdef(nid_ins, "t2m", "Temperature 2m", "K", &
61     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
62     "inst(X)", zsto, zout)
63    
64     CALL histdef(nid_ins, "q2m", "Specific humidity 2m", "Kg/Kg", &
65     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
66     "inst(X)", zsto, zout)
67    
68     CALL histdef(nid_ins, "u10m", "Vent zonal 10m", "m/s", &
69     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
70     "inst(X)", zsto, zout)
71    
72     CALL histdef(nid_ins, "v10m", "Vent meridien 10m", "m/s", &
73     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
74     "inst(X)", zsto, zout)
75    
76     CALL histdef(nid_ins, "psol", "Surface Pressure", "Pa", &
77     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
78     "inst(X)", zsto, zout)
79    
80     CALL histdef(nid_ins, "plul", "Large-scale Precip.", "mm/day", &
81     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
82     "inst(X)", zsto, zout)
83    
84     CALL histdef(nid_ins, "pluc", "Convective Precip.", "mm/day", &
85     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
86     "inst(X)", zsto, zout)
87    
88     CALL histdef(nid_ins, "cdrm", "Momentum drag coef.", "-", &
89     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
90     "inst(X)", zsto, zout)
91    
92     CALL histdef(nid_ins, "cdrh", "Heat drag coef.", "-", &
93     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
94     "inst(X)", zsto, zout)
95    
96     CALL histdef(nid_ins, "precip", "Precipitation Totale liq+sol", &
97     "kg/(s*m2)", &
98     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
99     "inst(X)", zsto, zout)
100    
101     CALL histdef(nid_ins, "snow", "Snow fall", "kg/(s*m2)", &
102     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
103     "inst(X)", zsto, zout)
104    
105     ! CALL histdef(nid_ins, "snow_mass", "Snow Mass", "kg/m2",
106     ! . iim, (jjm + 1), nhori, 1, 1, 1, -99,
107     ! . "inst(X)", zsto, zout)
108    
109     CALL histdef(nid_ins, "topl", "OLR", "W/m2", &
110     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
111     "inst(X)", zsto, zout)
112    
113     CALL histdef(nid_ins, "evap", "Evaporation", "kg/(s*m2)", &
114     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
115     "inst(X)", zsto, zout)
116    
117     CALL histdef(nid_ins, "sols", "Solar rad. at surf.", "W/m2", &
118     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
119     "inst(X)", zsto, zout)
120    
121     CALL histdef(nid_ins, "soll", "IR rad. at surface", "W/m2", &
122     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
123     "inst(X)", zsto, zout)
124    
125     CALL histdef(nid_ins, "solldown", "Down. IR rad. at surface", &
126     "W/m2", iim, (jjm + 1), nhori, 1, 1, 1, -99, &
127     "inst(X)", zsto, zout)
128    
129     CALL histdef(nid_ins, "bils", "Surf. total heat flux", "W/m2", &
130     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
131     "inst(X)", zsto, zout)
132    
133     CALL histdef(nid_ins, "sens", "Sensible heat flux", "W/m2", &
134     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
135     "inst(X)", zsto, zout)
136    
137     CALL histdef(nid_ins, "fder", "Heat flux derivation", "W/m2", &
138     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
139     "inst(X)", zsto, zout)
140    
141     CALL histdef(nid_ins, "dtsvdfo", "Boundary-layer dTs(o)", "K/s", &
142     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
143     "inst(X)", zsto, zout)
144    
145     CALL histdef(nid_ins, "dtsvdft", "Boundary-layer dTs(t)", "K/s", &
146     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
147     "inst(X)", zsto, zout)
148    
149     CALL histdef(nid_ins, "dtsvdfg", "Boundary-layer dTs(g)", "K/s", &
150     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
151     "inst(X)", zsto, zout)
152    
153     CALL histdef(nid_ins, "dtsvdfi", "Boundary-layer dTs(g)", "K/s", &
154     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
155     "inst(X)", zsto, zout)
156    
157     DO nsrf = 1, nbsrf
158    
159     call histdef(nid_ins, "pourc_"//clnsurf(nsrf), &
160     "% "//clnsurf(nsrf), "%", &
161     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
162     "inst(X)", zsto, zout)
163    
164     call histdef(nid_ins, "fract_"//clnsurf(nsrf), &
165     "Fraction "//clnsurf(nsrf), "1", &
166     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
167     "inst(X)", zsto, zout)
168    
169     call histdef(nid_ins, "sens_"//clnsurf(nsrf), &
170     "Sensible heat flux "//clnsurf(nsrf), "W/m2", &
171     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
172     "inst(X)", zsto, zout)
173    
174     call histdef(nid_ins, "tsol_"//clnsurf(nsrf), &
175     "Surface Temperature"//clnsurf(nsrf), "W/m2", &
176     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
177     "inst(X)", zsto, zout)
178    
179     call histdef(nid_ins, "lat_"//clnsurf(nsrf), &
180     "Latent heat flux "//clnsurf(nsrf), "W/m2", &
181     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
182     "inst(X)", zsto, zout)
183    
184     call histdef(nid_ins, "taux_"//clnsurf(nsrf), &
185     "Zonal wind stress"//clnsurf(nsrf), "Pa", &
186     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
187     "inst(X)", zsto, zout)
188    
189     call histdef(nid_ins, "tauy_"//clnsurf(nsrf), &
190     "Meridional xind stress "//clnsurf(nsrf), "Pa", &
191     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
192     "inst(X)", zsto, zout)
193    
194     call histdef(nid_ins, "albe_"//clnsurf(nsrf), &
195     "Albedo "//clnsurf(nsrf), "-", &
196     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
197     "inst(X)", zsto, zout)
198    
199     call histdef(nid_ins, "rugs_"//clnsurf(nsrf), &
200     "rugosite "//clnsurf(nsrf), "-", &
201     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
202     "inst(X)", zsto, zout)
203     !XXX
204     END DO
205     CALL histdef(nid_ins, "rugs", "rugosity", "-", &
206     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
207     "inst(X)", zsto, zout)
208    
209     CALL histdef(nid_ins, "albs", "Surface albedo", "-", &
210     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
211     "inst(X)", zsto, zout)
212    
213     CALL histdef(nid_ins, "s_pblh", "Boundary Layer Height", "m", &
214     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
215     "inst(X)", zsto, zout)
216    
217     CALL histdef(nid_ins, "s_pblt", "T at Boundary Layer Height", &
218     "K", &
219     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
220     "inst(X)", zsto, zout)
221    
222     CALL histdef(nid_ins, "s_lcl", "Condensation level", "m", &
223     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
224     "inst(X)", zsto, zout)
225    
226     CALL histdef(nid_ins, "s_capCL", "Conv avlbl pot ener for ABL", "J/m2", &
227     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
228     "inst(X)", zsto, zout)
229    
230     CALL histdef(nid_ins, "s_oliqCL", "Liq Water in BL", "kg/m2", &
231     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
232     "inst(X)", zsto, zout)
233    
234     CALL histdef(nid_ins, "s_cteiCL", "Instability criteria (ABL)", "K", &
235     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
236     "inst(X)", zsto, zout)
237    
238     CALL histdef(nid_ins, "s_therm", "Exces du thermique", "K", &
239     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
240     "inst(X)", zsto, zout)
241    
242     CALL histdef(nid_ins, "s_trmb1", "deep_cape(HBTM2)", "J/m2", &
243     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
244     "inst(X)", zsto, zout)
245    
246     CALL histdef(nid_ins, "s_trmb2", "inhibition (HBTM2)", "J/m2", &
247     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
248     "inst(X)", zsto, zout)
249    
250     CALL histdef(nid_ins, "s_trmb3", "Point Omega (HBTM2)", "m", &
251     iim, (jjm + 1), nhori, 1, 1, 1, -99, &
252     "inst(X)", zsto, zout)
253    
254 guez 183 if (conv_emanuel) CALL histdef(nid_ins, "ptop", "cloud top pressure", &
255     "Pa", iim, jjm + 1, nhori, 1, 1, 1, -99, "inst(X)", zsto, zout)
256 guez 34
257     ! Champs 3D:
258    
259     CALL histdef(nid_ins, "temp", "Temperature", "K", &
260     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
261     "inst(X)", zsto, zout)
262    
263     CALL histdef(nid_ins, "vitu", "Zonal wind", "m/s", &
264     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
265     "inst(X)", zsto, zout)
266    
267     CALL histdef(nid_ins, "vitv", "Merid wind", "m/s", &
268     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
269     "inst(X)", zsto, zout)
270    
271     CALL histdef(nid_ins, "geop", "Geopotential height", "m", &
272     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
273     "inst(X)", zsto, zout)
274    
275     CALL histdef(nid_ins, "pres", "Air pressure", "Pa", &
276     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
277     "inst(X)", zsto, zout)
278    
279     CALL histdef(nid_ins, "dtvdf", "Boundary-layer dT", "K/s", &
280     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
281     "inst(X)", zsto, zout)
282    
283     CALL histdef(nid_ins, "dqvdf", "Boundary-layer dQ", "Kg/Kg/s", &
284     iim, (jjm + 1), nhori, llm, 1, llm, nvert, &
285     "inst(X)", zsto, zout)
286    
287 guez 159 CALL histdef(nid_ins, "zmasse", "column density of air in cell", &
288     "kg m-2", iim, jjm + 1, nhori, llm, 1, llm, nvert, "inst(X)", &
289     zsto, zout)
290    
291 guez 178 CALL histdef(nid_ins, "rhum", "Relative humidity", &
292     "", iim, jjm + 1, nhori, llm, 1, llm, nvert, "inst(X)", &
293     zsto, zout)
294    
295 guez 159 DO it = 1, nqmx - 2
296     ! champ 2D
297     iq=it+2
298     CALL histdef(nid_ins, tname(iq), ttext(iq), "U/kga", iim, jjm+1, &
299     nhori, llm, 1, llm, nvert, "inst(X)", zsto, zout)
300     CALL histdef(nid_ins, "fl"//tname(iq), "Flux "//ttext(iq), &
301     "U/m2/s", iim, jjm+1, nhori, llm, 1, llm, nvert, &
302     "inst(X)", zsto, zout)
303    
304     !---Ajout Olivia
305     CALL histdef(nid_ins, "d_tr_th_"//tname(iq), &
306     "tendance thermique"// ttext(iq), "?", &
307     iim, jjm+1, nhori, llm, 1, llm, nvert, &
308     "inst(X)", zsto, zout)
309     CALL histdef(nid_ins, "d_tr_cv_"//tname(iq), &
310     "tendance convection"// ttext(iq), "?", &
311     iim, jjm+1, nhori, llm, 1, llm, nvert, &
312     "inst(X)", zsto, zout)
313     CALL histdef(nid_ins, "d_tr_cl_"//tname(iq), &
314     "tendance couche limite"// ttext(iq), "?", &
315     iim, jjm+1, nhori, llm, 1, llm, nvert, &
316     "inst(X)", zsto, zout)
317     !---fin Olivia
318    
319     ENDDO
320    
321 guez 34 CALL histend(nid_ins)
322     ENDIF
323    
324     end subroutine ini_histins
325    
326     end module ini_histins_m

  ViewVC Help
Powered by ViewVC 1.1.21