[1010] | 1 | ! |
---|
| 2 | ! $Id: top_bound_p.F 1793 2013-07-18 07:13:18Z emillour $ |
---|
| 3 | ! |
---|
| 4 | SUBROUTINE top_bound_p(vcov,ucov,teta,masse,dt,ducov) |
---|
[1019] | 5 | USE parallel_lmdz |
---|
[1] | 6 | IMPLICIT NONE |
---|
| 7 | c |
---|
| 8 | #include "dimensions.h" |
---|
| 9 | #include "paramet.h" |
---|
| 10 | #include "comconst.h" |
---|
| 11 | #include "comvert.h" |
---|
| 12 | #include "comgeom2.h" |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | c .. DISSIPATION LINEAIRE A HAUT NIVEAU, RUN MESO, |
---|
| 16 | C F. LOTT DEC. 2006 |
---|
| 17 | c ( 10/12/06 ) |
---|
| 18 | |
---|
| 19 | c======================================================================= |
---|
| 20 | c |
---|
| 21 | c Auteur: F. LOTT |
---|
| 22 | c ------- |
---|
| 23 | c |
---|
| 24 | c Objet: |
---|
| 25 | c ------ |
---|
| 26 | c |
---|
| 27 | c Dissipation linéaire (ex top_bound de la physique) |
---|
| 28 | c |
---|
| 29 | c======================================================================= |
---|
| 30 | |
---|
[1010] | 31 | ! top_bound sponge layer model: |
---|
| 32 | ! Quenching is modeled as: A(t)=Am+A0*exp(-lambda*dt) |
---|
| 33 | ! where Am is the zonal average of the field (or zero), and lambda the inverse |
---|
| 34 | ! of the characteristic quenching/relaxation time scale |
---|
| 35 | ! Thus, assuming Am to be time-independent, field at time t+dt is given by: |
---|
| 36 | ! A(t+dt)=A(t)-(A(t)-Am)*(1-exp(-lambda*t)) |
---|
| 37 | ! Moreover lambda can be a function of model level (see below), and relaxation |
---|
| 38 | ! can be toward the average zonal field or just zero (see below). |
---|
| 39 | |
---|
| 40 | ! NB: top_bound sponge is only called from leapfrog if ok_strato=.true. |
---|
| 41 | |
---|
| 42 | ! sponge parameters: (loaded/set in conf_gcm.F ; stored in comconst.h) |
---|
| 43 | ! iflag_top_bound=0 for no sponge |
---|
| 44 | ! iflag_top_bound=1 for sponge over 4 topmost layers |
---|
| 45 | ! iflag_top_bound=2 for sponge from top to ~1% of top layer pressure |
---|
| 46 | ! mode_top_bound=0: no relaxation |
---|
| 47 | ! mode_top_bound=1: u and v relax towards 0 |
---|
| 48 | ! mode_top_bound=2: u and v relax towards their zonal mean |
---|
| 49 | ! mode_top_bound=3: u,v and pot. temp. relax towards their zonal mean |
---|
| 50 | ! tau_top_bound : inverse of charactericstic relaxation time scale at |
---|
| 51 | ! the topmost layer (Hz) |
---|
| 52 | |
---|
| 53 | |
---|
[1] | 54 | #include "comdissipn.h" |
---|
[1010] | 55 | #include "iniprint.h" |
---|
[1] | 56 | |
---|
| 57 | c Arguments: |
---|
| 58 | c ---------- |
---|
| 59 | |
---|
[1010] | 60 | real,intent(inout) :: ucov(iip1,jjp1,llm) ! covariant zonal wind |
---|
| 61 | real,intent(inout) :: vcov(iip1,jjm,llm) ! covariant meridional wind |
---|
| 62 | real,intent(inout) :: teta(iip1,jjp1,llm) ! potential temperature |
---|
| 63 | real,intent(in) :: masse(iip1,jjp1,llm) ! mass of atmosphere |
---|
| 64 | real,intent(in) :: dt ! time step (s) of sponge model |
---|
| 65 | real,intent(out) :: ducov(iip1,jjp1,llm) ! increment on ucov due to sponge |
---|
[1] | 66 | |
---|
| 67 | c Local: |
---|
| 68 | c ------ |
---|
| 69 | REAL massebx(iip1,jjp1,llm),masseby(iip1,jjm,llm),zm |
---|
| 70 | REAL uzon(jjp1,llm),vzon(jjm,llm),tzon(jjp1,llm) |
---|
| 71 | |
---|
| 72 | integer i |
---|
[1010] | 73 | REAL,SAVE :: rdamp(llm) ! quenching coefficient |
---|
| 74 | real,save :: lambda(llm) ! inverse or quenching time scale (Hz) |
---|
[1] | 75 | LOGICAL,SAVE :: first=.true. |
---|
| 76 | INTEGER j,l,jjb,jje |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | if (first) then |
---|
| 80 | c$OMP BARRIER |
---|
| 81 | c$OMP MASTER |
---|
| 82 | if (iflag_top_bound == 1) then |
---|
[1010] | 83 | ! sponge quenching over the topmost 4 atmospheric layers |
---|
| 84 | lambda(:)=0. |
---|
| 85 | lambda(llm)=tau_top_bound |
---|
| 86 | lambda(llm-1)=tau_top_bound/2. |
---|
| 87 | lambda(llm-2)=tau_top_bound/4. |
---|
| 88 | lambda(llm-3)=tau_top_bound/8. |
---|
[1] | 89 | else if (iflag_top_bound == 2) then |
---|
[1010] | 90 | ! sponge quenching over topmost layers down to pressures which are |
---|
| 91 | ! higher than 100 times the topmost layer pressure |
---|
| 92 | lambda(:)=tau_top_bound |
---|
[1] | 93 | s *max(presnivs(llm)/presnivs(:)-0.01,0.) |
---|
| 94 | endif |
---|
[1010] | 95 | |
---|
| 96 | ! quenching coefficient rdamp(:) |
---|
| 97 | ! rdamp(:)=dt*lambda(:) ! Explicit Euler approx. |
---|
| 98 | rdamp(:)=1.-exp(-lambda(:)*dt) |
---|
| 99 | |
---|
| 100 | write(lunout,*)'TOP_BOUND mode',mode_top_bound |
---|
| 101 | write(lunout,*)'Sponge layer coefficients' |
---|
| 102 | write(lunout,*)'p (Pa) z(km) tau(s) 1./tau (Hz)' |
---|
[108] | 103 | do l=1,llm |
---|
| 104 | if (rdamp(l).ne.0.) then |
---|
[1010] | 105 | write(lunout,'(6(1pe12.4,1x))') |
---|
| 106 | & presnivs(l),log(preff/presnivs(l))*scaleheight, |
---|
| 107 | & 1./lambda(l),lambda(l) |
---|
[108] | 108 | endif |
---|
| 109 | enddo |
---|
[1010] | 110 | first=.false. |
---|
[1] | 111 | c$OMP END MASTER |
---|
| 112 | c$OMP BARRIER |
---|
[1010] | 113 | endif ! of if (first) |
---|
[1] | 114 | |
---|
| 115 | |
---|
| 116 | CALL massbar_p(masse,massebx,masseby) |
---|
[108] | 117 | |
---|
[1010] | 118 | ! compute zonal average of vcov (or set it to zero) |
---|
[108] | 119 | if (mode_top_bound.ge.2) then |
---|
[1010] | 120 | jjb=jj_begin |
---|
| 121 | jje=jj_end |
---|
| 122 | IF (pole_sud) jje=jj_end-1 |
---|
| 123 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 124 | do l=1,llm |
---|
[1] | 125 | do j=jjb,jje |
---|
| 126 | zm=0. |
---|
| 127 | vzon(j,l)=0 |
---|
| 128 | do i=1,iim |
---|
[1010] | 129 | ! NB: we can work using vcov zonal mean rather than v since the |
---|
| 130 | ! cv coefficient (which relates the two) only varies with latitudes |
---|
[1] | 131 | vzon(j,l)=vzon(j,l)+vcov(i,j,l)*masseby(i,j,l) |
---|
| 132 | zm=zm+masseby(i,j,l) |
---|
| 133 | enddo |
---|
| 134 | vzon(j,l)=vzon(j,l)/zm |
---|
| 135 | enddo |
---|
[108] | 136 | enddo |
---|
[1010] | 137 | c$OMP END DO NOWAIT |
---|
[108] | 138 | else |
---|
[1010] | 139 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 140 | do l=1,llm |
---|
[1010] | 141 | vzon(:,l)=0. |
---|
[108] | 142 | enddo |
---|
[1010] | 143 | c$OMP END DO NOWAIT |
---|
| 144 | endif ! of if (mode_top_bound.ge.2) |
---|
[1] | 145 | |
---|
[1010] | 146 | ! compute zonal average of u (or set it to zero) |
---|
[108] | 147 | if (mode_top_bound.ge.2) then |
---|
[1010] | 148 | jjb=jj_begin |
---|
| 149 | jje=jj_end |
---|
| 150 | IF (pole_nord) jjb=jj_begin+1 |
---|
| 151 | IF (pole_sud) jje=jj_end-1 |
---|
| 152 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 153 | do l=1,llm |
---|
[1] | 154 | do j=jjb,jje |
---|
| 155 | uzon(j,l)=0. |
---|
| 156 | zm=0. |
---|
| 157 | do i=1,iim |
---|
| 158 | uzon(j,l)=uzon(j,l)+massebx(i,j,l)*ucov(i,j,l)/cu(i,j) |
---|
| 159 | zm=zm+massebx(i,j,l) |
---|
| 160 | enddo |
---|
| 161 | uzon(j,l)=uzon(j,l)/zm |
---|
| 162 | enddo |
---|
[108] | 163 | enddo |
---|
[1010] | 164 | c$OMP END DO NOWAIT |
---|
[108] | 165 | else |
---|
[1010] | 166 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 167 | do l=1,llm |
---|
[1010] | 168 | uzon(:,l)=0. |
---|
[108] | 169 | enddo |
---|
[1010] | 170 | c$OMP END DO NOWAIT |
---|
| 171 | endif ! of if (mode_top_bound.ge.2) |
---|
[1] | 172 | |
---|
[1010] | 173 | ! compute zonal average of potential temperature, if necessary |
---|
[108] | 174 | if (mode_top_bound.ge.3) then |
---|
[1010] | 175 | jjb=jj_begin |
---|
| 176 | jje=jj_end |
---|
| 177 | IF (pole_nord) jjb=jj_begin+1 |
---|
| 178 | IF (pole_sud) jje=jj_end-1 |
---|
| 179 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 180 | do l=1,llm |
---|
[1] | 181 | do j=jjb,jje |
---|
| 182 | zm=0. |
---|
| 183 | tzon(j,l)=0. |
---|
| 184 | do i=1,iim |
---|
| 185 | tzon(j,l)=tzon(j,l)+teta(i,j,l)*masse(i,j,l) |
---|
| 186 | zm=zm+masse(i,j,l) |
---|
| 187 | enddo |
---|
| 188 | tzon(j,l)=tzon(j,l)/zm |
---|
| 189 | enddo |
---|
[108] | 190 | enddo |
---|
[1010] | 191 | c$OMP END DO NOWAIT |
---|
| 192 | endif ! of if (mode_top_bound.ge.3) |
---|
[1] | 193 | |
---|
[1010] | 194 | if (mode_top_bound.ge.1) then |
---|
| 195 | ! Apply sponge quenching on vcov: |
---|
| 196 | jjb=jj_begin |
---|
| 197 | jje=jj_end |
---|
| 198 | IF (pole_sud) jje=jj_end-1 |
---|
[1] | 199 | |
---|
[1010] | 200 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 201 | do l=1,llm |
---|
[1] | 202 | do j=jjb,jje |
---|
| 203 | do i=1,iip1 |
---|
[1010] | 204 | vcov(i,j,l)=vcov(i,j,l) |
---|
| 205 | & -rdamp(l)*(vcov(i,j,l)-vzon(j,l)) |
---|
[1] | 206 | enddo |
---|
[108] | 207 | enddo |
---|
[1] | 208 | enddo |
---|
[1010] | 209 | c$OMP END DO NOWAIT |
---|
| 210 | |
---|
| 211 | ! Apply sponge quenching on ucov: |
---|
| 212 | jjb=jj_begin |
---|
| 213 | jje=jj_end |
---|
| 214 | IF (pole_nord) jjb=jj_begin+1 |
---|
| 215 | IF (pole_sud) jje=jj_end-1 |
---|
| 216 | |
---|
| 217 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[108] | 218 | do l=1,llm |
---|
| 219 | do j=jjb,jje |
---|
| 220 | do i=1,iip1 |
---|
[1010] | 221 | ducov(i,j,l)=-rdamp(l)*(ucov(i,j,l)-cu(i,j)*uzon(j,l)) |
---|
| 222 | ucov(i,j,l)=ucov(i,j,l) |
---|
| 223 | & +ducov(i,j,l) |
---|
[108] | 224 | enddo |
---|
| 225 | enddo |
---|
[1010] | 226 | enddo |
---|
| 227 | c$OMP END DO NOWAIT |
---|
| 228 | endif ! of if (mode_top_bound.ge.1) |
---|
[1] | 229 | |
---|
[1010] | 230 | if (mode_top_bound.ge.3) then |
---|
| 231 | ! Apply sponge quenching on teta: |
---|
| 232 | jjb=jj_begin |
---|
| 233 | jje=jj_end |
---|
| 234 | IF (pole_nord) jjb=jj_begin+1 |
---|
| 235 | IF (pole_sud) jje=jj_end-1 |
---|
| 236 | |
---|
| 237 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 238 | do l=1,llm |
---|
| 239 | do j=jjb,jje |
---|
| 240 | do i=1,iip1 |
---|
| 241 | teta(i,j,l)=teta(i,j,l) |
---|
| 242 | & -rdamp(l)*(teta(i,j,l)-tzon(j,l)) |
---|
| 243 | enddo |
---|
| 244 | enddo |
---|
| 245 | enddo |
---|
| 246 | c$OMP END DO NOWAIT |
---|
| 247 | endif ! of if (mode_top_bond.ge.3) |
---|
| 248 | |
---|
[1] | 249 | END |
---|