1 |
PROGRAM gcm |
PROGRAM gcm |
2 |
|
|
3 |
! General circulation model of LMD |
! Authors: P. Le Van, L. Fairhead, F. Hourdin |
|
|
|
4 |
! From "gcm.F", version 1.4, 2006/04/04 15:05:16 |
! From "gcm.F", version 1.4, 2006/04/04 15:05:16 |
5 |
|
! General circulation model of LMD |
6 |
! Avec coordonnées verticales hybrides, avec nouveaux opérateurs de |
! Avec coordonnées verticales hybrides, avec nouveaux opérateurs de |
7 |
! dissipation * (gradiv2, divgrad2, nxgraro2) |
! dissipation "*" (gradiv2, divgrad2, nxgraro2) |
|
|
|
|
! Authors: P. Le Van, L. Fairhead, F. Hourdin |
|
|
|
|
8 |
! Possibilité de choisir le schéma pour l'advection de "q", en |
! Possibilité de choisir le schéma pour l'advection de "q", en |
9 |
! modifiant "iadv" dans "traceur.def". |
! modifiant "iadv" dans "traceur.def". |
|
|
|
10 |
! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4 |
! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4 |
11 |
! Pour Van-Leer : iadv=10 |
! Pour Van-Leer : iadv=10 |
12 |
|
|
13 |
USE IOIPSL, only: ioconf_calendar |
use clesphys2, only: read_clesphys2 |
14 |
use dimens_m, only: iim, jjm, llm, nqmx |
use com_io_dyn, only: histid, histvid, histaveid |
15 |
use dimphy, only: klon |
use comconst, only: daysec, cpp, dtvr, g, rad, r, initialize |
16 |
use paramet_m, only: ip1jm, ip1jmp1 |
use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv |
|
use comconst, only: daysec, cpp, dtvr, dtphys, g, rad, r, initialize |
|
|
|
|
|
use comdissnew, only: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & |
|
|
tetagrot, tetatemp |
|
|
|
|
17 |
use conf_gcm_m, only: day_step, iperiod, anneeref, dayref, iecri, iphysiq, & |
use conf_gcm_m, only: day_step, iperiod, anneeref, dayref, iecri, iphysiq, & |
18 |
nday, raz_date, periodav, conf_gcm |
nday, raz_date, periodav, conf_gcm |
19 |
|
use dimens_m, only: iim, jjm, llm, nqmx |
20 |
use logic, only: iflag_phys |
use dimphy, only: klon |
21 |
use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv |
use dynetat0_m, only: dynetat0, day_ini |
22 |
use temps, only: day_ref, annee_ref, day_ini, day_end, itau_phy, itau_dyn |
use dynredem0_m, only: dynredem0 |
|
use com_io_dyn, only: histid, histvid, histaveid |
|
|
use tracstoke, only: istdyn, istphy |
|
|
use abort_gcm_m, only: abort_gcm |
|
|
use inithist_m, only: inithist |
|
|
use initdynav_m, only: initdynav |
|
|
use dynetat0_m, only: dynetat0 |
|
23 |
use grid_change, only: dyn_phy, init_dyn_phy |
use grid_change, only: dyn_phy, init_dyn_phy |
24 |
use advtrac_m, only: iniadvtrac |
use iniadvtrac_m, only: iniadvtrac |
25 |
|
use inidissip_m, only: inidissip |
26 |
|
use inigeom_m, only: inigeom |
27 |
|
use initdynav_m, only: initdynav |
28 |
|
use inithist_m, only: inithist |
29 |
|
USE calendar, only: ioconf_calendar |
30 |
|
use histcom, only: histclo |
31 |
use leapfrog_m, only: leapfrog |
use leapfrog_m, only: leapfrog |
32 |
|
use logic, only: iflag_phys |
33 |
|
use paramet_m, only: ip1jm, ip1jmp1 |
34 |
|
use temps, only: day_ref, annee_ref, day_end, itau_dyn |
35 |
|
use tracstoke, only: istdyn, istphy |
36 |
|
|
37 |
IMPLICIT NONE |
IMPLICIT NONE |
38 |
|
|
|
REAL clesphy0(20) |
|
39 |
REAL zdtvr ! time step for dynamics, in s |
REAL zdtvr ! time step for dynamics, in s |
40 |
|
|
41 |
! Variables dynamiques : |
! Variables dynamiques : |
45 |
REAL ps(ip1jmp1) ! pression au sol (Pa) |
REAL ps(ip1jmp1) ! pression au sol (Pa) |
46 |
|
|
47 |
REAL masse(ip1jmp1, llm) ! masse d'air |
REAL masse(ip1jmp1, llm) ! masse d'air |
48 |
REAL phis(ip1jmp1) ! géopotentiel au sol |
REAL phis(iim + 1, jjm + 1) ! géopotentiel au sol |
49 |
|
|
50 |
! Variables pour le fichier histoire : |
! Variables pour le fichier histoire : |
51 |
REAL time_0 |
REAL time_0 ! time in day, as a fraction of day, in [0, 1[ |
|
|
|
|
!!INTEGER i |
|
52 |
|
|
53 |
! Calendrier : |
! Calendrier : |
54 |
LOGICAL:: true_calendar = .false. ! default value |
LOGICAL:: true_calendar = .false. ! default value |
55 |
|
|
56 |
! Variables pour l'initialisation de la physique : |
! Variables pour l'initialisation de la physique : |
|
integer nq |
|
57 |
REAL zcufi(klon), zcvfi(klon) ! "cu" and "cv" values on the scalar grid |
REAL zcufi(klon), zcvfi(klon) ! "cu" and "cv" values on the scalar grid |
58 |
REAL latfi(klon), lonfi(klon) |
REAL latfi(klon), lonfi(klon) |
59 |
REAL airefi(klon) |
REAL airefi(klon) |
81 |
endif |
endif |
82 |
|
|
83 |
! Lecture des fichiers "gcm.def" ou "run.def" : |
! Lecture des fichiers "gcm.def" ou "run.def" : |
84 |
CALL conf_gcm(clesphy0) |
call read_clesphys2 |
85 |
|
CALL conf_gcm |
86 |
|
|
87 |
! Initialisation des traceurs |
! Initialisation des traceurs |
88 |
! Choix du schéma pour l'advection dans le fichier "traceur.def" ou via INCA |
! Choix du schéma pour l'advection dans le fichier "traceur.def" ou via INCA |
89 |
call iniadvtrac(nq) |
call iniadvtrac |
90 |
|
|
91 |
! Lecture du fichier "start.nc" : |
! Lecture du fichier "start.nc" : |
92 |
CALL dynetat0(vcov, ucov, teta, q, masse, ps, phis, time_0) |
CALL dynetat0(vcov, ucov, teta, q, masse, ps, phis, time_0) |
|
! Begin special experiment |
|
|
!!$ print *, "This is a special experiment." |
|
|
!!$ print *, "We are setting:" |
|
|
!!$ print *, "ucov = vcov = 0, q = 0, ps = 101325" |
|
|
!!$ print *, "We are averaging 'teta' horizontally." |
|
|
!!$ ucov = 0. |
|
|
!!$ vcov = 0. |
|
|
!!$ q = 0. |
|
|
!!$ ps = 101325. |
|
|
! Average teta over all longitudes and latitudes: |
|
|
!!$ forall(i = 1:llm) teta(:,i) = sum(teta(:,i)) / ip1jmp1 |
|
|
! (it would be better to weight each element with an associated |
|
|
! surface area) |
|
|
! End special experiment |
|
|
|
|
|
! Lecture des paramètres de contrôle pour la simulation : |
|
|
! on recalcule éventuellement le pas de temps |
|
|
IF (MOD(day_step, iperiod) /= 0) THEN |
|
|
call abort_gcm(modname = "gcm", message = & |
|
|
'Il faut choisir un nombre de pas par jour multiple de "iperiod".', & |
|
|
ierr = 1) |
|
|
ENDIF |
|
93 |
|
|
94 |
IF (MOD(day_step,iphysiq)/=0) THEN |
! On remet le calendrier à zero si demandé : |
|
call abort_gcm(modname = "gcm", message = & |
|
|
'Il faut choisir un nombre de pas par jour multiple de "iphysiq".', & |
|
|
ierr = 1) |
|
|
ENDIF |
|
|
|
|
|
! On remet le calendrier à zero si demandé: |
|
95 |
if (annee_ref /= anneeref .or. day_ref /= dayref) then |
if (annee_ref /= anneeref .or. day_ref /= dayref) then |
96 |
print *, 'Attention : les dates initiales lues dans le fichier ' // & |
print *, 'Attention : les dates initiales lues dans le fichier ' // & |
97 |
'"start" ne correspondent pas à celles lues dans "gcm.def".' |
'"start" ne correspondent pas à celles lues dans "gcm.def".' |
98 |
if (raz_date /= 1) then |
if (raz_date) then |
|
print *, 'On garde les dates du fichier "start".' |
|
|
else |
|
99 |
print *, 'On réinitialise à la date lue dans "gcm.def".' |
print *, 'On réinitialise à la date lue dans "gcm.def".' |
100 |
annee_ref = anneeref |
annee_ref = anneeref |
101 |
day_ref = dayref |
day_ref = dayref |
102 |
day_ini = dayref |
day_ini = dayref |
103 |
itau_dyn = 0 |
itau_dyn = 0 |
|
itau_phy = 0 |
|
104 |
time_0 = 0. |
time_0 = 0. |
105 |
|
else |
106 |
|
print *, 'On garde les dates du fichier "start".' |
107 |
endif |
endif |
108 |
ELSE |
ELSE |
109 |
raz_date = 0 |
raz_date = .false. |
110 |
endif |
endif |
111 |
|
|
112 |
! Initialisation des constantes dynamiques : |
! On recalcule éventuellement le pas de temps : |
113 |
zdtvr = daysec / REAL(day_step) |
zdtvr = daysec / REAL(day_step) |
114 |
IF (dtvr /= zdtvr) THEN |
IF (dtvr /= zdtvr) THEN |
115 |
print *, 'Warning: the time steps in the ".def" file and in ' // & |
print *, 'Warning: the time steps in the ".def" file and in ' // & |
119 |
print *, 'Using the value from the ".def" file.' |
print *, 'Using the value from the ".def" file.' |
120 |
dtvr = zdtvr |
dtvr = zdtvr |
121 |
ENDIF |
ENDIF |
|
CALL iniconst |
|
|
|
|
|
! Initialisation de la géometrie : |
|
|
CALL inigeom |
|
|
|
|
|
! Initialisation du filtre : |
|
|
CALL inifilr |
|
|
|
|
|
! Initialisation de la dissipation : |
|
|
CALL inidissip(lstardis, nitergdiv, nitergrot, niterh, tetagdiv, tetagrot, & |
|
|
tetatemp) |
|
122 |
|
|
123 |
|
CALL iniconst |
124 |
|
CALL inigeom ! initialisation de la géometrie |
125 |
|
CALL inifilr ! initialisation du filtre |
126 |
|
CALL inidissip |
127 |
call init_dyn_phy |
call init_dyn_phy |
128 |
|
|
129 |
! Initialisation de la physique : |
! Initialisation de la physique : |
148 |
! (that value of "cv_2d" is used twice in "zcvfi") |
! (that value of "cv_2d" is used twice in "zcvfi") |
149 |
|
|
150 |
airefi = pack(aire_2d, dyn_phy) |
airefi = pack(aire_2d, dyn_phy) |
151 |
print *, 'Attention : vitesse verticale nulle dans la physique.' |
CALL iniphysiq(klon, llm, latfi, lonfi, airefi, zcufi, zcvfi, rad, g, r, & |
152 |
CALL iniphysiq(klon, llm, daysec, day_ini, dtphys, latfi, lonfi, airefi, & |
cpp) |
|
zcufi, zcvfi, rad, g, r, cpp) |
|
153 |
ENDIF |
ENDIF |
154 |
|
|
|
! Numéro de stockage pour les fichiers de redémarrage : |
|
155 |
! Initialisation des entrées-sorties : |
! Initialisation des entrées-sorties : |
156 |
day_end = day_ini + nday |
day_end = day_ini + nday |
157 |
print *, "day_ini = ", day_ini |
print *, "day_ini = ", day_ini |
159 |
|
|
160 |
CALL dynredem0("restart.nc", day_end, phis) |
CALL dynredem0("restart.nc", day_end, phis) |
161 |
CALL inithist(day_ref, annee_ref, zdtvr, nqmx, histid, histvid, & |
CALL inithist(day_ref, annee_ref, zdtvr, nqmx, histid, histvid, & |
162 |
infile="dyn_hist.nc", t_ops = iecri * daysec, t_wrt = iecri * daysec) |
t_ops = iecri * daysec, t_wrt = iecri * daysec) |
163 |
CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, & |
CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, & |
164 |
infile='dyn_hist_ave.nc', t_ops = iperiod * zdtvr, & |
t_ops = iperiod * zdtvr, t_wrt = periodav * daysec) |
|
t_wrt = periodav * daysec) |
|
165 |
|
|
166 |
! Choix des fréquences de stockage pour le hors-ligne : |
! Choix des fréquences de stockage pour le hors-ligne : |
167 |
istdyn = day_step / 4 ! stockage toutes les 6 h = 1 jour / 4 |
istdyn = day_step / 4 ! stockage toutes les 6 h = 1 jour / 4 |
168 |
istphy = istdyn / iphysiq |
istphy = istdyn / iphysiq |
169 |
|
|
170 |
! Intégration temporelle du modèle : |
! Intégration temporelle du modèle : |
171 |
CALL leapfrog(ucov, vcov, teta, ps, masse, phis, nq, q, clesphy0, time_0) |
CALL leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0) |
172 |
|
|
173 |
|
call histclo |
174 |
|
print *, 'Simulation finished' |
175 |
|
print *, 'Everything is cool' |
176 |
|
|
177 |
END PROGRAM gcm |
END PROGRAM gcm |