[1632] | 1 | ! |
---|
| 2 | ! $Id: caladvtrac_p.F 1299 2010-01-20 14:27:21Z fairhead $ |
---|
| 3 | ! |
---|
[5246] | 4 | ! |
---|
| 5 | ! |
---|
| 6 | SUBROUTINE caladvtrac_loc(q,pbaru,pbarv , & |
---|
| 7 | p ,masse, dq , teta, & |
---|
| 8 | flxw, pk, iapptrac) |
---|
| 9 | USE parallel_lmdz |
---|
| 10 | USE infotrac, ONLY : nqtot |
---|
| 11 | USE control_mod, ONLY : iapp_tracvl,planet_type |
---|
| 12 | USE caladvtrac_mod |
---|
| 13 | USE mod_hallo |
---|
| 14 | USE bands |
---|
| 15 | USE times |
---|
| 16 | USE Vampir |
---|
| 17 | USE write_field_loc |
---|
[5258] | 18 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DEBUGIO |
---|
[5271] | 19 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
[5285] | 20 | USE paramet_mod_h |
---|
[5271] | 21 | IMPLICIT NONE |
---|
[5246] | 22 | ! |
---|
| 23 | ! Auteurs: F.Hourdin , P.Le Van, F.Forget, F.Codron |
---|
| 24 | ! |
---|
| 25 | ! F.Codron (10/99) : ajout humidite specifique pour eau vapeur |
---|
| 26 | !======================================================================= |
---|
| 27 | ! |
---|
| 28 | ! Shema de Van Leer |
---|
| 29 | ! |
---|
| 30 | !======================================================================= |
---|
[1632] | 31 | |
---|
| 32 | |
---|
[5271] | 33 | |
---|
[1632] | 34 | |
---|
[5272] | 35 | |
---|
[5246] | 36 | ! Arguments: |
---|
| 37 | ! ---------- |
---|
| 38 | REAL :: pbaru( ijb_u:ije_u,llm ),pbarv( ijb_v:ije_v,llm) |
---|
| 39 | REAL :: masse(ijb_u:ije_u,llm) |
---|
| 40 | REAL :: p( ijb_u:ije_u,llmp1) |
---|
| 41 | REAL :: q( ijb_u:ije_u,llm,nqtot),dq( ijb_u:ije_u,llm, nqtot ) |
---|
| 42 | REAL :: teta( ijb_u:ije_u,llm),pk( ijb_u:ije_u,llm) |
---|
| 43 | REAL :: flxw(ijb_u:ije_u,llm) |
---|
| 44 | INTEGER :: iapptrac |
---|
| 45 | ! Local: |
---|
| 46 | ! ------ |
---|
| 47 | ! REAL :: pbarug(ijb_u:ije_u,llm) |
---|
| 48 | ! REAL :: pbarvg(ijb_v:ije_v,llm) |
---|
| 49 | ! REAL :: wg(ijb_u:ije_u,llm) |
---|
| 50 | |
---|
| 51 | REAL :: flxw_adv(distrib_vanleer%ijb_u:distrib_vanleer%ije_u,llm) |
---|
| 52 | INTEGER,SAVE :: iadvtr=0 |
---|
[1632] | 53 | !$OMP THREADPRIVATE(iadvtr) |
---|
[5246] | 54 | INTEGER :: ijb,ije,ijbu,ijbv,ijeu,ijev,j |
---|
| 55 | INTEGER :: ij,l |
---|
| 56 | TYPE(Request),SAVE :: Request_vanleer |
---|
[1848] | 57 | !$OMP THREADPRIVATE(Request_vanleer) |
---|
[1632] | 58 | |
---|
[5246] | 59 | ! !write(*,*) 'caladvtrac 58: entree' |
---|
| 60 | ijbu=ij_begin |
---|
| 61 | ijeu=ij_end |
---|
[1632] | 62 | |
---|
[5246] | 63 | ijbv=ij_begin-iip1 |
---|
| 64 | ijev=ij_end |
---|
| 65 | if (pole_nord) ijbv=ij_begin |
---|
| 66 | if (pole_sud) ijev=ij_end-iip1 |
---|
[1632] | 67 | |
---|
[5246] | 68 | IF(iadvtr.EQ.0) THEN |
---|
| 69 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 70 | DO l=1,llm |
---|
| 71 | pbaruc(ijbu:ijeu,l)=0. |
---|
| 72 | pbarvc(ijbv:ijev,l)=0. |
---|
| 73 | ENDDO |
---|
| 74 | !$OMP END DO NOWAIT |
---|
| 75 | ENDIF |
---|
[1632] | 76 | |
---|
[5246] | 77 | ! accumulation des flux de masse horizontaux |
---|
| 78 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 79 | DO l=1,llm |
---|
| 80 | DO ij = ijbu,ijeu |
---|
| 81 | pbaruc(ij,l) = pbaruc(ij,l) + pbaru(ij,l) |
---|
| 82 | ENDDO |
---|
| 83 | DO ij = ijbv,ijev |
---|
| 84 | pbarvc(ij,l) = pbarvc(ij,l) + pbarv(ij,l) |
---|
| 85 | ENDDO |
---|
| 86 | ENDDO |
---|
| 87 | !$OMP END DO NOWAIT |
---|
[1632] | 88 | |
---|
[5246] | 89 | ! selection de la masse instantannee des mailles avant le transport. |
---|
| 90 | IF(iadvtr.EQ.0) THEN |
---|
[1632] | 91 | |
---|
[5246] | 92 | ijb=ij_begin |
---|
| 93 | ije=ij_end |
---|
[1632] | 94 | |
---|
[5246] | 95 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 96 | DO l=1,llm |
---|
| 97 | massem(ijb:ije,l)=masse(ijb:ije,l) |
---|
| 98 | ENDDO |
---|
| 99 | !$OMP END DO NOWAIT |
---|
[1632] | 100 | |
---|
[5246] | 101 | ENDIF |
---|
[1632] | 102 | |
---|
[5246] | 103 | iadvtr = iadvtr+1 |
---|
[1632] | 104 | |
---|
[5246] | 105 | !$OMP MASTER |
---|
| 106 | iapptrac = iadvtr |
---|
| 107 | !$OMP END MASTER |
---|
[1632] | 108 | |
---|
[5246] | 109 | ! Test pour savoir si on advecte a ce pas de temps |
---|
[1632] | 110 | |
---|
[5246] | 111 | IF ( iadvtr.EQ.iapp_tracvl ) THEN |
---|
| 112 | ! !write(*,*) 'caladvtrac 133' |
---|
| 113 | !$OMP MASTER |
---|
| 114 | call suspend_timer(timer_caldyn) |
---|
| 115 | !$OMP END MASTER |
---|
[1804] | 116 | |
---|
[5246] | 117 | ijb=ij_begin |
---|
| 118 | ije=ij_end |
---|
[1632] | 119 | |
---|
[5246] | 120 | !c .. Modif P.Le Van ( 20/12/97 ) .... |
---|
| 121 | !c |
---|
[1804] | 122 | |
---|
[5246] | 123 | ! traitement des flux de masse avant advection. |
---|
| 124 | ! 1. calcul de w |
---|
| 125 | ! 2. groupement des mailles pres du pole. |
---|
| 126 | |
---|
| 127 | CALL groupe_loc( massem, pbaruc,pbarvc, pbarug,pbarvg,wg ) |
---|
| 128 | |
---|
| 129 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 130 | DO l=1,llm |
---|
| 131 | flxw(ijb:ije,l)=wg(ijb:ije,l)/REAL(iapp_tracvl) |
---|
| 132 | ENDDO |
---|
| 133 | !$OMP ENDDO NOWAIT |
---|
| 134 | |
---|
[5258] | 135 | IF (CPPKEY_DEBUGIO) THEN |
---|
[5246] | 136 | CALL WriteField_u('pbarug1',pbarug) |
---|
| 137 | CALL WriteField_v('pbarvg1',pbarvg) |
---|
| 138 | CALL WriteField_u('wg1',wg) |
---|
[5258] | 139 | END IF |
---|
[1632] | 140 | |
---|
[5246] | 141 | !$OMP BARRIER |
---|
[1632] | 142 | |
---|
| 143 | |
---|
[5246] | 144 | !$OMP MASTER |
---|
| 145 | call VTb(VTHallo) |
---|
| 146 | !$OMP END MASTER |
---|
[1632] | 147 | |
---|
[5246] | 148 | call Register_SwapField_u(pbarug,pbarug_adv, distrib_vanleer, & |
---|
| 149 | Request_vanleer) |
---|
| 150 | call Register_SwapField_v(pbarvg,pbarvg_adv, distrib_vanleer, & |
---|
| 151 | Request_vanleer,up=1) |
---|
| 152 | call Register_SwapField_u(massem,massem_adv, distrib_vanleer, & |
---|
| 153 | Request_vanleer) |
---|
| 154 | call Register_SwapField_u(wg,wg_adv,distrib_vanleer, & |
---|
| 155 | Request_vanleer) |
---|
| 156 | call Register_SwapField_u(teta,teta_adv, distrib_vanleer, & |
---|
| 157 | Request_vanleer,up=1,down=1) |
---|
| 158 | call Register_SwapField_u(p,p_adv, distrib_vanleer, & |
---|
| 159 | Request_vanleer,up=1,down=1) |
---|
| 160 | call Register_SwapField_u(pk,pk_adv, distrib_vanleer, & |
---|
| 161 | Request_vanleer,up=1,down=1) |
---|
| 162 | call Register_SwapField_u(q,q_adv, distrib_vanleer, & |
---|
| 163 | Request_vanleer) |
---|
[1632] | 164 | |
---|
[5246] | 165 | call SendRequest(Request_vanleer) |
---|
| 166 | !$OMP BARRIER |
---|
| 167 | call WaitRequest(Request_vanleer) |
---|
[1632] | 168 | |
---|
| 169 | |
---|
[5246] | 170 | !$OMP BARRIER |
---|
| 171 | !$OMP MASTER |
---|
| 172 | call Set_Distrib(distrib_vanleer) |
---|
| 173 | call VTe(VTHallo) |
---|
| 174 | call VTb(VTadvection) |
---|
| 175 | call start_timer(timer_vanleer) |
---|
| 176 | !$OMP END MASTER |
---|
| 177 | !$OMP BARRIER |
---|
| 178 | ! CALL WriteField_u('pbarug_adv',pbarug_adv) |
---|
| 179 | ! CALL WriteField_u('',) |
---|
| 180 | |
---|
| 181 | |
---|
[5258] | 182 | IF (CPPKEY_DEBUGIO) THEN |
---|
[5246] | 183 | CALL WriteField_u('pbarug1',pbarug_adv) |
---|
| 184 | CALL WriteField_v('pbarvg1',pbarvg_adv) |
---|
| 185 | CALL WriteField_u('wg1',wg_adv) |
---|
[5258] | 186 | END IF |
---|
[5246] | 187 | ! !write(*,*) 'caladvtrac 185' |
---|
| 188 | CALL advtrac_loc( pbarug_adv,pbarvg_adv,wg_adv, & |
---|
| 189 | p_adv, massem_adv,q_adv, teta_adv, & |
---|
| 190 | pk_adv) |
---|
| 191 | ! !write(*,*) 'caladvtrac 189' |
---|
[1632] | 192 | |
---|
| 193 | |
---|
[5246] | 194 | !$OMP MASTER |
---|
| 195 | call VTe(VTadvection) |
---|
| 196 | call stop_timer(timer_vanleer) |
---|
| 197 | call VTb(VThallo) |
---|
| 198 | !$OMP END MASTER |
---|
[1632] | 199 | |
---|
[5246] | 200 | call Register_SwapField_u(q_adv,q,distrib_caldyn, & |
---|
| 201 | Request_vanleer) |
---|
[1632] | 202 | |
---|
[5246] | 203 | call SendRequest(Request_vanleer) |
---|
| 204 | !$OMP BARRIER |
---|
| 205 | call WaitRequest(Request_vanleer) |
---|
[1632] | 206 | |
---|
[5246] | 207 | !$OMP BARRIER |
---|
| 208 | !$OMP MASTER |
---|
| 209 | call Set_Distrib(distrib_caldyn) |
---|
| 210 | call VTe(VThallo) |
---|
| 211 | call resume_timer(timer_caldyn) |
---|
| 212 | !$OMP END MASTER |
---|
| 213 | !$OMP BARRIER |
---|
| 214 | iadvtr=0 |
---|
| 215 | ENDIF ! if iadvtr.EQ.iapp_tracvl |
---|
[1632] | 216 | |
---|
[5246] | 217 | END SUBROUTINE caladvtrac_loc |
---|
[1632] | 218 | |
---|
| 219 | |
---|