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