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

Annotation of /trunk/dyn3d/gcm.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (hide annotations)
Mon Dec 14 15:25:16 2009 UTC (14 years, 5 months ago) by guez
Original Path: trunk/libf/dyn3d/gcm.f90
File size: 6469 byte(s)
Split "orografi.f": one file for each procedure. Put the created files
in new directory "Orography".

Removed argument "vcov" of procedure "sortvarc". Removed arguments
"itau" and "time" of procedure "caldyn0". Removed arguments "itau",
"time" and "vcov" of procedure "sortvarc0".

Removed argument "time" of procedure "dynredem1". Removed NetCDF
variable "temps" in files "start.nc" and "restart.nc", because its
value is always 0.

Removed argument "nq" of procedures "iniadvtrac" and "leapfrog". The
number of "tracers read in "traceur.def" must now be equal to "nqmx",
or "nqmx" must equal 4 if there is no file "traceur.def". Replaced
variable "nq" by constant "nqmx" in "leapfrog".

NetCDF variable for ozone field in "coefoz.nc" must now be called
"tro3" instead of "r".

Fixed bug in "zenang".

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

  ViewVC Help
Powered by ViewVC 1.1.21