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

Contents of /trunk/dyn3d/dynredem0.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 129 - (show annotations)
Fri Feb 13 18:22:38 2015 UTC (9 years, 3 months ago) by guez
File size: 7920 byte(s)
Removed arguments day0, anne0 of procedures initdynav and
inithist. Use directly day_ref, annee_ref instead.

Moved variables annee_ref, day_ref of module temps to module
dynetat0_m. Deleted variables dayref and anneeref of module conf_gcm_m
and removed them from namelist conf_gcm_nml. These variables were
troubling intermediary on the way to annee_ref and day_ref. Gave as
default values to annee_ref and day_ref the default values of dayref
and anneeref. Moved the test on raz_date from main unit gcm to
procedure dynetat0. Created namelist dynetat0_nml. Read annee_ref and
day_ref from standard input in dynetat0 and redefine them from
"start.nc" if not raz_date. Rationale: 1 - Choose the best programming
from the point of view of program gcm only, forgetting program ce0l. 2
- The normal case is to define annee_ref and day_ref from "start.nc"
so put them in module dynetat0_m rather than in conf_gcm_m. 3 - Try to
always read the same namelists in the same order regardless of choices
in previous namelists. Downsides: 1 -We now need the file "dynetat0.f"
for the program ce0l, because dynetat0_m is used by dynredem0. 2 - We
need to define annee_ref and day_ref from procedure etat0.

Removed useless variable day_end of module temps.

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

  ViewVC Help
Powered by ViewVC 1.1.21