source: LMDZ5/trunk/libf/dyn3dpar/top_bound_p.F @ 2597

Last change on this file since 2597 was 2597, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: get rid of comconst.h, make it a module comconst_mod.
EM

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