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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 157 - (show annotations)
Mon Jul 20 16:01:49 2015 UTC (8 years, 10 months ago) by guez
File size: 6713 byte(s)
Just encapsulated SUBROUTINE vlsplt in a module and cleaned it.

In procedure vlx, local variables dxqu and adxqu only need indices
iip2:ip1jm. Otherwise, just cleaned vlx.

Procedures dynredem0 and dynredem1 no longer have argument fichnom,
they just operate on a file named "restart.nc". The programming
guideline here is that gcm should not be more complex than it needs by
itself, other programs (ce0l etc.) just have to adapt to gcm. So ce0l
now creates files "restart.nc" and "restartphy.nc".

In order to facilitate decentralizing the writing of "restartphy.nc",
created a procedure phyredem0 out of phyredem. phyredem0 creates the
NetCDF header of "restartphy.nc" while phyredem writes the NetCDF
variables. As the global attribute itau_phy needs to be filled in
phyredem0, at the beginnig of the run, we must compute its value
instead of just using itap. So we have a dummy argument lmt_pas of
phyredem0. Also, the ncid of "startphy.nc" is upgraded from local
variable of phyetat0 to dummy argument. phyetat0 no longer closes
"startphy.nc".

Following the same decentralizing objective, the ncid of "restart.nc"
is upgraded from local variable of dynredem0 to module variable of
dynredem0_m. "restart.nc" is not closed at the end of dynredem0 nor
opened at the beginning of dynredem1.

In procedure etat0, instead of creating many vectors of size klon
which will be filled with zeroes, just create one array null_array.

In procedure phytrac, instead of writing trs(: 1) to a text file,
write it to "restartphy.nc" (following LMDZ). This is better because
now trs(: 1) is next to its coordinates. We can write to
"restartphy.nc" from phytrac directly, and not add trs(: 1) to the
long list of variables in physiq, thanks to the decentralizing of
"restartphy.nc".

In procedure phyetat0, we no longer write to standard output the
minimum and maximum values of read arrays. It is ok to check input and
abort on invalid values but just printing statistics on input seems too
much useless computation and out of place clutter.

