[1793] | 1 | ! |
---|
| 2 | ! $Id: top_bound.F90 5282 2024-10-28 12:11:48Z abarral $ |
---|
| 3 | ! |
---|
[5246] | 4 | SUBROUTINE top_bound(vcov,ucov,teta,masse,dt) |
---|
[999] | 5 | |
---|
[5282] | 6 | USE iniprint_mod_h |
---|
| 7 | USE comgeom2_mod_h |
---|
[5280] | 8 | USE comdissipn_mod_h |
---|
| 9 | USE comconst_mod, ONLY: iflag_top_bound, mode_top_bound, & |
---|
[5246] | 10 | tau_top_bound |
---|
| 11 | USE comvert_mod, ONLY: presnivs, preff, scaleheight |
---|
[999] | 12 | |
---|
[5271] | 13 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
[5272] | 14 | USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & |
---|
| 15 | ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm |
---|
[5271] | 16 | IMPLICIT NONE |
---|
[5246] | 17 | ! |
---|
[5271] | 18 | |
---|
[5272] | 19 | |
---|
[999] | 20 | |
---|
| 21 | |
---|
[5246] | 22 | ! .. DISSIPATION LINEAIRE A HAUT NIVEAU, RUN MESO, |
---|
| 23 | ! F. LOTT DEC. 2006 |
---|
| 24 | ! ( 10/12/06 ) |
---|
[1793] | 25 | |
---|
[5246] | 26 | !======================================================================= |
---|
| 27 | ! |
---|
| 28 | ! Auteur: F. LOTT |
---|
| 29 | ! ------- |
---|
| 30 | ! |
---|
| 31 | ! Objet: |
---|
| 32 | ! ------ |
---|
| 33 | ! |
---|
[5271] | 34 | ! Dissipation lin�aire (ex top_bound de la physique) |
---|
[5246] | 35 | ! |
---|
| 36 | !======================================================================= |
---|
[1793] | 37 | |
---|
[5246] | 38 | ! top_bound sponge layer model: |
---|
| 39 | ! Quenching is modeled as: A(t)=Am+A0*exp(-lambda*t) |
---|
| 40 | ! where Am is the zonal average of the field (or zero), and lambda the inverse |
---|
| 41 | ! of the characteristic quenching/relaxation time scale |
---|
| 42 | ! Thus, assuming Am to be time-independent, field at time t+dt is given by: |
---|
| 43 | ! A(t+dt)=A(t)-(A(t)-Am)*(1-exp(-lambda*t)) |
---|
| 44 | ! Moreover lambda can be a function of model level (see below), and relaxation |
---|
| 45 | ! can be toward the average zonal field or just zero (see below). |
---|
[1793] | 46 | |
---|
[5246] | 47 | ! NB: top_bound sponge is only called from leapfrog if ok_strato=.true. |
---|
[1793] | 48 | |
---|
[5246] | 49 | ! sponge parameters: (loaded/set in conf_gcm.F ; stored in comconst_mod) |
---|
| 50 | ! iflag_top_bound=0 for no sponge |
---|
| 51 | ! iflag_top_bound=1 for sponge over 4 topmost layers |
---|
| 52 | ! iflag_top_bound=2 for sponge from top to ~1% of top layer pressure |
---|
| 53 | ! mode_top_bound=0: no relaxation |
---|
| 54 | ! mode_top_bound=1: u and v relax towards 0 |
---|
| 55 | ! mode_top_bound=2: u and v relax towards their zonal mean |
---|
| 56 | ! mode_top_bound=3: u,v and pot. temp. relax towards their zonal mean |
---|
| 57 | ! tau_top_bound : inverse of charactericstic relaxation time scale at |
---|
| 58 | ! the topmost layer (Hz) |
---|
| 59 | |
---|
| 60 | |
---|
[999] | 61 | |
---|
[5246] | 62 | ! Arguments: |
---|
| 63 | ! ---------- |
---|
[999] | 64 | |
---|
[5246] | 65 | real,intent(inout) :: ucov(iip1,jjp1,llm) ! covariant zonal wind |
---|
| 66 | real,intent(inout) :: vcov(iip1,jjm,llm) ! covariant meridional wind |
---|
| 67 | real,intent(inout) :: teta(iip1,jjp1,llm) ! potential temperature |
---|
| 68 | real,intent(in) :: masse(iip1,jjp1,llm) ! mass of atmosphere |
---|
| 69 | real,intent(in) :: dt ! time step (s) of sponge model |
---|
[999] | 70 | |
---|
[5246] | 71 | ! Local: |
---|
| 72 | ! ------ |
---|
[999] | 73 | |
---|
[5246] | 74 | REAL :: massebx(iip1,jjp1,llm),masseby(iip1,jjm,llm),zm |
---|
| 75 | REAL :: uzon(jjp1,llm),vzon(jjm,llm),tzon(jjp1,llm) |
---|
[999] | 76 | |
---|
[5246] | 77 | integer :: i |
---|
| 78 | REAL,SAVE :: rdamp(llm) ! quenching coefficient |
---|
| 79 | real,save :: lambda(llm) ! inverse or quenching time scale (Hz) |
---|
[1279] | 80 | |
---|
[5246] | 81 | LOGICAL,SAVE :: first=.true. |
---|
[1279] | 82 | |
---|
[5246] | 83 | INTEGER :: j,l |
---|
[1793] | 84 | |
---|
[5246] | 85 | if (iflag_top_bound.eq.0) return |
---|
[1793] | 86 | |
---|
[5246] | 87 | if (first) then |
---|
| 88 | if (iflag_top_bound.eq.1) then |
---|
| 89 | ! sponge quenching over the topmost 4 atmospheric layers |
---|
| 90 | lambda(:)=0. |
---|
| 91 | lambda(llm)=tau_top_bound |
---|
| 92 | lambda(llm-1)=tau_top_bound/2. |
---|
| 93 | lambda(llm-2)=tau_top_bound/4. |
---|
| 94 | lambda(llm-3)=tau_top_bound/8. |
---|
| 95 | else if (iflag_top_bound.eq.2) then |
---|
| 96 | ! sponge quenching over topmost layers down to pressures which are |
---|
| 97 | ! higher than 100 times the topmost layer pressure |
---|
| 98 | lambda(:)=tau_top_bound & |
---|
| 99 | *max(presnivs(llm)/presnivs(:)-0.01,0.) |
---|
| 100 | endif |
---|
[1279] | 101 | |
---|
[5246] | 102 | ! quenching coefficient rdamp(:) |
---|
| 103 | ! rdamp(:)=dt*lambda(:) ! Explicit Euler approx. |
---|
| 104 | rdamp(:)=1.-exp(-lambda(:)*dt) |
---|
[1279] | 105 | |
---|
[5246] | 106 | write(lunout,*)'TOP_BOUND mode',mode_top_bound |
---|
| 107 | write(lunout,*)'Sponge layer coefficients' |
---|
| 108 | write(lunout,*)'p (Pa) z(km) tau(s) 1./tau (Hz)' |
---|
| 109 | do l=1,llm |
---|
| 110 | if (rdamp(l).ne.0.) then |
---|
| 111 | write(lunout,'(6(1pe12.4,1x))') & |
---|
| 112 | presnivs(l),log(preff/presnivs(l))*scaleheight, & |
---|
| 113 | 1./lambda(l),lambda(l) |
---|
| 114 | endif |
---|
| 115 | enddo |
---|
| 116 | first=.false. |
---|
| 117 | endif ! of if (first) |
---|
[999] | 118 | |
---|
[5246] | 119 | CALL massbar(masse,massebx,masseby) |
---|
[1279] | 120 | |
---|
[5246] | 121 | ! ! compute zonal average of vcov and u |
---|
| 122 | if (mode_top_bound.ge.2) then |
---|
| 123 | do l=1,llm |
---|
| 124 | do j=1,jjm |
---|
| 125 | vzon(j,l)=0. |
---|
| 126 | zm=0. |
---|
| 127 | do i=1,iim |
---|
| 128 | ! NB: we can work using vcov zonal mean rather than v since the |
---|
| 129 | ! cv coefficient (which relates the two) only varies with latitudes |
---|
| 130 | vzon(j,l)=vzon(j,l)+vcov(i,j,l)*masseby(i,j,l) |
---|
| 131 | zm=zm+masseby(i,j,l) |
---|
| 132 | enddo |
---|
| 133 | vzon(j,l)=vzon(j,l)/zm |
---|
| 134 | enddo |
---|
| 135 | enddo |
---|
[999] | 136 | |
---|
[5246] | 137 | do l=1,llm |
---|
| 138 | do j=2,jjm ! excluding poles |
---|
| 139 | uzon(j,l)=0. |
---|
| 140 | zm=0. |
---|
| 141 | do i=1,iim |
---|
| 142 | uzon(j,l)=uzon(j,l)+massebx(i,j,l)*ucov(i,j,l)/cu(i,j) |
---|
| 143 | zm=zm+massebx(i,j,l) |
---|
| 144 | enddo |
---|
| 145 | uzon(j,l)=uzon(j,l)/zm |
---|
| 146 | enddo |
---|
| 147 | enddo |
---|
| 148 | else ! ucov and vcov will relax towards 0 |
---|
| 149 | vzon(:,:)=0. |
---|
| 150 | uzon(:,:)=0. |
---|
| 151 | endif ! of if (mode_top_bound.ge.2) |
---|
[999] | 152 | |
---|
[5246] | 153 | ! ! compute zonal average of potential temperature, if necessary |
---|
| 154 | if (mode_top_bound.ge.3) then |
---|
| 155 | do l=1,llm |
---|
| 156 | do j=2,jjm ! excluding poles |
---|
| 157 | zm=0. |
---|
| 158 | tzon(j,l)=0. |
---|
| 159 | do i=1,iim |
---|
| 160 | tzon(j,l)=tzon(j,l)+teta(i,j,l)*masse(i,j,l) |
---|
| 161 | zm=zm+masse(i,j,l) |
---|
| 162 | enddo |
---|
| 163 | tzon(j,l)=tzon(j,l)/zm |
---|
| 164 | enddo |
---|
| 165 | enddo |
---|
| 166 | endif ! of if (mode_top_bound.ge.3) |
---|
[999] | 167 | |
---|
[5246] | 168 | if (mode_top_bound.ge.1) then |
---|
| 169 | ! ! Apply sponge quenching on vcov: |
---|
| 170 | do l=1,llm |
---|
| 171 | do i=1,iip1 |
---|
| 172 | do j=1,jjm |
---|
| 173 | vcov(i,j,l)=vcov(i,j,l) & |
---|
| 174 | -rdamp(l)*(vcov(i,j,l)-vzon(j,l)) |
---|
| 175 | enddo |
---|
| 176 | enddo |
---|
| 177 | enddo |
---|
| 178 | |
---|
| 179 | ! ! Apply sponge quenching on ucov: |
---|
| 180 | do l=1,llm |
---|
| 181 | do i=1,iip1 |
---|
| 182 | do j=2,jjm ! excluding poles |
---|
| 183 | ucov(i,j,l)=ucov(i,j,l) & |
---|
| 184 | -rdamp(l)*(ucov(i,j,l)-cu(i,j)*uzon(j,l)) |
---|
| 185 | enddo |
---|
| 186 | enddo |
---|
| 187 | enddo |
---|
| 188 | endif ! of if (mode_top_bound.ge.1) |
---|
| 189 | |
---|
| 190 | if (mode_top_bound.ge.3) then |
---|
| 191 | ! ! Apply sponge quenching on teta: |
---|
| 192 | do l=1,llm |
---|
| 193 | do i=1,iip1 |
---|
| 194 | do j=2,jjm ! excluding poles |
---|
| 195 | teta(i,j,l)=teta(i,j,l) & |
---|
| 196 | -rdamp(l)*(teta(i,j,l)-tzon(j,l)) |
---|
| 197 | enddo |
---|
| 198 | enddo |
---|
| 199 | enddo |
---|
| 200 | endif ! of if (mode_top_bound.ge.3) |
---|
| 201 | |
---|
| 202 | END SUBROUTINE top_bound |
---|