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

Contents of /trunk/dyn3d/dynredem0.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 138 - (show annotations)
Fri May 22 23:13:19 2015 UTC (9 years ago) by guez
Original Path: trunk/Sources/dyn3d/dynredem0.f
File size: 7898 byte(s)
Moved variable nb_files from module histcom_var to module
histbeg_totreg_m.

Removed unused argument q of writehist.

No history file is created in program ce0l so there is no need to call
histclo in etat0.

In phyredem, access variables rlat and rlon directly from module
phyetat0_m instead of having them as arguments. This is clearer for
the program gcm. There are bad side effects for the program ce0l: we
have to modify the module variables rlat and rlon in procedure etat0,
and we need the additional file phyetat0.f to compile ce0l.

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

  ViewVC Help
Powered by ViewVC 1.1.21