1 module phyredem_m
2
3 IMPLICIT NONE
4
5 contains
6
7 SUBROUTINE phyredem(pctsrf, tsol, tsoil, tslab, seaice, qsurf, qsol, snow, &
8 albedo, evap, rain_fall, snow_fall, solsw, sollw, fder, radsol, frugs, &
9 agesno, zmea, zstd, zsig, zgam, zthe, zpic, zval, t_ancien, q_ancien, &
10 rnebcon, ratqs, clwcon, run_off_lic_0, sig1, w01)
11
12 ! From phylmd/phyredem.F, version 1.3, 2005/05/25 13:10:09
13 ! Author: Z. X. Li (LMD/CNRS)
14 ! Date: 1993/08/18
15
16 ! Objet : \'ecriture de l'\'etat de d\'emarrage ou red\'emarrage
17 ! pour la physique
18
19 USE dimphy, ONLY: klev, klon, zmasq
20 USE indicesol, ONLY: is_lic, is_oce, is_sic, is_ter, nbsrf
21 USE netcdf95, ONLY: nf95_inq_varid, nf95_put_var, nf95_close
22 use phyredem0_m, only: ncid_restartphy
23
24 REAL, INTENT(IN):: pctsrf(:, :) ! (klon, nbsrf)
25 REAL, INTENT(IN):: tsol(:, :) ! (klon, nbsrf)
26 REAL, INTENT(IN):: tsoil(:, :, :) ! (klon, nsoilmx, nbsrf)
27 REAL, INTENT(IN):: tslab(:), seaice(:) ! (klon) slab ocean
28 REAL, INTENT(IN):: qsurf(:, :) ! (klon, nbsrf)
29
30 REAL, intent(in):: qsol(:) ! (klon)
31 ! column-density of water in soil, in kg m-2
32
33 REAL, INTENT(IN):: snow(klon, nbsrf)
34 REAL, INTENT(IN):: albedo(klon, nbsrf)
35 REAL, INTENT(IN):: evap(klon, nbsrf)
36 REAL, INTENT(IN):: rain_fall(klon)
37 REAL, INTENT(IN):: snow_fall(klon)
38 REAL, INTENT(IN):: solsw(klon)
39 REAL, INTENT(IN):: sollw(klon)
40 REAL, INTENT(IN):: fder(klon)
41 REAL, INTENT(IN):: radsol(klon)
42 REAL, INTENT(IN):: frugs(klon, nbsrf)
43 REAL, INTENT(IN):: agesno(klon, nbsrf)
44 REAL, INTENT(IN):: zmea(klon)
45 REAL, intent(in):: zstd(klon)
46 REAL, intent(in):: zsig(klon)
47 REAL, intent(in):: zgam(klon)
48 REAL, intent(in):: zthe(klon)
49 REAL, intent(in):: zpic(klon)
50 REAL, intent(in):: zval(klon)
51 REAL, intent(in):: t_ancien(klon, klev), q_ancien(klon, klev)
52 REAL, intent(in):: rnebcon(klon, klev), ratqs(klon, klev)
53 REAL, intent(in):: clwcon(klon, klev)
54 REAL, intent(in):: run_off_lic_0(klon)
55 real, intent(in):: sig1(klon, klev) ! section adiabatic updraft
56
57 real, intent(in):: w01(klon, klev)
58 ! vertical velocity within adiabatic updraft
59
60 ! Local:
61 integer varid
62
63 !------------------------------------------------------------
64
65 PRINT *, 'Call sequence information: phyredem'
66
67 call nf95_inq_varid(ncid_restartphy, "masque", varid)
68 call nf95_put_var(ncid_restartphy, varid, zmasq)
69
70 call nf95_inq_varid(ncid_restartphy, "FTER", varid)
71 call nf95_put_var(ncid_restartphy, varid, pctsrf(:, is_ter))
72
73 call nf95_inq_varid(ncid_restartphy, "FLIC", varid)
74 call nf95_put_var(ncid_restartphy, varid, pctsrf(:, is_lic))
75
76 call nf95_inq_varid(ncid_restartphy, "FOCE", varid)
77 call nf95_put_var(ncid_restartphy, varid, pctsrf(:, is_oce))
78
79 call nf95_inq_varid(ncid_restartphy, "FSIC", varid)
80 call nf95_put_var(ncid_restartphy, varid, pctsrf(:, is_sic))
81
82 call nf95_inq_varid(ncid_restartphy, "TS", varid)
83 call nf95_put_var(ncid_restartphy, varid, tsol)
84
85 call nf95_inq_varid(ncid_restartphy, "Tsoil", varid)
86 call nf95_put_var(ncid_restartphy, varid, tsoil)
87
88 call nf95_inq_varid(ncid_restartphy, "TSLAB", varid)
89 call nf95_put_var(ncid_restartphy, varid, tslab)
90
91 call nf95_inq_varid(ncid_restartphy, "SEAICE", varid)
92 call nf95_put_var(ncid_restartphy, varid, seaice)
93
94 call nf95_inq_varid(ncid_restartphy, "QS", varid)
95 call nf95_put_var(ncid_restartphy, varid, qsurf)
96
97 call nf95_inq_varid(ncid_restartphy, "QSOL", varid)
98 call nf95_put_var(ncid_restartphy, varid, qsol)
99
100 call nf95_inq_varid(ncid_restartphy, "ALBE", varid)
101 call nf95_put_var(ncid_restartphy, varid, albedo)
102
103 call nf95_inq_varid(ncid_restartphy, "EVAP", varid)
104 call nf95_put_var(ncid_restartphy, varid, evap)
105
106 call nf95_inq_varid(ncid_restartphy, "SNOW", varid)
107 call nf95_put_var(ncid_restartphy, varid, snow)
108
109 call nf95_inq_varid(ncid_restartphy, "RADS", varid)
110 call nf95_put_var(ncid_restartphy, varid, radsol)
111
112 call nf95_inq_varid(ncid_restartphy, "solsw", varid)
113 call nf95_put_var(ncid_restartphy, varid, solsw)
114
115 call nf95_inq_varid(ncid_restartphy, "sollw", varid)
116 call nf95_put_var(ncid_restartphy, varid, sollw)
117
118 call nf95_inq_varid(ncid_restartphy, "fder", varid)
119 call nf95_put_var(ncid_restartphy, varid, fder)
120
121 call nf95_inq_varid(ncid_restartphy, "rain_f", varid)
122 call nf95_put_var(ncid_restartphy, varid, rain_fall)
123
124 call nf95_inq_varid(ncid_restartphy, "snow_f", varid)
125 call nf95_put_var(ncid_restartphy, varid, snow_fall)
126
127 call nf95_inq_varid(ncid_restartphy, "RUG", varid)
128 call nf95_put_var(ncid_restartphy, varid, frugs)
129
130 call nf95_inq_varid(ncid_restartphy, "AGESNO", varid)
131 call nf95_put_var(ncid_restartphy, varid, agesno)
132
133 call nf95_inq_varid(ncid_restartphy, "ZMEA", varid)
134 call nf95_put_var(ncid_restartphy, varid, zmea)
135
136 call nf95_inq_varid(ncid_restartphy, "ZSTD", varid)
137 call nf95_put_var(ncid_restartphy, varid, zstd)
138
139 call nf95_inq_varid(ncid_restartphy, "ZSIG", varid)
140 call nf95_put_var(ncid_restartphy, varid, zsig)
141
142 call nf95_inq_varid(ncid_restartphy, "ZGAM", varid)
143 call nf95_put_var(ncid_restartphy, varid, zgam)
144
145 call nf95_inq_varid(ncid_restartphy, "ZTHE", varid)
146 call nf95_put_var(ncid_restartphy, varid, zthe)
147
148 call nf95_inq_varid(ncid_restartphy, "ZPIC", varid)
149 call nf95_put_var(ncid_restartphy, varid, zpic)
150
151 call nf95_inq_varid(ncid_restartphy, "ZVAL", varid)
152 call nf95_put_var(ncid_restartphy, varid, zval)
153
154 call nf95_inq_varid(ncid_restartphy, "TANCIEN", varid)
155 call nf95_put_var(ncid_restartphy, varid, t_ancien)
156
157 call nf95_inq_varid(ncid_restartphy, "QANCIEN", varid)
158 call nf95_put_var(ncid_restartphy, varid, q_ancien)
159
160 call nf95_inq_varid(ncid_restartphy, "RUGMER", varid)
161 call nf95_put_var(ncid_restartphy, varid, frugs(:, is_oce))
162
163 call nf95_inq_varid(ncid_restartphy, "CLWCON", varid)
164 call nf95_put_var(ncid_restartphy, varid, clwcon(:, 1))
165
166 call nf95_inq_varid(ncid_restartphy, "RNEBCON", varid)
167 call nf95_put_var(ncid_restartphy, varid, rnebcon(:, 1))
168
169 call nf95_inq_varid(ncid_restartphy, "RATQS", varid)
170 call nf95_put_var(ncid_restartphy, varid, ratqs(:, 1))
171
172 call nf95_inq_varid(ncid_restartphy, "RUNOFFLIC0", varid)
173 call nf95_put_var(ncid_restartphy, varid, run_off_lic_0)
174
175 call nf95_inq_varid(ncid_restartphy, "sig1", varid)
176 call nf95_put_var(ncid_restartphy, varid, sig1)
177
178 call nf95_inq_varid(ncid_restartphy, "w01", varid)
179 call nf95_put_var(ncid_restartphy, varid, w01)
180
181 call nf95_close(ncid_restartphy)
182
183 END SUBROUTINE phyredem
184
185 end module phyredem_m

  ViewVC Help
Powered by ViewVC 1.1.21