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

Contents of /trunk/dyn3d/gcm.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 27 - (show annotations)
Thu Mar 25 14:29:07 2010 UTC (14 years, 1 month ago) by guez
Original Path: trunk/libf/dyn3d/gcm.f90
File size: 6231 byte(s)
"dyn3d" and "filtrez" do not contain any included file so make rules
have been updated.

"comdissip.f90" was useless, removed it.

"dynredem0" wrote undefined value in "controle(31)", that was
overwritten by "dynredem1". Now "dynredem0" just writes 0 to
"controle(31)".

Removed arguments of "inidissip". "inidissip" now accesses the
variables by use association.

In program "etat0_lim", "itaufin" is not defined so "dynredem1" wrote
undefined value to "controle(31)". Added argument "itau" of
"dynredem1" to correct that.

"itaufin" does not need to be a module variable (of "temps"), made it
a local variable of "leapfrog".

Removed calls to "diagedyn" from "leapfrog".

1 PROGRAM gcm
2
3 ! General circulation model of LMD
4
5 ! From "gcm.F", version 1.4, 2006/04/04 15:05:16
6
7 ! Avec coordonnées verticales hybrides, avec nouveaux opérateurs de
8 ! dissipation * (gradiv2, divgrad2, nxgraro2)
9
10 ! Authors: P. Le Van, L. Fairhead, F. Hourdin
11
12 ! Possibilité de choisir le schéma pour l'advection de "q", en
13 ! modifiant "iadv" dans "traceur.def".
14
15 ! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4
16 ! Pour Van-Leer : iadv=10
17
18 use abort_gcm_m, only: abort_gcm
19 use clesphys2, only: read_clesphys2
20 use com_io_dyn, only: histid, histvid, histaveid
21 use comconst, only: daysec, cpp, dtvr, g, rad, r, initialize
22 use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv
23 use conf_gcm_m, only: day_step, iperiod, anneeref, dayref, iecri, iphysiq, &
24 nday, raz_date, periodav, conf_gcm
25 use dimens_m, only: iim, jjm, llm, nqmx
26 use dimphy, only: klon
27 use dynetat0_m, only: dynetat0, day_ini
28 use dynredem0_m, only: dynredem0
29 use grid_change, only: dyn_phy, init_dyn_phy
30 use iniadvtrac_m, only: iniadvtrac
31 use inidissip_m, only: inidissip
32 use inigeom_m, only: inigeom
33 use initdynav_m, only: initdynav
34 use inithist_m, only: inithist
35 USE IOIPSL, only: ioconf_calendar, histclo
36 use leapfrog_m, only: leapfrog
37 use logic, only: iflag_phys
38 use paramet_m, only: ip1jm, ip1jmp1
39 use temps, only: day_ref, annee_ref, day_end, itau_dyn
40 use tracstoke, only: istdyn, istphy
41
42 IMPLICIT NONE
43
44 REAL zdtvr ! time step for dynamics, in s
45
46 ! Variables dynamiques :
47 REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) ! vents covariants
48 REAL teta(ip1jmp1, llm) ! température potentielle
49 REAL q(ip1jmp1, llm, nqmx) ! champs advectés
50 REAL ps(ip1jmp1) ! pression au sol (Pa)
51
52 REAL masse(ip1jmp1, llm) ! masse d'air
53 REAL phis(iim + 1, jjm + 1) ! géopotentiel au sol
54
55 ! Variables pour le fichier histoire :
56 REAL time_0 ! time in day, as a fraction of day, in [0, 1[
57
58 ! Calendrier :
59 LOGICAL:: true_calendar = .false. ! default value
60
61 ! Variables pour l'initialisation de la physique :
62 REAL zcufi(klon), zcvfi(klon) ! "cu" and "cv" values on the scalar grid
63 REAL latfi(klon), lonfi(klon)
64 REAL airefi(klon)
65
66 logical mask_v(iim + 1, jjm)
67 ! (mask for points in the "v" grid, first index is for longitude,
68 ! second index is for latitude)
69
70 namelist /main_nml/true_calendar
71
72 !------------------------------------------------------------
73
74 print *, "Enter namelist 'main_nml'."
75 read (unit=*, nml=main_nml)
76 write(unit=*, nml=main_nml)
77
78 ! Initialisations:
79 call initialize
80
81 ! Choix du calendrier :
82 if (true_calendar) then
83 call ioconf_calendar('gregorian')
84 else
85 call ioconf_calendar('360d')
86 endif
87
88 ! Lecture des fichiers "gcm.def" ou "run.def" :
89 call read_clesphys2
90 CALL conf_gcm
91
92 ! Initialisation des traceurs
93 ! Choix du schéma pour l'advection dans le fichier "traceur.def" ou via INCA
94 call iniadvtrac
95
96 ! Lecture du fichier "start.nc" :
97 CALL dynetat0(vcov, ucov, teta, q, masse, ps, phis, time_0)
98
99 ! Lecture des paramètres de contrôle pour la simulation :
100 ! on recalcule éventuellement le pas de temps
101 IF (MOD(day_step, iperiod) /= 0) THEN
102 call abort_gcm(modname = "gcm", message = &
103 'Il faut choisir un nombre de pas par jour multiple de "iperiod".', &
104 ierr = 1)
105 ENDIF
106
107 IF (MOD(day_step,iphysiq)/=0) THEN
108 call abort_gcm(modname = "gcm", message = &
109 'Il faut choisir un nombre de pas par jour multiple de "iphysiq".', &
110 ierr = 1)
111 ENDIF
112
113 ! On remet le calendrier à zero si demandé:
114 if (annee_ref /= anneeref .or. day_ref /= dayref) then
115 print *, 'Attention : les dates initiales lues dans le fichier ' // &
116 '"start" ne correspondent pas à celles lues dans "gcm.def".'
117 if (raz_date) then
118 print *, 'On réinitialise à la date lue dans "gcm.def".'
119 annee_ref = anneeref
120 day_ref = dayref
121 day_ini = dayref
122 itau_dyn = 0
123 time_0 = 0.
124 else
125 print *, 'On garde les dates du fichier "start".'
126 endif
127 ELSE
128 raz_date = .false.
129 endif
130
131 ! Initialisation des constantes dynamiques :
132 zdtvr = daysec / REAL(day_step)
133 IF (dtvr /= zdtvr) THEN
134 print *, 'Warning: the time steps in the ".def" file and in ' // &
135 '"start.nc" are different'
136 print *, 'dtvr (from "start.nc") = ', dtvr
137 print *, 'zdtvr (from ".def") = ', zdtvr
138 print *, 'Using the value from the ".def" file.'
139 dtvr = zdtvr
140 ENDIF
141 CALL iniconst
142
143 ! Initialisation de la géometrie :
144 CALL inigeom
145
146 ! Initialisation du filtre :
147 CALL inifilr
148
149 CALL inidissip
150 call init_dyn_phy
151
152 ! Initialisation de la physique :
153 IF (iflag_phys == 1) THEN
154 latfi(1)=rlatu(1)
155 latfi(2:klon-1) = pack(spread(rlatu(2:jjm), 1, iim), .true.)
156 latfi(klon)= rlatu(jjm + 1)
157
158 lonfi(1)=0.
159 lonfi(2:klon-1) = pack(spread(rlonv(:iim), 2, jjm - 1), .true.)
160 lonfi(klon)= 0.
161
162 zcufi = pack(cu_2d, dyn_phy)
163
164 ! Construct a mask for points in the "v" grid:
165 mask_v = .true.
166 mask_v(2:, 1) = .false.
167 mask_v(iim + 1, 2:) = .false.
168
169 zcvfi(:klon - 1) = pack(cv_2d, mask_v)
170 zcvfi(klon) = cv_2d(1, jjm)
171 ! (that value of "cv_2d" is used twice in "zcvfi")
172
173 airefi = pack(aire_2d, dyn_phy)
174 print *, 'Attention : vitesse verticale nulle dans la physique.'
175 CALL iniphysiq(klon, llm, latfi, lonfi, airefi, &
176 zcufi, zcvfi, rad, g, r, cpp)
177 ENDIF
178
179 ! Initialisation des entrées-sorties :
180 day_end = day_ini + nday
181 print *, "day_ini = ", day_ini
182 print *, "day_end = ", day_end
183
184 CALL dynredem0("restart.nc", day_end, phis)
185 CALL inithist(day_ref, annee_ref, zdtvr, nqmx, histid, histvid, &
186 t_ops = iecri * daysec, t_wrt = iecri * daysec)
187 CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, &
188 t_ops = iperiod * zdtvr, t_wrt = periodav * daysec)
189
190 ! Choix des fréquences de stockage pour le hors-ligne :
191 istdyn = day_step / 4 ! stockage toutes les 6 h = 1 jour / 4
192 istphy = istdyn / iphysiq
193
194 ! Intégration temporelle du modèle :
195 CALL leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0)
196
197 call histclo
198 print *, 'Simulation finished'
199 print *, 'Everything is cool'
200
201 END PROGRAM gcm

  ViewVC Help
Powered by ViewVC 1.1.21