1 | SUBROUTINE caldyn_loc & |
---|
2 | (itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , & |
---|
3 | phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time ) |
---|
4 | USE comgeom_mod_h |
---|
5 | USE parallel_lmdz |
---|
6 | USE Write_Field_loc |
---|
7 | USE caldyn_mod, ONLY: vcont, ucont, ang, p, massebx, masseby, & |
---|
8 | vorpot, ecin, bern, massebxy, convm |
---|
9 | USE comvert_mod, ONLY: ap, bp |
---|
10 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DEBUGIO |
---|
11 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
12 | USE paramet_mod_h |
---|
13 | IMPLICIT NONE |
---|
14 | |
---|
15 | !======================================================================= |
---|
16 | ! |
---|
17 | ! Auteur : P. Le Van |
---|
18 | ! |
---|
19 | ! Objet: |
---|
20 | ! ------ |
---|
21 | ! |
---|
22 | ! Calcul des tendances dynamiques. |
---|
23 | ! |
---|
24 | ! Modif 04/93 F.Forget |
---|
25 | !======================================================================= |
---|
26 | |
---|
27 | !----------------------------------------------------------------------- |
---|
28 | ! 0. Declarations: |
---|
29 | ! ---------------- |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | ! Arguments: |
---|
35 | ! ---------- |
---|
36 | |
---|
37 | LOGICAL,INTENT(IN) :: conser ! triggers printing some diagnostics ! not used |
---|
38 | INTEGER,INTENT(IN) :: itau ! time step index ! not used |
---|
39 | REAL,INTENT(IN) :: vcov(ijb_v:ije_v,llm) ! covariant meridional wind |
---|
40 | REAL,INTENT(IN) :: ucov(ijb_u:ije_u,llm) ! covariant zonal wind |
---|
41 | REAL,INTENT(IN) :: teta(ijb_u:ije_u,llm) ! potential temperature |
---|
42 | REAL,INTENT(IN) :: ps(ijb_u:ije_u) ! surface pressure |
---|
43 | REAL,INTENT(IN) :: phis(ijb_u:ije_u) ! geopotential at the surface |
---|
44 | REAL,INTENT(IN) :: pk(iip1,jjb_u:jje_u,llm) ! Exner at mid-layer |
---|
45 | REAL,INTENT(IN) :: pkf(ijb_u:ije_u,llm) ! filtered Exner |
---|
46 | REAL,INTENT(IN) :: phi(ijb_u:ije_u,llm) ! geopotential |
---|
47 | REAL,INTENT(OUT) :: masse(ijb_u:ije_u,llm) ! air mass |
---|
48 | REAL,INTENT(OUT) :: dv(ijb_v:ije_v,llm) ! tendency on vcov |
---|
49 | REAL,INTENT(OUT) :: du(ijb_u:ije_u,llm) ! tendency on ucov |
---|
50 | REAL,INTENT(OUT) :: dteta(ijb_u:ije_u,llm) ! tenddency on teta |
---|
51 | REAL,INTENT(OUT) :: dp(ijb_u:ije_u) ! tendency on ps |
---|
52 | REAL,INTENT(OUT) :: w(ijb_u:ije_u,llm) ! vertical velocity |
---|
53 | REAL,INTENT(OUT) :: pbaru(ijb_u:ije_u,llm) ! mass flux in the zonal direction |
---|
54 | REAL,INTENT(OUT) :: pbarv(ijb_v:ije_v,llm) ! mass flux in the meridional direction |
---|
55 | REAL,INTENT(IN) :: time ! current time |
---|
56 | |
---|
57 | ! Local: |
---|
58 | ! ------ |
---|
59 | |
---|
60 | INTEGER :: ij,l,ijb,ije,ierr |
---|
61 | |
---|
62 | |
---|
63 | !----------------------------------------------------------------------- |
---|
64 | ! Compute dynamical tendencies: |
---|
65 | !-------------------------------- |
---|
66 | |
---|
67 | ! ! compute contravariant winds ucont() and vcont |
---|
68 | CALL covcont_loc ( llm , ucov , vcov , ucont, vcont ) |
---|
69 | ! ! compute pressure p() |
---|
70 | CALL pression_loc ( ip1jmp1, ap , bp , ps , p ) |
---|
71 | !ym CALL psextbar ( ps , psexbarxy ) |
---|
72 | !$OMP BARRIER |
---|
73 | ! ! compute mass in each atmospheric mesh: masse() |
---|
74 | CALL massdair_loc ( p , masse ) |
---|
75 | ! ! compute X and Y-averages of mass, massebx() and masseby() |
---|
76 | CALL massbar_loc ( masse, massebx , masseby ) |
---|
77 | ! ! compute XY-average of mass, massebxy() |
---|
78 | call massbarxy_loc( masse, massebxy ) |
---|
79 | ! ! compute mass fluxes pbaru() and pbarv() |
---|
80 | CALL flumass_loc ( massebx, masseby,vcont,ucont,pbaru,pbarv ) |
---|
81 | ! ! compute dteta() , horizontal converging flux of theta |
---|
82 | CALL dteta1_loc ( teta , pbaru , pbarv, dteta ) |
---|
83 | ! ! compute convm(), horizontal converging flux of mass |
---|
84 | CALL convmas1_loc ( pbaru, pbarv , convm ) |
---|
85 | !$OMP BARRIER |
---|
86 | CALL convmas2_loc ( convm ) |
---|
87 | !$OMP BARRIER |
---|
88 | IF (CPPKEY_DEBUGIO) THEN |
---|
89 | call WriteField_u('ucont',ucont) |
---|
90 | call WriteField_v('vcont',vcont) |
---|
91 | call WriteField_u('p',p) |
---|
92 | call WriteField_u('masse',masse) |
---|
93 | call WriteField_u('massebx',massebx) |
---|
94 | call WriteField_v('masseby',masseby) |
---|
95 | call WriteField_v('massebxy',massebxy) |
---|
96 | call WriteField_u('pbaru',pbaru) |
---|
97 | call WriteField_v('pbarv',pbarv) |
---|
98 | call WriteField_u('dteta',dteta) |
---|
99 | call WriteField_u('convm',convm) |
---|
100 | END IF |
---|
101 | |
---|
102 | !$OMP BARRIER |
---|
103 | !$OMP MASTER |
---|
104 | ijb=ij_begin |
---|
105 | ije=ij_end |
---|
106 | ! ! compute pressure variation due to mass convergence |
---|
107 | DO ij =ijb, ije |
---|
108 | dp( ij ) = convm( ij,1 ) / airesurg( ij ) |
---|
109 | ENDDO |
---|
110 | !$OMP END MASTER |
---|
111 | !$OMP BARRIER |
---|
112 | |
---|
113 | ! ! compute vertical velocity w() |
---|
114 | CALL vitvert_loc ( convm , w ) |
---|
115 | ! ! compute potential vorticity vorpot() |
---|
116 | CALL tourpot_loc ( vcov , ucov , massebxy , vorpot ) |
---|
117 | ! ! compute rotation induced du() and dv() |
---|
118 | CALL dudv1_loc ( vorpot , pbaru , pbarv , du , dv ) |
---|
119 | |
---|
120 | IF (CPPKEY_DEBUGIO) THEN |
---|
121 | call WriteField_u('w',w) |
---|
122 | call WriteField_v('vorpot',vorpot) |
---|
123 | call WriteField_u('du',du) |
---|
124 | call WriteField_v('dv',dv) |
---|
125 | END IF |
---|
126 | |
---|
127 | ! ! compute kinetic energy ecin() |
---|
128 | CALL enercin_loc ( vcov , ucov , vcont , ucont , ecin ) |
---|
129 | ! ! compute Bernouilli function bern() |
---|
130 | CALL bernoui_loc ( ip1jmp1, llm , phi , ecin , bern) |
---|
131 | ! ! compute and add du() and dv() contributions from Bernouilli and pressure |
---|
132 | CALL dudv2_loc ( teta , pkf , bern , du , dv ) |
---|
133 | |
---|
134 | IF (CPPKEY_DEBUGIO) THEN |
---|
135 | call WriteField_u('ecin',ecin) |
---|
136 | call WriteField_u('bern',bern) |
---|
137 | call WriteField_u('du',du) |
---|
138 | call WriteField_v('dv',dv) |
---|
139 | call WriteField_u('pkf',pkf) |
---|
140 | END IF |
---|
141 | |
---|
142 | ijb=ij_begin-iip1 |
---|
143 | ije=ij_end+iip1 |
---|
144 | |
---|
145 | if (pole_nord) ijb=ij_begin |
---|
146 | if (pole_sud) ije=ij_end |
---|
147 | |
---|
148 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
149 | DO l=1,llm |
---|
150 | DO ij=ijb,ije |
---|
151 | ang(ij,l) = ucov(ij,l) + constang(ij) |
---|
152 | ENDDO |
---|
153 | ENDDO |
---|
154 | !$OMP END DO |
---|
155 | |
---|
156 | ! ! compute vertical advection contributions to du(), dv() and dteta() |
---|
157 | CALL advect_new_loc(ang,vcov,teta,w,massebx,masseby,du,dv,dteta) |
---|
158 | |
---|
159 | ! WARNING probleme de peridocite de dv sur les PC/linux. Pb d'arrondi |
---|
160 | ! probablement. Observe sur le code compile avec pgf90 3.0-1 |
---|
161 | ijb=ij_begin |
---|
162 | ije=ij_end |
---|
163 | if (pole_sud) ije=ij_end-iip1 |
---|
164 | |
---|
165 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
166 | DO l = 1, llm |
---|
167 | DO ij = ijb, ije, iip1 |
---|
168 | IF( dv(ij,l).NE.dv(ij+iim,l) ) THEN |
---|
169 | ! PRINT *,'!!!ATTENTION!!! probleme de periodicite sur vcov', |
---|
170 | ! , ' dans caldyn' |
---|
171 | ! PRINT *,' l, ij = ', l, ij, ij+iim,dv(ij+iim,l),dv(ij,l) |
---|
172 | dv(ij+iim,l) = dv(ij,l) |
---|
173 | endif |
---|
174 | enddo |
---|
175 | enddo |
---|
176 | !$OMP END DO NOWAIT |
---|
177 | |
---|
178 | ! Ehouarn: NB: output of control variables not implemented... |
---|
179 | |
---|
180 | RETURN |
---|
181 | END SUBROUTINE caldyn_loc |
---|