[1632] | 1 | ! $Id: friction_p.F 1299 2010-01-20 14:27:21Z fairhead $ |
---|
[5099] | 2 | |
---|
[1673] | 3 | !======================================================================= |
---|
[5118] | 4 | SUBROUTINE friction_loc(ucov, vcov, pdt) |
---|
[5105] | 5 | USE parallel_lmdz |
---|
| 6 | USE control_mod |
---|
| 7 | USE IOIPSL |
---|
| 8 | USE comconst_mod, ONLY: pi |
---|
[5118] | 9 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5134] | 10 | USE lmdz_academic, ONLY: tetarappel, knewt_t, kfrict, knewt_g, clat4 |
---|
[5136] | 11 | USE lmdz_comgeom2 |
---|
[5128] | 12 | |
---|
[5159] | 13 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 14 | USE lmdz_paramet |
---|
[5105] | 15 | IMPLICIT NONE |
---|
[5099] | 16 | |
---|
[5105] | 17 | !======================================================================= |
---|
[1632] | 18 | |
---|
[5105] | 19 | ! Friction for the Newtonian case: |
---|
| 20 | ! -------------------------------- |
---|
| 21 | ! 2 possibilities (depending on flag 'friction_type' |
---|
| 22 | ! friction_type=0 : A friction that is only applied to the lowermost |
---|
| 23 | ! atmospheric layer |
---|
| 24 | ! friction_type=1 : Friction applied on all atmospheric layer (but |
---|
| 25 | ! (default) with stronger magnitude near the surface; see |
---|
| 26 | ! iniacademic.F) |
---|
| 27 | !======================================================================= |
---|
[1632] | 28 | |
---|
[1673] | 29 | |
---|
[5159] | 30 | |
---|
| 31 | |
---|
[5105] | 32 | ! arguments: |
---|
[5118] | 33 | REAL, INTENT(INOUT) :: ucov(iip1, jjb_u:jje_u, llm) |
---|
| 34 | REAL, INTENT(INOUT) :: vcov(iip1, jjb_v:jje_v, llm) |
---|
| 35 | REAL, INTENT(IN) :: pdt ! time step |
---|
[1673] | 36 | |
---|
[5105] | 37 | ! local variables: |
---|
| 38 | |
---|
[5118] | 39 | REAL :: modv(iip1, jjb_u:jje_u), zco, zsi |
---|
| 40 | REAL :: vpn, vps, upoln, upols, vpols, vpoln |
---|
| 41 | REAL :: u2(iip1, jjb_u:jje_u), v2(iip1, jjb_v:jje_v) |
---|
| 42 | INTEGER :: i, j, l |
---|
| 43 | REAL, PARAMETER :: cfric = 1.e-5 |
---|
| 44 | LOGICAL, SAVE :: firstcall = .TRUE. |
---|
| 45 | INTEGER, SAVE :: friction_type = 1 |
---|
| 46 | CHARACTER(len = 20) :: modname = "friction_p" |
---|
| 47 | CHARACTER(len = 80) :: abort_message |
---|
| 48 | !$OMP THREADPRIVATE(firstcall,friction_type) |
---|
| 49 | INTEGER :: jjb, jje |
---|
[1632] | 50 | |
---|
[5118] | 51 | !$OMP SINGLE |
---|
[5105] | 52 | IF (firstcall) THEN |
---|
[5113] | 53 | ! set friction type |
---|
[5118] | 54 | CALL getin("friction_type", friction_type) |
---|
[5117] | 55 | IF ((friction_type<0).OR.(friction_type>1)) THEN |
---|
[5118] | 56 | abort_message = "wrong friction type" |
---|
| 57 | WRITE(lunout, *)'Friction: wrong friction type', friction_type |
---|
| 58 | CALL abort_gcm(modname, abort_message, 42) |
---|
[5105] | 59 | endif |
---|
[5118] | 60 | firstcall = .FALSE. |
---|
[5105] | 61 | ENDIF |
---|
[5118] | 62 | !$OMP END SINGLE COPYPRIVATE(friction_type,firstcall) |
---|
[1632] | 63 | |
---|
[5117] | 64 | IF (friction_type==0) then ! friction on first layer only |
---|
[5118] | 65 | !$OMP SINGLE |
---|
| 66 | ! calcul des composantes au carre du vent naturel |
---|
| 67 | jjb = jj_begin |
---|
| 68 | jje = jj_end + 1 |
---|
| 69 | IF (pole_sud) jje = jj_end |
---|
[1632] | 70 | |
---|
[5158] | 71 | DO j = jjb, jje |
---|
| 72 | DO i = 1, iip1 |
---|
[5118] | 73 | u2(i, j) = ucov(i, j, 1) * ucov(i, j, 1) * unscu2(i, j) |
---|
| 74 | enddo |
---|
| 75 | enddo |
---|
[1632] | 76 | |
---|
[5118] | 77 | jjb = jj_begin - 1 |
---|
| 78 | jje = jj_end + 1 |
---|
| 79 | IF (pole_nord) jjb = jj_begin |
---|
| 80 | IF (pole_sud) jje = jj_end - 1 |
---|
[1632] | 81 | |
---|
[5158] | 82 | DO j = jjb, jje |
---|
| 83 | DO i = 1, iip1 |
---|
[5118] | 84 | v2(i, j) = vcov(i, j, 1) * vcov(i, j, 1) * unscv2(i, j) |
---|
| 85 | enddo |
---|
| 86 | enddo |
---|
[1632] | 87 | |
---|
[5118] | 88 | ! calcul du module de V en dehors des poles |
---|
| 89 | jjb = jj_begin |
---|
| 90 | jje = jj_end + 1 |
---|
| 91 | IF (pole_nord) jjb = jj_begin + 1 |
---|
| 92 | IF (pole_sud) jje = jj_end - 1 |
---|
[1632] | 93 | |
---|
[5158] | 94 | DO j = jjb, jje |
---|
| 95 | DO i = 2, iip1 |
---|
[5118] | 96 | modv(i, j) = sqrt(0.5 * (u2(i - 1, j) + u2(i, j) + v2(i, j - 1) + v2(i, j))) |
---|
| 97 | enddo |
---|
| 98 | modv(1, j) = modv(iip1, j) |
---|
| 99 | enddo |
---|
[5105] | 100 | |
---|
[5118] | 101 | ! les deux composantes du vent au pole sont obtenues comme |
---|
| 102 | ! premiers modes de fourier de v pres du pole |
---|
| 103 | IF (pole_nord) THEN |
---|
| 104 | upoln = 0. |
---|
| 105 | vpoln = 0. |
---|
[5105] | 106 | |
---|
[5158] | 107 | DO i = 2, iip1 |
---|
[5118] | 108 | zco = cos(rlonv(i)) * (rlonu(i) - rlonu(i - 1)) |
---|
| 109 | zsi = sin(rlonv(i)) * (rlonu(i) - rlonu(i - 1)) |
---|
| 110 | vpn = vcov(i, 1, 1) / cv(i, 1) |
---|
| 111 | upoln = upoln + zco * vpn |
---|
| 112 | vpoln = vpoln + zsi * vpn |
---|
| 113 | enddo |
---|
| 114 | vpn = sqrt(upoln * upoln + vpoln * vpoln) / pi |
---|
[5158] | 115 | DO i = 1, iip1 |
---|
[5118] | 116 | ! modv(i,1)=vpn |
---|
| 117 | modv(i, 1) = modv(i, 2) |
---|
| 118 | enddo |
---|
[5105] | 119 | |
---|
[5118] | 120 | ENDIF |
---|
[5105] | 121 | |
---|
[5118] | 122 | IF (pole_sud) THEN |
---|
| 123 | upols = 0. |
---|
| 124 | vpols = 0. |
---|
[5158] | 125 | DO i = 2, iip1 |
---|
[5118] | 126 | zco = cos(rlonv(i)) * (rlonu(i) - rlonu(i - 1)) |
---|
| 127 | zsi = sin(rlonv(i)) * (rlonu(i) - rlonu(i - 1)) |
---|
| 128 | vps = vcov(i, jjm, 1) / cv(i, jjm) |
---|
| 129 | upols = upols + zco * vps |
---|
| 130 | vpols = vpols + zsi * vps |
---|
| 131 | enddo |
---|
| 132 | vps = sqrt(upols * upols + vpols * vpols) / pi |
---|
[5158] | 133 | DO i = 1, iip1 |
---|
[5118] | 134 | ! modv(i,jjp1)=vps |
---|
| 135 | modv(i, jjp1) = modv(i, jjm) |
---|
| 136 | enddo |
---|
[5105] | 137 | |
---|
[5118] | 138 | ENDIF |
---|
[5105] | 139 | |
---|
[5118] | 140 | ! calcul du frottement au sol. |
---|
[5105] | 141 | |
---|
[5118] | 142 | jjb = jj_begin |
---|
| 143 | jje = jj_end |
---|
| 144 | IF (pole_nord) jjb = jj_begin + 1 |
---|
| 145 | IF (pole_sud) jje = jj_end - 1 |
---|
[5105] | 146 | |
---|
[5158] | 147 | DO j = jjb, jje |
---|
| 148 | DO i = 1, iim |
---|
[5118] | 149 | ucov(i, j, 1) = ucov(i, j, 1) & |
---|
| 150 | - cfric * pdt * 0.5 * (modv(i + 1, j) + modv(i, j)) * ucov(i, j, 1) |
---|
| 151 | enddo |
---|
| 152 | ucov(iip1, j, 1) = ucov(1, j, 1) |
---|
| 153 | enddo |
---|
[5105] | 154 | |
---|
[5118] | 155 | jjb = jj_begin |
---|
| 156 | jje = jj_end |
---|
| 157 | IF (pole_sud) jje = jj_end - 1 |
---|
[5105] | 158 | |
---|
[5158] | 159 | DO j = jjb, jje |
---|
| 160 | DO i = 1, iip1 |
---|
[5118] | 161 | vcov(i, j, 1) = vcov(i, j, 1) & |
---|
| 162 | - cfric * pdt * 0.5 * (modv(i, j + 1) + modv(i, j)) * vcov(i, j, 1) |
---|
| 163 | enddo |
---|
| 164 | vcov(iip1, j, 1) = vcov(1, j, 1) |
---|
| 165 | enddo |
---|
| 166 | !$OMP END SINGLE |
---|
[5117] | 167 | ENDIF ! of if (friction_type.EQ.0) |
---|
[1632] | 168 | |
---|
[5117] | 169 | IF (friction_type==1) THEN |
---|
[5118] | 170 | ! for ucov() |
---|
| 171 | jjb = jj_begin |
---|
| 172 | jje = jj_end |
---|
| 173 | IF (pole_nord) jjb = jj_begin + 1 |
---|
| 174 | IF (pole_sud) jje = jj_end - 1 |
---|
[1673] | 175 | |
---|
[5118] | 176 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[5158] | 177 | DO l = 1, llm |
---|
[5118] | 178 | ucov(1:iip1, jjb:jje, l) = ucov(1:iip1, jjb:jje, l) * & |
---|
| 179 | (1. - pdt * kfrict(l)) |
---|
[5105] | 180 | enddo |
---|
[5118] | 181 | !$OMP END DO NOWAIT |
---|
[5105] | 182 | |
---|
[5118] | 183 | ! for vcoc() |
---|
| 184 | jjb = jj_begin |
---|
| 185 | jje = jj_end |
---|
| 186 | IF (pole_sud) jje = jj_end - 1 |
---|
[5105] | 187 | |
---|
[5118] | 188 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[5158] | 189 | DO l = 1, llm |
---|
[5118] | 190 | vcov(1:iip1, jjb:jje, l) = vcov(1:iip1, jjb:jje, l) * & |
---|
| 191 | (1. - pdt * kfrict(l)) |
---|
[5105] | 192 | enddo |
---|
[5118] | 193 | !$OMP END DO |
---|
[5117] | 194 | ENDIF ! of if (friction_type.EQ.1) |
---|
[1673] | 195 | |
---|
[5105] | 196 | END SUBROUTINE friction_loc |
---|
| 197 | |
---|