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