/[lmdze]/trunk/dyn3d/dynredem0.f
ViewVC logotype

Contents of /trunk/dyn3d/dynredem0.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 139 - (show annotations)
Tue May 26 17:46:03 2015 UTC (9 years ago) by guez
Original Path: trunk/Sources/dyn3d/dynredem0.f
File size: 8503 byte(s)
dynetat0 read rlonu, rlatu, rlonv, rlatv, cu_2d, cv_2d, aire_2d from
"start.nc" and then these variables were overwritten by
inigeom. Corrected this. Now, inigeom does not compute rlonu, rlatu,
rlonv and rlatv. Moreover, cu_2d, cv_2d, aire_2d are not written to
"restart.nc". Since xprimu, xprimv, xprimm025, xprimp025, rlatu1,
rlatu2, yprimu1, yprimu2 are computed at the same time as rlonu,
rlatu, rlonv, rlatv, and since it would not be convenient to separate
those computations, we decide to write xprimu, xprimv, xprimm025,
xprimp025, rlatu1, rlatu2, yprimu1, yprimu2 into "restart.nc", read
them from "start.nc" and not compute them in inigeom. So, in summary,
"start.nc" contains all the coordinates and their derivatives, and
inigeom only computes the 2D-variables.

Technical details:

Moved variables rlatu, rlonv, rlonu, rlatv, xprimu, xprimv from module
comgeom to module dynetat0_m. Upgraded local variables rlatu1,
yprimu1, rlatu2, yprimu2, xprimm025, xprimp025 of procedure inigeom to
variables of module dynetat0_m.

Removed unused local variable yprimu of procedure inigeom and
corresponding argument yyprimu of fyhyp.

Moved variables clat, clon, grossismx, grossismy, dzoomx, dzoomy,
taux, tauy from module serre to module dynetat0_m (since they are read
from "start.nc"). The default values are now defined in read_serre
instead of in the declarations. Changed name of module serre to
read_serre_m, no more module variable here.

The calls to fxhyp and fyhyp are moved from inigeom to etat0.

Side effects in programs other than gcm: etat0 and read_serre write
variables of module dynetat0; the programs test_fxyp and
test_inter_barxy need more source files.

Removed unused arguments len and nd of cv3_tracer. Removed unused
argument PPSOL of LWU.

Bug fix in test_inter_barxy: forgotten call to read_serre.

