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

Contents of /trunk/dyn3d/caldyn.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 104 - (show annotations)
Thu Sep 4 10:05:52 2014 UTC (9 years, 8 months ago) by guez
File size: 4296 byte(s)
Removed procedure sortvarc0. Called sortvarc with an additional
argument resetvarc instead. (Following LMDZ.) Moved current time
computations and some printing statements from sortvarc to
caldyn. Could then remove arguments itau and time_0 of sortvarc, and
could remove "use dynetat0". Better to keep "dynetat0.f" as a gcm-only
file.

Moved some variables from module ener to module sortvarc.

Split file "mathelp.f" into single-procedure files.

Removed unused argument nadv of adaptdt. Removed dimension arguments
of bernoui.

Removed unused argument nisurf of interfoce_lim. Changed the size of
argument lmt_sst of interfoce_lim from klon to knon. Removed case when
newlmt is false.

dynredem1 is called only once in each run, either ce0l or gcm. So
variable nb in call to nf95_put_var was always 1. Removed variable nb.

Removed dimension arguments of calcul_fluxs. Removed unused arguments
precip_rain, precip_snow, snow of calcul_fluxs. Changed the size of
all the arrays in calcul_fluxs from klon to knon.

Removed dimension arguments of fonte_neige. Changed the size of all
the arrays in fonte_neige from klon to knon.

Changed the size of arguments tsurf and tsurf_new of interfsurf_hq
from klon to knon. Changed the size of argument ptsrf of soil from
klon to knon.

