[2021] | 1 | module exner_hyb_loc_m |
---|
[1632] | 2 | |
---|
[5281] | 3 | USE comgeom_mod_h |
---|
| 4 | IMPLICIT NONE |
---|
[1632] | 5 | |
---|
[2021] | 6 | contains |
---|
[1632] | 7 | |
---|
[2021] | 8 | SUBROUTINE exner_hyb_loc(ngrid, ps, p, pks,pk,pkf) |
---|
[1632] | 9 | |
---|
[2021] | 10 | ! Auteurs : P.Le Van , Fr. Hourdin . |
---|
| 11 | ! .......... |
---|
| 12 | ! |
---|
| 13 | ! .... ngrid, ps,p sont des argum.d'entree au sous-prog ... |
---|
| 14 | ! .... pks,pk,pkf sont des argum.de sortie au sous-prog ... |
---|
| 15 | ! |
---|
| 16 | ! ************************************************************************ |
---|
[5281] | 17 | ! Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des |
---|
[2021] | 18 | ! couches . Pk(l) sera calcule aux milieux des couches l ,entre les |
---|
| 19 | ! pressions p(l) et p(l+1) ,definis aux interfaces des llm couches . |
---|
| 20 | ! ************************************************************************ |
---|
| 21 | ! .. N.B : Au sommet de l'atmosphere, p(llm+1) = 0. , et ps et pks sont |
---|
| 22 | ! la pression et la fonction d'Exner au sol . |
---|
| 23 | ! |
---|
| 24 | ! -------- z |
---|
| 25 | ! A partir des relations ( 1 ) p*dz(pk) = kappa *pk*dz(p) et |
---|
| 26 | ! ( 2 ) pk(l) = alpha(l)+ beta(l)*pk(l-1) |
---|
| 27 | ! ( voir note de Fr.Hourdin ) , |
---|
| 28 | ! |
---|
[5281] | 29 | ! on determine successivement , du haut vers le bas des couches, les |
---|
| 30 | ! coef. alpha(llm),beta(llm) .,.,alpha(l),beta(l),,,alpha(2),beta(2), |
---|
| 31 | ! puis pk(ij,1). Ensuite ,on calcule,du bas vers le haut des couches, |
---|
[2021] | 32 | ! pk(ij,l) donne par la relation (2), pour l = 2 a l = llm . |
---|
| 33 | ! |
---|
| 34 | ! |
---|
| 35 | USE parallel_lmdz |
---|
| 36 | USE mod_filtreg_p |
---|
| 37 | USE write_field_loc |
---|
[2597] | 38 | USE comconst_mod, ONLY: cpp, kappa, r, jmp1 |
---|
[2600] | 39 | USE comvert_mod, ONLY: preff |
---|
[5271] | 40 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
[5285] | 41 | USE paramet_mod_h |
---|
[5271] | 42 | IMPLICIT NONE |
---|
[2021] | 43 | ! |
---|
[5271] | 44 | |
---|
[5272] | 45 | |
---|
[1657] | 46 | |
---|
[2021] | 47 | INTEGER ngrid |
---|
| 48 | REAL p(ijb_u:ije_u,llmp1),pk(ijb_u:ije_u,llm) |
---|
| 49 | REAL, optional:: pkf(ijb_u:ije_u,llm) |
---|
| 50 | REAL ps(ijb_u:ije_u),pks(ijb_u:ije_u) |
---|
| 51 | REAL alpha(ijb_u:ije_u,llm),beta(ijb_u:ije_u,llm) |
---|
| 52 | |
---|
| 53 | ! .... variables locales ... |
---|
| 54 | |
---|
| 55 | INTEGER l, ij |
---|
| 56 | REAL unpl2k,dellta |
---|
| 57 | |
---|
| 58 | INTEGER ije,ijb,jje,jjb |
---|
| 59 | logical,save :: firstcall=.true. |
---|
| 60 | !$OMP THREADPRIVATE(firstcall) |
---|
| 61 | character(len=*),parameter :: modname="exner_hyb_loc" |
---|
| 62 | ! |
---|
| 63 | !$OMP BARRIER |
---|
| 64 | |
---|
| 65 | ! Sanity check |
---|
| 66 | if (firstcall) then |
---|
| 67 | ! sanity checks for Shallow Water case (1 vertical layer) |
---|
| 68 | if (llm.eq.1) then |
---|
[1673] | 69 | if (kappa.ne.1) then |
---|
[2021] | 70 | call abort_gcm(modname, & |
---|
| 71 | "kappa!=1 , but running in Shallow Water mode!!",42) |
---|
[1673] | 72 | endif |
---|
| 73 | if (cpp.ne.r) then |
---|
[2021] | 74 | call abort_gcm(modname, & |
---|
| 75 | "cpp!=r , but running in Shallow Water mode!!",42) |
---|
[1673] | 76 | endif |
---|
[2021] | 77 | endif ! of if (llm.eq.1) |
---|
[1673] | 78 | |
---|
[2021] | 79 | firstcall=.false. |
---|
| 80 | endif ! of if (firstcall) |
---|
[1673] | 81 | |
---|
[2021] | 82 | !$OMP BARRIER |
---|
[1673] | 83 | |
---|
[2021] | 84 | ! Specific behaviour for Shallow Water (1 vertical layer) case: |
---|
| 85 | if (llm.eq.1) then |
---|
[1657] | 86 | |
---|
[2021] | 87 | ! Compute pks(:),pk(:),pkf(:) |
---|
| 88 | ijb=ij_begin |
---|
| 89 | ije=ij_end |
---|
| 90 | !$OMP DO SCHEDULE(STATIC) |
---|
| 91 | DO ij=ijb, ije |
---|
| 92 | pks(ij) = (cpp/preff) * ps(ij) |
---|
[1657] | 93 | pk(ij,1) = .5*pks(ij) |
---|
[2021] | 94 | if (present(pkf)) pkf(ij,1)=pk(ij,1) |
---|
| 95 | ENDDO |
---|
| 96 | !$OMP ENDDO |
---|
[1657] | 97 | |
---|
[2021] | 98 | !$OMP BARRIER |
---|
| 99 | if (present(pkf)) then |
---|
| 100 | jjb=jj_begin |
---|
| 101 | jje=jj_end |
---|
| 102 | CALL filtreg_p ( pkf,jjb_u,jje_u,jjb,jje, jmp1, llm, & |
---|
| 103 | 2, 1, .TRUE., 1 ) |
---|
| 104 | end if |
---|
[1657] | 105 | |
---|
[2021] | 106 | ! our work is done, exit routine |
---|
| 107 | return |
---|
| 108 | endif ! of if (llm.eq.1) |
---|
[1657] | 109 | |
---|
[2021] | 110 | ! General case: |
---|
[1632] | 111 | |
---|
[2021] | 112 | unpl2k = 1.+ 2.* kappa |
---|
[1632] | 113 | |
---|
[2021] | 114 | ! ------------- |
---|
| 115 | ! Calcul de pks |
---|
| 116 | ! ------------- |
---|
| 117 | |
---|
| 118 | ijb=ij_begin |
---|
| 119 | ije=ij_end |
---|
| 120 | |
---|
| 121 | !$OMP DO SCHEDULE(STATIC) |
---|
| 122 | DO ij = ijb, ije |
---|
| 123 | pks(ij) = cpp * ( ps(ij)/preff ) ** kappa |
---|
| 124 | ENDDO |
---|
| 125 | !$OMP ENDDO |
---|
| 126 | ! Synchro OPENMP ici |
---|
| 127 | |
---|
| 128 | !$OMP BARRIER |
---|
| 129 | ! |
---|
| 130 | ! |
---|
| 131 | ! .... Calcul des coeff. alpha et beta pour la couche l = llm .. |
---|
| 132 | ! |
---|
| 133 | !$OMP DO SCHEDULE(STATIC) |
---|
| 134 | DO ij = ijb,ije |
---|
[1632] | 135 | alpha(ij,llm) = 0. |
---|
| 136 | beta (ij,llm) = 1./ unpl2k |
---|
[2021] | 137 | ENDDO |
---|
| 138 | !$OMP ENDDO NOWAIT |
---|
| 139 | ! |
---|
| 140 | ! ... Calcul des coeff. alpha et beta pour l = llm-1 a l = 2 ... |
---|
| 141 | ! |
---|
| 142 | DO l = llm -1 , 2 , -1 |
---|
| 143 | ! |
---|
| 144 | !$OMP DO SCHEDULE(STATIC) |
---|
| 145 | DO ij = ijb, ije |
---|
| 146 | dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k ) |
---|
| 147 | alpha(ij,l) = - p(ij,l+1) / dellta * alpha(ij,l+1) |
---|
| 148 | beta (ij,l) = p(ij,l ) / dellta |
---|
| 149 | ENDDO |
---|
| 150 | !$OMP ENDDO NOWAIT |
---|
| 151 | ENDDO |
---|
[1632] | 152 | |
---|
[2021] | 153 | ! *********************************************************************** |
---|
| 154 | ! ..... Calcul de pk pour la couche 1 , pres du sol .... |
---|
| 155 | ! |
---|
| 156 | !$OMP DO SCHEDULE(STATIC) |
---|
| 157 | DO ij = ijb, ije |
---|
| 158 | pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) ) / & |
---|
| 159 | ( p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) ) |
---|
| 160 | ENDDO |
---|
| 161 | !$OMP ENDDO NOWAIT |
---|
| 162 | ! |
---|
| 163 | ! ..... Calcul de pk(ij,l) , pour l = 2 a l = llm ........ |
---|
| 164 | ! |
---|
| 165 | DO l = 2, llm |
---|
| 166 | !$OMP DO SCHEDULE(STATIC) |
---|
| 167 | DO ij = ijb, ije |
---|
| 168 | pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1) |
---|
| 169 | ENDDO |
---|
| 170 | !$OMP ENDDO NOWAIT |
---|
| 171 | ENDDO |
---|
[1632] | 172 | |
---|
[2021] | 173 | if (present(pkf)) then |
---|
| 174 | ! calcul de pkf |
---|
| 175 | |
---|
| 176 | DO l = 1, llm |
---|
| 177 | !$OMP DO SCHEDULE(STATIC) |
---|
| 178 | DO ij = ijb, ije |
---|
| 179 | pkf(ij,l)=pk(ij,l) |
---|
| 180 | ENDDO |
---|
| 181 | !$OMP ENDDO NOWAIT |
---|
| 182 | ENDDO |
---|
| 183 | |
---|
| 184 | !$OMP BARRIER |
---|
| 185 | |
---|
| 186 | jjb=jj_begin |
---|
| 187 | jje=jj_end |
---|
| 188 | CALL filtreg_p ( pkf,jjb_u,jje_u,jjb,jje, jmp1, llm, & |
---|
| 189 | 2, 1, .TRUE., 1 ) |
---|
| 190 | end if |
---|
[1632] | 191 | |
---|
[2021] | 192 | END SUBROUTINE exner_hyb_loc |
---|
| 193 | |
---|
| 194 | end module exner_hyb_loc_m |
---|