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

Annotation of /trunk/dyn3d/gcm.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (hide annotations)
Fri Apr 18 14:45:53 2008 UTC (16 years ago) by guez
Original Path: trunk/libf/dyn3d/gcm.f90
File size: 6533 byte(s)
Added NetCDF directory "/home/guez/include" in "g95.mk" and
"nag_tools.mk".

Added some "intent" attributes in "PVtheta", "advtrac", "caladvtrac",
"calfis", "diagedyn", "dissip", "vlspltqs", "aeropt", "ajsec",
"calltherm", "clmain", "cltrac", "cltracrn", "concvl", "conema3",
"conflx", "fisrtilp", "newmicro", "nuage", "diagcld1", "diagcld2",
"drag_noro", "lift_noro", "SUGWD", "physiq", "phytrac", "radlwsw", "thermcell".

Removed the case "ierr == 0" in "abort_gcm"; moved call to "histclo"
and messages for end of run from "abort_gcm" to "gcm"; replaced call
to "abort_gcm" in "leapfrog" by exit from outer loop.

In "calfis": removed argument "pp" and variable "unskap"; changed
"pksurcp" from scalar to rank 2; use "pressure_var"; rewrote
computation of "zplev", "zplay", "ztfi", "pcvgt" using "dyn_phy";
added computation of "pls".

Removed unused variable in "dynredem0".

In "exner_hyb": changed "dellta" from scalar to rank 1; replaced call
to "ssum" by call to "sum"; removed variables "xpn" and "xps";
replaced some loops by array expressions.

In "leapfrog": use "pressure_var"; deleted variables "p", "longcles".

Converted common blocks "YOECUMF", "YOEGWD" to modules.

Removed argument "pplay" in "cvltr", "diagetpq", "nflxtr".

Created module "raddimlw" from include file "raddimlw.h".

Corrected call to "new_unit" in "test_disvert".

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     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_phy, 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 guez 7 use dynredem0_m, only: dynredem0
43 guez 3
44     IMPLICIT NONE
45    
46     REAL clesphy0(20)
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 guez 7 REAL phis(iim + 1, jjm + 1) ! géopotentiel au sol
57 guez 3
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 conf_gcm(clesphy0)
96    
97     ! Initialisation des traceurs
98     ! Choix du schéma pour l'advection dans le fichier "traceur.def" ou via INCA
99     call iniadvtrac(nq)
100    
101     ! Lecture du fichier "start.nc" :
102     CALL dynetat0(vcov, ucov, teta, q, masse, ps, phis, time_0)
103    
104     ! Lecture des paramètres de contrôle pour la simulation :
105     ! on recalcule éventuellement le pas de temps
106     IF (MOD(day_step, iperiod) /= 0) THEN
107     call abort_gcm(modname = "gcm", message = &
108     'Il faut choisir un nombre de pas par jour multiple de "iperiod".', &
109     ierr = 1)
110     ENDIF
111    
112     IF (MOD(day_step,iphysiq)/=0) THEN
113     call abort_gcm(modname = "gcm", message = &
114     'Il faut choisir un nombre de pas par jour multiple de "iphysiq".', &
115     ierr = 1)
116     ENDIF
117    
118     ! On remet le calendrier à zero si demandé:
119     if (annee_ref /= anneeref .or. day_ref /= dayref) then
120     print *, 'Attention : les dates initiales lues dans le fichier ' // &
121     '"start" ne correspondent pas à celles lues dans "gcm.def".'
122     if (raz_date /= 1) then
123     print *, 'On garde les dates du fichier "start".'
124     else
125     print *, 'On réinitialise à la date lue dans "gcm.def".'
126     annee_ref = anneeref
127     day_ref = dayref
128     day_ini = dayref
129     itau_dyn = 0
130     itau_phy = 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 guez 5 CALL dynredem0("restart.nc", day_end, phis)
195 guez 3 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, clesphy0, time_0)
207    
208 guez 10 call histclo
209     print *, 'Simulation finished'
210     print *, 'Everything is cool'
211    
212 guez 3 END PROGRAM gcm

  ViewVC Help
Powered by ViewVC 1.1.21