source: codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/dyn3d/top_bound.F @ 222

Last change on this file since 222 was 222, checked in by ymipsl, 10 years ago

Creating temporary dynamico/lmdz/saturn branche

YM

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