15 |
! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4 |
! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4 |
16 |
! Pour Van-Leer : iadv=10 |
! Pour Van-Leer : iadv=10 |
17 |
|
|
18 |
USE IOIPSL, only: ioconf_calendar |
use abort_gcm_m, only: abort_gcm |
19 |
use dimens_m, only: iim, jjm, llm, nqmx |
use clesphys2, only: read_clesphys2 |
20 |
use dimphy, only: klon |
use com_io_dyn, only: histid, histvid, histaveid |
21 |
use paramet_m, only: ip1jm, ip1jmp1 |
use comconst, only: daysec, cpp, dtvr, g, rad, r, initialize |
|
use comconst, only: daysec, cpp, dtvr, dtphys, g, rad, r, initialize |
|
|
|
|
22 |
use comdissnew, only: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & |
use comdissnew, only: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & |
23 |
tetagrot, tetatemp |
tetagrot, tetatemp |
24 |
|
use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv |
25 |
use conf_gcm_m, only: day_step, iperiod, anneeref, dayref, iecri, iphysiq, & |
use conf_gcm_m, only: day_step, iperiod, anneeref, dayref, iecri, iphysiq, & |
26 |
nday, raz_date, periodav, conf_gcm |
nday, raz_date, periodav, conf_gcm |
27 |
|
use dimens_m, only: iim, jjm, llm, nqmx |
28 |
use logic, only: iflag_phys |
use dimphy, only: klon |
29 |
use comgeom, only: rlatu, aire_2d, cu_2d, cv_2d, rlonv |
use dynetat0_m, only: dynetat0, day_ini |
30 |
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 |
|
31 |
use grid_change, only: dyn_phy, init_dyn_phy |
use grid_change, only: dyn_phy, init_dyn_phy |
32 |
use advtrac_m, only: iniadvtrac |
use iniadvtrac_m, only: iniadvtrac |
33 |
|
use inidissip_m, only: inidissip |
34 |
|
use inigeom_m, only: inigeom |
35 |
|
use initdynav_m, only: initdynav |
36 |
|
use inithist_m, only: inithist |
37 |
|
USE IOIPSL, only: ioconf_calendar, histclo |
38 |
use leapfrog_m, only: leapfrog |
use leapfrog_m, only: leapfrog |
39 |
|
use logic, only: iflag_phys |
40 |
|
use paramet_m, only: ip1jm, ip1jmp1 |
41 |
|
use temps, only: day_ref, annee_ref, day_end, itau_dyn |
42 |
|
use tracstoke, only: istdyn, istphy |
43 |
|
|
44 |
IMPLICIT NONE |
IMPLICIT NONE |
45 |
|
|
|
REAL clesphy0(20) |
|
46 |
REAL zdtvr ! time step for dynamics, in s |
REAL zdtvr ! time step for dynamics, in s |
47 |
|
|
48 |
! Variables dynamiques : |
! Variables dynamiques : |
52 |
REAL ps(ip1jmp1) ! pression au sol (Pa) |
REAL ps(ip1jmp1) ! pression au sol (Pa) |
53 |
|
|
54 |
REAL masse(ip1jmp1, llm) ! masse d'air |
REAL masse(ip1jmp1, llm) ! masse d'air |
55 |
REAL phis(ip1jmp1) ! géopotentiel au sol |
REAL phis(iim + 1, jjm + 1) ! géopotentiel au sol |
56 |
|
|
57 |
! Variables pour le fichier histoire : |
! Variables pour le fichier histoire : |
58 |
REAL time_0 |
REAL time_0 ! time in day, as a fraction of day, in [0, 1[ |
|
|
|
|
!!INTEGER i |
|
59 |
|
|
60 |
! Calendrier : |
! Calendrier : |
61 |
LOGICAL:: true_calendar = .false. ! default value |
LOGICAL:: true_calendar = .false. ! default value |
62 |
|
|
63 |
! Variables pour l'initialisation de la physique : |
! Variables pour l'initialisation de la physique : |
|
integer nq |
|
64 |
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 |
65 |
REAL latfi(klon), lonfi(klon) |
REAL latfi(klon), lonfi(klon) |
66 |
REAL airefi(klon) |
REAL airefi(klon) |
88 |
endif |
endif |
89 |
|
|
90 |
! Lecture des fichiers "gcm.def" ou "run.def" : |
! Lecture des fichiers "gcm.def" ou "run.def" : |
91 |
CALL conf_gcm(clesphy0) |
call read_clesphys2 |
92 |
|
CALL conf_gcm |
93 |
|
|
94 |
! Initialisation des traceurs |
! Initialisation des traceurs |
95 |
! 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 |
96 |
call iniadvtrac(nq) |
call iniadvtrac |
97 |
|
|
98 |
! Lecture du fichier "start.nc" : |
! Lecture du fichier "start.nc" : |
99 |
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 |
|
100 |
|
|
101 |
! Lecture des paramètres de contrôle pour la simulation : |
! Lecture des paramètres de contrôle pour la simulation : |
102 |
! on recalcule éventuellement le pas de temps |
! on recalcule éventuellement le pas de temps |
116 |
if (annee_ref /= anneeref .or. day_ref /= dayref) then |
if (annee_ref /= anneeref .or. day_ref /= dayref) then |
117 |
print *, 'Attention : les dates initiales lues dans le fichier ' // & |
print *, 'Attention : les dates initiales lues dans le fichier ' // & |
118 |
'"start" ne correspondent pas à celles lues dans "gcm.def".' |
'"start" ne correspondent pas à celles lues dans "gcm.def".' |
119 |
if (raz_date /= 1) then |
if (raz_date) then |
|
print *, 'On garde les dates du fichier "start".' |
|
|
else |
|
120 |
print *, 'On réinitialise à la date lue dans "gcm.def".' |
print *, 'On réinitialise à la date lue dans "gcm.def".' |
121 |
annee_ref = anneeref |
annee_ref = anneeref |
122 |
day_ref = dayref |
day_ref = dayref |
123 |
day_ini = dayref |
day_ini = dayref |
124 |
itau_dyn = 0 |
itau_dyn = 0 |
|
itau_phy = 0 |
|
125 |
time_0 = 0. |
time_0 = 0. |
126 |
|
else |
127 |
|
print *, 'On garde les dates du fichier "start".' |
128 |
endif |
endif |
129 |
ELSE |
ELSE |
130 |
raz_date = 0 |
raz_date = .false. |
131 |
endif |
endif |
132 |
|
|
133 |
! Initialisation des constantes dynamiques : |
! Initialisation des constantes dynamiques : |
177 |
|
|
178 |
airefi = pack(aire_2d, dyn_phy) |
airefi = pack(aire_2d, dyn_phy) |
179 |
print *, 'Attention : vitesse verticale nulle dans la physique.' |
print *, 'Attention : vitesse verticale nulle dans la physique.' |
180 |
CALL iniphysiq(klon, llm, daysec, day_ini, dtphys, latfi, lonfi, airefi, & |
CALL iniphysiq(klon, llm, latfi, lonfi, airefi, & |
181 |
zcufi, zcvfi, rad, g, r, cpp) |
zcufi, zcvfi, rad, g, r, cpp) |
182 |
ENDIF |
ENDIF |
183 |
|
|
|
! Numéro de stockage pour les fichiers de redémarrage : |
|
184 |
! Initialisation des entrées-sorties : |
! Initialisation des entrées-sorties : |
185 |
day_end = day_ini + nday |
day_end = day_ini + nday |
186 |
print *, "day_ini = ", day_ini |
print *, "day_ini = ", day_ini |
187 |
print *, "day_end = ", day_end |
print *, "day_end = ", day_end |
188 |
|
|
189 |
CALL dynredem0("restart.nc", day_end, phis, nqmx) |
CALL dynredem0("restart.nc", day_end, phis) |
190 |
CALL inithist(day_ref, annee_ref, zdtvr, nqmx, histid, histvid, & |
CALL inithist(day_ref, annee_ref, zdtvr, nqmx, histid, histvid, & |
191 |
infile="dyn_hist.nc", t_ops = iecri * daysec, t_wrt = iecri * daysec) |
infile="dyn_hist.nc", t_ops = iecri * daysec, t_wrt = iecri * daysec) |
192 |
CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, & |
CALL initdynav(day_ref, annee_ref, zdtvr, nqmx, histaveid, & |
198 |
istphy = istdyn / iphysiq |
istphy = istdyn / iphysiq |
199 |
|
|
200 |
! Intégration temporelle du modèle : |
! Intégration temporelle du modèle : |
201 |
CALL leapfrog(ucov, vcov, teta, ps, masse, phis, nq, q, clesphy0, time_0) |
CALL leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0) |
202 |
|
|
203 |
|
call histclo |
204 |
|
print *, 'Simulation finished' |
205 |
|
print *, 'Everything is cool' |
206 |
|
|
207 |
END PROGRAM gcm |
END PROGRAM gcm |