1 |
module leapfrog_m |
module leapfrog_m |
2 |
|
|
|
! This module is clean: no C preprocessor directive, no include line. |
|
|
|
|
3 |
IMPLICIT NONE |
IMPLICIT NONE |
4 |
|
|
5 |
contains |
contains |
6 |
|
|
7 |
SUBROUTINE leapfrog(ucov, vcov, teta, ps, masse, phis, nq, q, clesphy0, & |
SUBROUTINE leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0) |
|
time_0) |
|
8 |
|
|
9 |
! From dyn3d/leapfrog.F, version 1.6 2005/04/13 08:58:34 |
! From dyn3d/leapfrog.F, version 1.6 2005/04/13 08:58:34 |
10 |
|
|
11 |
! Version du 10/01/98, avec coordonnees verticales hybrides, avec |
! Version du 10/01/98, avec coordonnées verticales hybrides, avec |
12 |
! nouveaux operat. dissipation * (gradiv2, divgrad2, nxgraro2) |
! nouveaux opérateurs dissipation "*" (gradiv2, divgrad2, nxgraro2) |
13 |
|
|
14 |
! Auteur: P. Le Van /L. Fairhead/F.Hourdin |
! Auteurs : P. Le Van, L. Fairhead, F. Hourdin |
15 |
! Objet: |
! Objet: nouvelle grille |
|
! GCM LMD nouvelle grille |
|
16 |
|
|
17 |
! ... Dans inigeom, nouveaux calculs pour les elongations cu, cv |
! Dans "inigeom", nouveaux calculs pour les élongations cu, cv |
18 |
! et possibilite d'appeler une fonction f(y) a derivee tangente |
! et possibilité d'appeler une fonction f(y) à dérivée tangente |
19 |
! hyperbolique a la place de la fonction a derivee sinusoidale. |
! hyperbolique à la place de la fonction à dérivée sinusoïdale. |
20 |
|
|
21 |
! ... Possibilité de choisir le schéma pour l'advection de |
! Possibilité de choisir le schéma pour l'advection de |
22 |
! q, en modifiant iadv dans "traceur.def" (10/02) . |
! q, en modifiant iadv dans "traceur.def". |
23 |
|
|
24 |
! Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron, 10/99) |
! Pour Van-Leer + vapeur d'eau saturée, iadv(1)=4. |
25 |
! Pour Van-Leer iadv=10 |
! Pour Van-Leer iadv=10 |
26 |
|
|
27 |
use dimens_m, only: iim, jjm, llm, nqmx |
use dimens_m, only: iim, llm, nqmx |
28 |
use paramet_m, only: ip1jmp1, ip1jm, ijmllm, ijp1llm, jjp1, iip1, iip2 |
use paramet_m, only: ip1jmp1, ip1jm, ijp1llm, jjp1, iip1 |
29 |
use comconst, only: dtvr, daysec, dtphys |
use comconst, only: dtvr, daysec, dtphys |
30 |
use comvert, only: ap, bp |
use comvert, only: ap, bp |
31 |
use conf_gcm_m, only: day_step, iconser, idissip, iphysiq, iperiod, nday, & |
use conf_gcm_m, only: day_step, iconser, idissip, iphysiq, iperiod, nday, & |
43 |
use pression_m, only: pression |
use pression_m, only: pression |
44 |
use pressure_var, only: p3d |
use pressure_var, only: p3d |
45 |
|
|
|
integer nq |
|
|
REAL, intent(in):: clesphy0(:) |
|
|
|
|
46 |
! Variables dynamiques: |
! Variables dynamiques: |
47 |
REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) ! vents covariants |
REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) ! vents covariants |
48 |
REAL teta(ip1jmp1, llm) ! temperature potentielle |
REAL teta(ip1jmp1, llm) ! temperature potentielle |
51 |
REAL masse(ip1jmp1, llm) ! masse d'air |
REAL masse(ip1jmp1, llm) ! masse d'air |
52 |
REAL phis(ip1jmp1) ! geopotentiel au sol |
REAL phis(ip1jmp1) ! geopotentiel au sol |
53 |
|
|
54 |
REAL time_0 |
REAL, intent(in):: time_0 |
55 |
|
|
56 |
! Variables local to the procedure: |
! Variables local to the procedure: |
57 |
|
|
87 |
|
|
88 |
REAL tppn(iim), tpps(iim), tpn, tps |
REAL tppn(iim), tpps(iim), tpn, tps |
89 |
|
|
90 |
INTEGER itau, itaufinp1 |
INTEGER itau ! index of the time step of the dynamics, starts at 0 |
91 |
INTEGER iday ! jour julien |
INTEGER iday ! jour julien |
92 |
REAL time ! Heure de la journee en fraction d'1 jour |
REAL time ! time of day, as a fraction of day length |
93 |
|
|
94 |
REAL SSUM |
REAL SSUM |
95 |
real finvmaold(ip1jmp1, llm) |
real finvmaold(ip1jmp1, llm) |
98 |
INTEGER ij, l |
INTEGER ij, l |
99 |
|
|
100 |
REAL rdayvrai, rdaym_ini |
REAL rdayvrai, rdaym_ini |
|
LOGICAL:: callinigrads = .true. |
|
101 |
|
|
102 |
!+jld variables test conservation energie |
! Variables test conservation energie |
103 |
REAL ecin(ip1jmp1, llm), ecin0(ip1jmp1, llm) |
REAL ecin(ip1jmp1, llm), ecin0(ip1jmp1, llm) |
104 |
! Tendance de la temp. potentiel d (theta) / d t due a la |
! Tendance de la temp. potentiel d (theta) / d t due a la |
105 |
! tansformation d'energie cinetique en energie thermique |
! tansformation d'energie cinetique en energie thermique |
110 |
INTEGER:: ip_ebil_dyn = 0 ! PRINT level for energy conserv. diag. |
INTEGER:: ip_ebil_dyn = 0 ! PRINT level for energy conserv. diag. |
111 |
|
|
112 |
logical:: dissip_conservative = .true. |
logical:: dissip_conservative = .true. |
|
LOGICAL:: prem = .true. |
|
113 |
logical forward, leapf, apphys, conser, apdiss |
logical forward, leapf, apphys, conser, apdiss |
114 |
|
|
115 |
!--------------------------------------------------- |
!--------------------------------------------------- |
117 |
print *, "Call sequence information: leapfrog" |
print *, "Call sequence information: leapfrog" |
118 |
|
|
119 |
itaufin = nday * day_step |
itaufin = nday * day_step |
|
itaufinp1 = itaufin + 1 |
|
|
|
|
120 |
itau = 0 |
itau = 0 |
121 |
iday = day_ini |
iday = day_ini |
122 |
time = time_0 |
time = time_0 |
125 |
iday = iday + 1 |
iday = iday + 1 |
126 |
ENDIF |
ENDIF |
127 |
|
|
128 |
|
dq = 0. |
129 |
! On initialise la pression et la fonction d'Exner : |
! On initialise la pression et la fonction d'Exner : |
|
dq=0. |
|
130 |
CALL pression(ip1jmp1, ap, bp, ps, p3d) |
CALL pression(ip1jmp1, ap, bp, ps, p3d) |
131 |
CALL exner_hyb(ps, p3d, pks, pk, pkf) |
CALL exner_hyb(ps, p3d, pks, pk, pkf) |
132 |
|
|
133 |
! Debut de l'integration temporelle: |
! Debut de l'integration temporelle: |
134 |
outer_loop:do |
outer_loop:do |
135 |
if (ok_guide.and.(itaufin - itau - 1) * dtvr > 21600) then |
if (ok_guide.and.(itaufin - itau - 1) * dtvr > 21600.) then |
136 |
call guide(itau, ucov, vcov, teta, q, masse, ps) |
call guide(itau, ucov, vcov, teta, q, masse, ps) |
137 |
else |
else |
138 |
IF (prt_level > 9) print *, & |
IF (prt_level > 9) print *, & |
139 |
'Attention : on ne guide pas les 6 dernieres heures.' |
'Attention : on ne guide pas les 6 dernières heures.' |
140 |
endif |
endif |
141 |
|
|
142 |
CALL SCOPY(ijmllm, vcov, 1, vcovm1, 1) |
CALL SCOPY(ip1jm * llm, vcov, 1, vcovm1, 1) |
143 |
CALL SCOPY(ijp1llm, ucov, 1, ucovm1, 1) |
CALL SCOPY(ijp1llm, ucov, 1, ucovm1, 1) |
144 |
CALL SCOPY(ijp1llm, teta, 1, tetam1, 1) |
CALL SCOPY(ijp1llm, teta, 1, tetam1, 1) |
145 |
CALL SCOPY(ijp1llm, masse, 1, massem1, 1) |
CALL SCOPY(ijp1llm, masse, 1, massem1, 1) |
207 |
teta, q(:, :, 1), q(:, :, 2)) |
teta, q(:, :, 1), q(:, :, 2)) |
208 |
ENDIF |
ENDIF |
209 |
|
|
210 |
CALL calfis(nq, lafin, rdayvrai, time, ucov, vcov, teta, q, & |
CALL calfis(nqmx, lafin, rdayvrai, time, ucov, vcov, teta, q, & |
211 |
masse, ps, pk, phis, phi, du, dv, dteta, dq, w, & |
masse, ps, pk, phis, phi, du, dv, dteta, dq, w, & |
212 |
clesphy0, dufi, dvfi, dtetafi, dqfi, dpfi) |
dufi, dvfi, dtetafi, dqfi, dpfi) |
213 |
|
|
214 |
! ajout des tendances physiques: |
! ajout des tendances physiques: |
215 |
CALL addfi(nqmx, dtphys, & |
CALL addfi(nqmx, dtphys, & |
294 |
ENDIF |
ENDIF |
295 |
ENDIF |
ENDIF |
296 |
|
|
297 |
IF (itau == itaufinp1) exit outer_loop |
IF (itau == itaufin + 1) exit outer_loop |
298 |
|
|
299 |
! ecriture du fichier histoire moyenne: |
! ecriture du fichier histoire moyenne: |
300 |
|
|
308 |
ENDIF |
ENDIF |
309 |
|
|
310 |
IF (itau == itaufin) THEN |
IF (itau == itaufin) THEN |
311 |
CALL dynredem1("restart.nc", 0., vcov, ucov, teta, q, masse, ps) |
CALL dynredem1("restart.nc", vcov, ucov, teta, q, masse, ps) |
312 |
CLOSE(99) |
CLOSE(99) |
313 |
ENDIF |
ENDIF |
314 |
|
|
326 |
dt = 2. * dtvr |
dt = 2. * dtvr |
327 |
END IF |
END IF |
328 |
ELSE |
ELSE |
329 |
! ...... pas leapfrog ..... |
! pas leapfrog |
330 |
leapf = .TRUE. |
leapf = .TRUE. |
331 |
dt = 2. * dtvr |
dt = 2. * dtvr |
332 |
END IF |
END IF |