1 MODULE dynredem0_m
2
3 IMPLICIT NONE
4
5 CONTAINS
6
7 SUBROUTINE dynredem0(fichnom, iday_end, phis)
8
9 ! From dyn3d/dynredem.F, version 1.2, 2004/06/22 11:45:30
10 ! \'Ecriture du fichier de red\'emarrage au format NetCDF (initialisation)
11
12 USE comconst, ONLY: cpp, daysec, dtvr, g, kappa, omeg, rad
13 USE dimens_m, ONLY: iim, jjm, llm, nqmx
14 USE disvert_m, ONLY: ap, bp, pa, preff, presnivs
15 use dynetat0_m, only: day_ref, annee_ref, clat, clon, dzoomx, dzoomy, &
16 grossismx, grossismy, taux, tauy, rlatu, rlatv, rlonu, rlonv, rlatu1, &
17 rlatu2, yprimu1, yprimu2, xprimp025, xprimm025, xprimu, xprimv
18 USE ener, ONLY: ang0, etot0, ptot0, stot0, ztot0
19 USE iniadvtrac_m, ONLY: tname, ttext
20 USE ju2ymds_m, ONLY: ju2ymds
21 USE netcdf, ONLY: nf90_clobber, nf90_float, nf90_global, nf90_unlimited
22 USE netcdf95, ONLY: nf95_close, nf95_create, nf95_def_dim, nf95_def_var, &
23 nf95_enddef, nf95_inq_varid, nf95_put_att, nf95_put_var
24 USE paramet_m, ONLY: iip1, jjp1, llmp1
25 use ymds2ju_m, only: ymds2ju
26
27 CHARACTER(len=*), INTENT(IN):: fichnom
28 INTEGER, INTENT(IN):: iday_end
29 REAL, INTENT(IN):: phis(:, :)
30
31 ! Local:
32
33 INTEGER iq
34 INTEGER, PARAMETER:: length = 100
35 REAL tab_cntrl(length) ! tableau des param\`etres du run
36
37 ! Pour NetCDF :
38 INTEGER idim_index
39 INTEGER idim_rlonu, idim_rlonv, idim_rlatu, idim_rlatv
40 INTEGER idim_s, idim_sig
41 INTEGER dimid_temps
42 INTEGER ncid, varid
43
44 REAL zjulian, hours
45 INTEGER yyears0, jjour0, mmois0
46 CHARACTER(len=30) unites
47
48 !-----------------------------------------------------------------------
49
50 PRINT *, 'Call sequence information: dynredem0'
51
52 CALL ymds2ju(annee_ref, 1, iday_end, 0., zjulian)
53 CALL ju2ymds(zjulian, yyears0, mmois0, jjour0, hours)
54
55 tab_cntrl(1) = iim
56 tab_cntrl(2) = jjm
57 tab_cntrl(3) = llm
58 tab_cntrl(4) = day_ref
59 tab_cntrl(5) = annee_ref
60 tab_cntrl(6) = rad
61 tab_cntrl(7) = omeg
62 tab_cntrl(8) = g
63 tab_cntrl(9) = cpp
64 tab_cntrl(10) = kappa
65 tab_cntrl(11) = daysec
66 tab_cntrl(12) = dtvr
67 tab_cntrl(13) = etot0
68 tab_cntrl(14) = ptot0
69 tab_cntrl(15) = ztot0
70 tab_cntrl(16) = stot0
71 tab_cntrl(17) = ang0
72 tab_cntrl(18) = pa
73 tab_cntrl(19) = preff
74
75 ! Param\`etres pour le zoom :
76 tab_cntrl(20) = clon
77 tab_cntrl(21) = clat
78 tab_cntrl(22) = grossismx
79 tab_cntrl(23) = grossismy
80 tab_cntrl(24) = 1.
81 tab_cntrl(25) = dzoomx
82 tab_cntrl(26) = dzoomy
83 tab_cntrl(27) = 0.
84 tab_cntrl(28) = taux
85 tab_cntrl(29) = tauy
86
87 tab_cntrl(30) = iday_end
88 tab_cntrl(31:) = 0.
89
90 CALL nf95_create(fichnom, nf90_clobber, ncid)
91 CALL nf95_put_att(ncid, nf90_global, 'title', &
92 'start file for the dynamics code')
93
94 ! Definir les dimensions du fichiers:
95
96 CALL nf95_def_dim(ncid, 'index', length, idim_index)
97 CALL nf95_def_dim(ncid, 'rlonu', iip1, idim_rlonu)
98 CALL nf95_def_dim(ncid, 'rlatu', jjp1, idim_rlatu)
99 CALL nf95_def_dim(ncid, 'rlonv', iip1, idim_rlonv)
100 CALL nf95_def_dim(ncid, 'rlatv', jjm, idim_rlatv)
101 CALL nf95_def_dim(ncid, 'sigs', llm, idim_s)
102 CALL nf95_def_dim(ncid, 'sig', llmp1, idim_sig)
103 CALL nf95_def_dim(ncid, 'temps', nf90_unlimited, dimid_temps)
104
105 ! Definir et enregistrer certains champs invariants:
106
107 CALL nf95_def_var(ncid, 'controle', nf90_float, idim_index, varid)
108 CALL nf95_put_att(ncid, varid, 'title', 'Parametres de controle')
109
110 CALL nf95_def_var(ncid, 'rlonu', nf90_float, idim_rlonu, varid)
111 CALL nf95_put_att(ncid, varid, 'title', 'Longitudes des points U')
112
113 CALL nf95_def_var(ncid, 'rlatu', nf90_float, idim_rlatu, varid)
114 CALL nf95_put_att(ncid, varid, 'title', 'Latitudes des points U')
115
116 CALL nf95_def_var(ncid, 'rlonv', nf90_float, idim_rlonv, varid)
117 CALL nf95_put_att(ncid, varid, 'title', 'Longitudes des points V')
118
119 CALL nf95_def_var(ncid, 'rlatv', nf90_float, idim_rlatv, varid)
120 CALL nf95_put_att(ncid, varid, 'title', 'Latitudes des points V')
121
122 CALL nf95_def_var(ncid, 'xprimu', nf90_float, idim_rlonu, varid)
123 CALL nf95_put_att(ncid, varid, 'title', 'dx / dX aux points u')
124
125 CALL nf95_def_var(ncid, 'xprimv', nf90_float, idim_rlonv, varid)
126 CALL nf95_put_att(ncid, varid, 'title', 'dx / dX aux points v')
127
128 CALL nf95_def_var(ncid, 'xprimm025', nf90_float, idim_rlonu, varid)
129 CALL nf95_def_var(ncid, 'xprimp025', nf90_float, idim_rlonu, varid)
130
131 CALL nf95_def_var(ncid, 'rlatu1', nf90_float, idim_rlatv, varid)
132 CALL nf95_def_var(ncid, 'rlatu2', nf90_float, idim_rlatv, varid)
133 CALL nf95_def_var(ncid, 'yprimu1', nf90_float, idim_rlatv, varid)
134 CALL nf95_def_var(ncid, 'yprimu2', nf90_float, idim_rlatv, varid)
135
136 CALL nf95_def_var(ncid, 'ap', nf90_float, idim_sig, varid)
137 CALL nf95_put_att(ncid, varid, 'title', 'Coefficient A pour hybride')
138
139 CALL nf95_def_var(ncid, 'bp', nf90_float, idim_sig, varid)
140 CALL nf95_put_att(ncid, varid, 'title', 'Coefficient B pour hybride')
141
142 CALL nf95_def_var(ncid, 'presnivs', nf90_float, idim_s, varid)
143
144 ! Geopentiel au sol:
145
146 CALL nf95_def_var(ncid, 'phisinit', nf90_float, &
147 (/idim_rlonv, idim_rlatu/), varid)
148 CALL nf95_put_att(ncid, varid, 'title', 'Geopotentiel au sol')
149
150 ! Definir les variables pour pouvoir les enregistrer plus tard:
151
152 CALL nf95_def_var(ncid, 'temps', nf90_float, dimid_temps, varid)
153 CALL nf95_put_att(ncid, varid, 'title', 'Temps de simulation')
154 WRITE(unites, fmt = 200) yyears0, mmois0, jjour0
155 200 FORMAT ('days since ', I4, '-', I2.2, '-', I2.2, ' 00:00:00')
156 CALL nf95_put_att(ncid, varid, 'units', unites)
157
158 CALL nf95_def_var(ncid, 'ucov', nf90_float, &
159 (/idim_rlonu, idim_rlatu, idim_s, dimid_temps/), varid)
160 CALL nf95_put_att(ncid, varid, 'title', 'Vitesse U')
161
162 CALL nf95_def_var(ncid, 'vcov', nf90_float, &
163 (/idim_rlonv, idim_rlatv, idim_s, dimid_temps/), varid)
164 CALL nf95_put_att(ncid, varid, 'title', 'Vitesse V')
165
166 CALL nf95_def_var(ncid, 'teta', nf90_float, &
167 (/idim_rlonv, idim_rlatu, idim_s, dimid_temps/), varid)
168 CALL nf95_put_att(ncid, varid, 'title', 'Temperature')
169
170 DO iq = 1, nqmx
171 CALL nf95_def_var(ncid, tname(iq), nf90_float, &
172 (/idim_rlonv, idim_rlatu, idim_s, dimid_temps/), varid)
173 CALL nf95_put_att(ncid, varid, 'title', ttext(iq))
174 END DO
175
176 CALL nf95_def_var(ncid, 'masse', nf90_float, &
177 (/idim_rlonv, idim_rlatu, idim_s, dimid_temps/), varid)
178 CALL nf95_put_att(ncid, varid, 'title', 'C est quoi ?')
179
180 CALL nf95_def_var(ncid, 'ps', nf90_float, &
181 (/idim_rlonv, idim_rlatu, dimid_temps/), varid)
182 CALL nf95_put_att(ncid, varid, 'title', 'Pression au sol')
183
184 CALL nf95_enddef(ncid)
185
186 CALL nf95_inq_varid(ncid, 'controle', varid)
187 CALL nf95_put_var(ncid, varid, tab_cntrl)
188
189 CALL nf95_inq_varid(ncid, 'rlonu', varid)
190 CALL nf95_put_var(ncid, varid, rlonu)
191
192 CALL nf95_inq_varid(ncid, 'rlatu', varid)
193 CALL nf95_put_var(ncid, varid, rlatu)
194
195 CALL nf95_inq_varid(ncid, 'rlonv', varid)
196 CALL nf95_put_var(ncid, varid, rlonv)
197
198 CALL nf95_inq_varid(ncid, 'rlatv', varid)
199 CALL nf95_put_var(ncid, varid, rlatv)
200
201 CALL nf95_inq_varid(ncid, 'xprimu', varid)
202 CALL nf95_put_var(ncid, varid, xprimu)
203
204 CALL nf95_inq_varid(ncid, 'xprimv', varid)
205 CALL nf95_put_var(ncid, varid, xprimv)
206
207 CALL nf95_inq_varid(ncid, 'xprimm025', varid)
208 CALL nf95_put_var(ncid, varid, xprimm025)
209
210 CALL nf95_inq_varid(ncid, 'xprimp025', varid)
211 CALL nf95_put_var(ncid, varid, xprimp025)
212
213 call NF95_INQ_VARID (ncid, "rlatu1", varid)
214 call NF95_PUT_VAR(ncid, varid, rlatu1)
215
216 call NF95_INQ_VARID (ncid, "rlatu2", varid)
217 call NF95_PUT_VAR(ncid, varid, rlatu2)
218
219 CALL nf95_inq_varid(ncid, 'yprimu1', varid)
220 CALL nf95_put_var(ncid, varid, yprimu1)
221
222 CALL nf95_inq_varid(ncid, 'yprimu2', varid)
223 CALL nf95_put_var(ncid, varid, yprimu2)
224
225 CALL nf95_inq_varid(ncid, 'ap', varid)
226 CALL nf95_put_var(ncid, varid, ap)
227
228 CALL nf95_inq_varid(ncid, 'bp', varid)
229 CALL nf95_put_var(ncid, varid, bp)
230
231 CALL nf95_inq_varid(ncid, 'presnivs', varid)
232 CALL nf95_put_var(ncid, varid, presnivs)
233
234 CALL nf95_inq_varid(ncid, 'phisinit', varid)
235 CALL nf95_put_var(ncid, varid, phis)
236
237 CALL nf95_close(ncid)
238
239 PRINT *, 'iim, jjm, llm, iday_end', iim, jjm, llm, iday_end
240 PRINT *, 'rad, omeg, g, cpp, kappa', rad, omeg, g, cpp, kappa
241
242 END SUBROUTINE dynredem0
243
244 END MODULE dynredem0_m

  ViewVC Help
Powered by ViewVC 1.1.21