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

Contents of /trunk/dyn3d/gcm.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13 - (show annotations)
Fri Jul 25 19:59:34 2008 UTC (15 years, 9 months ago) by guez
Original Path: trunk/libf/dyn3d/gcm.f90
File size: 6522 byte(s)
-- Minor change of behaviour:

"etat0" does not compute "rugsrel" nor "radpas". Deleted arguments
"radpas" and "rugsrel" of "phyredem". Deleted argument "rugsrel" of
"phyetat0". "startphy.nc" does not contain the variable "RUGSREL". In
"physiq", "rugoro" is set to 0 if not "ok_orodr". The whole program
"etat0_lim" does not use "clesphys2".

-- Minor modification of input/output:

Created subroutine "read_clesphys2". Variables of "clesphys2" are read
in "read_clesphys2" instead of "conf_gcm". "printflag" does not print
variables of "clesphys2".

-- Should not change any result at run time:

References to module "numer_rec" instead of individual modules of
"Numer_rec_Lionel".

Deleted argument "clesphy0" of "calfis", "physiq", "conf_gcm",
"leapfrog", "phyetat0". Deleted variable "clesphy0" in
"gcm". "phyetat0" does not modify variables of "clesphys2".

The program unit "gcm" does not modify "itau_phy".

Added some "intent" attributes.

"regr11_lint" does not call "polint".

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

  ViewVC Help
Powered by ViewVC 1.1.21