1 module caldyn_m
2
3 IMPLICIT NONE
4
5 contains
6
7 SUBROUTINE caldyn(itau, ucov, vcov, teta, ps, masse, pk, pkf, phis, phi, &
8 dudyn, dv, dteta, dp, w, pbaru, pbarv, time_0, conser)
9
10 ! From dyn3d/caldyn.F, version 1.1.1.1, 2004/05/19 12:53:06
11 ! Author: P. Le Van
12 ! Objet : calcul des tendances dynamiques
13
14 use advect_m, only: advect
15 use bernoui_m, only: bernoui
16 USE comconst, ONLY: daysec, dtvr
17 USE comgeom, ONLY: airesurg, constang_2d
18 USE conf_gcm_m, ONLY: day_step
19 use convmas_m, only: convmas
20 USE dimens_m, ONLY: iim, jjm, llm
21 USE disvert_m, ONLY: ap, bp
22 use dteta1_m, only: dteta1
23 use dudv1_m, only: dudv1
24 use dudv2_m, only: dudv2
25 USE dynetat0_m, ONLY: day_ini
26 use flumass_m, only: flumass
27 use massbar_m, only: massbar
28 use massbarxy_m, only: massbarxy
29 use massdair_m, only: massdair
30 USE paramet_m, ONLY: iip1, ip1jmp1, jjp1, llmp1
31 use sortvarc_m, only: sortvarc, ang, etot, ptot, rmsdpdt, rmsv, stot, ztot
32 use tourpot_m, only: tourpot
33 use vitvert_m, only: vitvert
34
35 INTEGER, INTENT(IN):: itau
36 REAL, INTENT(IN):: ucov(:, :, :) ! (iim + 1, jjm + 1, llm) vent covariant
37 REAL, INTENT(IN):: vcov(:, :, :) ! (iim + 1, jjm, llm) ! vent covariant
38 REAL, INTENT(IN):: teta(ip1jmp1, llm)
39 REAL, INTENT (IN):: ps(ip1jmp1)
40 real, intent(out):: masse(ip1jmp1, llm)
41 REAL, INTENT(IN):: pk(iip1, jjp1, llm)
42 REAL, INTENT(IN):: pkf(ip1jmp1, llm)
43 REAL, INTENT(IN):: phis(ip1jmp1)
44 REAL, INTENT(IN):: phi(iim + 1, jjm + 1, llm)
45 REAL dudyn(:, :, :) ! (iim + 1, jjm + 1, llm)
46 real dv((iim + 1) * jjm, llm)
47 REAL, INTENT(out):: dteta(ip1jmp1, llm)
48 real, INTENT(out):: dp(ip1jmp1)
49 REAL, INTENT(out):: w(:, :, :) ! (iim + 1, jjm + 1, llm)
50 REAL, intent(out):: pbaru(ip1jmp1, llm), pbarv((iim + 1) * jjm, llm)
51 REAL, intent(in):: time_0
52 LOGICAL, INTENT(IN):: conser
53
54 ! Local:
55 REAL vcont((iim + 1) * jjm, llm), ucont(ip1jmp1, llm)
56 REAL ang_3d(iim + 1, jjm + 1, llm), p(ip1jmp1, llmp1)
57 REAL massebx(ip1jmp1, llm), masseby((iim + 1) * jjm, llm)
58 REAL vorpot(iim + 1, jjm, llm)
59 real ecin(iim + 1, jjm + 1, llm), convm(ip1jmp1, llm)
60 REAL bern(iim + 1, jjm + 1, llm)
61 REAL massebxy(iim + 1, jjm, llm)
62 INTEGER ij, l
63 real heure, time
64
65 !-----------------------------------------------------------------------
66
67 CALL covcont(llm, ucov, vcov, ucont, vcont)
68 forall (l = 1: llm + 1) p(:, l) = ap(l) + bp(l) * ps
69 CALL massdair(p, masse)
70 CALL massbar(masse, massebx, masseby)
71 CALL massbarxy(masse, massebxy)
72 CALL flumass(massebx, masseby, vcont, ucont, pbaru, pbarv)
73 CALL dteta1(teta, pbaru, pbarv, dteta)
74 CALL convmas(pbaru, pbarv, convm)
75 dp = convm(:, 1) / airesurg
76 CALL vitvert(convm, w)
77 CALL tourpot(vcov, ucov, massebxy, vorpot)
78 CALL dudv1(vorpot, pbaru, pbarv, dudyn(:, 2: jjm, :), dv)
79 CALL enercin(vcov, ucov, vcont, ucont, ecin)
80 CALL bernoui(phi, ecin, bern)
81 CALL dudv2(teta, pkf, bern, dudyn, dv)
82
83 forall (l = 1: llm) ang_3d(:, :, l) = ucov(:, :, l) + constang_2d
84 CALL advect(ang_3d, vcov, teta, w, massebx, masseby, dudyn, dv, dteta)
85
86 ! Warning problème de périodicité de dv sur les PC Linux. Problème
87 ! d'arrondi probablement. Observé sur le code compilé avec pgf90
88 ! 3.0-1.
89 DO l = 1, llm
90 DO ij = 1, (iim + 1) * jjm, iip1
91 IF (dv(ij, l)/=dv(ij+iim, l)) THEN
92 dv(ij+iim, l) = dv(ij, l)
93 END IF
94 END DO
95 END DO
96
97 ! Sorties éventuelles des variables de contrôle :
98 IF (conser) then
99 CALL sortvarc(ucov, teta, ps, masse, pk, phis, vorpot, phi, bern, dp, &
100 resetvarc = .false.)
101 time = real(itau) / day_step + time_0
102 heure = mod(itau * dtvr / daysec, 1.) * 24.
103 IF (abs(heure-24.) <= 1e-4) heure = 0.
104
105 PRINT 3500, itau, int(day_ini + time), heure, time
106 PRINT 4000, ptot, rmsdpdt, etot, ztot, stot, rmsv, ang
107 end IF
108
109 3500 FORMAT (4X, 'pas', I7, 5X, 'jour', i5, 1X, 'heure', F5.1, 4X, 'date', &
110 F10.5)
111 4000 FORMAT (10X, 'masse', 4X, 'rmsdpdt', 7X, 'energie', 2X, 'enstrophie', &
112 2X, 'entropie', 3X, 'rmsv', 4X, 'mt.ang', /, 'GLOB ', F10.6, &
113 E13.6, 5F10.3/)
114
115 END SUBROUTINE caldyn
116
117 end module caldyn_m

  ViewVC Help
Powered by ViewVC 1.1.21