source: codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/config/ppsrc/dyn/friction_p.f @ 224

Last change on this file since 224 was 224, checked in by ymipsl, 10 years ago
File size: 11.1 KB
Line 
1!
2! $Id: friction_p.F 1437 2010-09-30 08:29:10Z emillour $
3!
4c=======================================================================
5      SUBROUTINE friction_p(ucov,vcov,pdt)
6      USE parallel_lmdz
7      USE control_mod
8
9
10
11! if not using IOIPSL, we still need to use (a local version of) getin
12      USE ioipsl_getincom
13
14      IMPLICIT NONE
15
16!=======================================================================
17!
18!   Friction for the Newtonian case:
19!   --------------------------------
20!    2 possibilities (depending on flag 'friction_type'
21!     friction_type=0 : A friction that is only applied to the lowermost
22!                       atmospheric layer
23!     friction_type=1 : Friction applied on all atmospheric layer (but
24!       (default)       with stronger magnitude near the surface; see
25!                       iniacademic.F)
26!=======================================================================
27
28!-----------------------------------------------------------------------
29!   INCLUDE 'dimensions.h'
30!
31!   dimensions.h contient les dimensions du modele
32!   ndm est tel que iim=2**ndm
33!-----------------------------------------------------------------------
34
35      INTEGER iim,jjm,llm,ndm
36
37      PARAMETER (iim= 128,jjm=96,llm=64,ndm=1)
38
39!-----------------------------------------------------------------------
40!
41! $Header$
42!
43!
44!  ATTENTION!!!!: ce fichier include est compatible format fixe/format libre
45!                 veillez  n'utiliser que des ! pour les commentaires
46!                 et  bien positionner les & des lignes de continuation
47!                 (les placer en colonne 6 et en colonne 73)
48!
49!
50!-----------------------------------------------------------------------
51!   INCLUDE 'paramet.h'
52
53      INTEGER  iip1,iip2,iip3,jjp1,llmp1,llmp2,llmm1
54      INTEGER  kftd,ip1jm,ip1jmp1,ip1jmi1,ijp1llm
55      INTEGER  ijmllm,mvar
56      INTEGER jcfil,jcfllm
57
58      PARAMETER( iip1= iim+1,iip2=iim+2,iip3=iim+3                       &
59     &    ,jjp1=jjm+1-1/jjm)
60      PARAMETER( llmp1 = llm+1,  llmp2 = llm+2, llmm1 = llm-1 )
61      PARAMETER( kftd  = iim/2 -ndm )
62      PARAMETER( ip1jm  = iip1*jjm,  ip1jmp1= iip1*jjp1 )
63      PARAMETER( ip1jmi1= ip1jm - iip1 )
64      PARAMETER( ijp1llm= ip1jmp1 * llm, ijmllm= ip1jm * llm )
65      PARAMETER( mvar= ip1jmp1*( 2*llm+1) + ijmllm )
66      PARAMETER( jcfil=jjm/2+5, jcfllm=jcfil*llm )
67
68!-----------------------------------------------------------------------
69!
70! $Header$
71!
72!CDK comgeom2
73      COMMON/comgeom/                                                   &
74     & cu(iip1,jjp1),cv(iip1,jjm),unscu2(iip1,jjp1),unscv2(iip1,jjm)  , &
75     & aire(iip1,jjp1),airesurg(iip1,jjp1),aireu(iip1,jjp1)           , &
76     & airev(iip1,jjm),unsaire(iip1,jjp1),apoln,apols                 , &
77     & unsairez(iip1,jjm),airuscv2(iip1,jjm),airvscu2(iip1,jjm)       , &
78     & aireij1(iip1,jjp1),aireij2(iip1,jjp1),aireij3(iip1,jjp1)       , &
79     & aireij4(iip1,jjp1),alpha1(iip1,jjp1),alpha2(iip1,jjp1)         , &
80     & alpha3(iip1,jjp1),alpha4(iip1,jjp1),alpha1p2(iip1,jjp1)        , &
81     & alpha1p4(iip1,jjp1),alpha2p3(iip1,jjp1),alpha3p4(iip1,jjp1)    , &
82     & fext(iip1,jjm),constang(iip1,jjp1), rlatu(jjp1),rlatv(jjm),      &
83     & rlonu(iip1),rlonv(iip1),cuvsurcv(iip1,jjm),cvsurcuv(iip1,jjm)  , &
84     & cvusurcu(iip1,jjp1),cusurcvu(iip1,jjp1)                        , &
85     & cuvscvgam1(iip1,jjm),cuvscvgam2(iip1,jjm),cvuscugam1(iip1,jjp1), &
86     & cvuscugam2(iip1,jjp1),cvscuvgam(iip1,jjm),cuscvugam(iip1,jjp1) , &
87     & unsapolnga1,unsapolnga2,unsapolsga1,unsapolsga2                , &
88     & unsair_gam1(iip1,jjp1),unsair_gam2(iip1,jjp1)                  , &
89     & unsairz_gam(iip1,jjm),aivscu2gam(iip1,jjm),aiuscv2gam(iip1,jjm)  &
90     & , xprimu(iip1),xprimv(iip1)
91
92
93      REAL                                                               &
94     & cu,cv,unscu2,unscv2,aire,airesurg,aireu,airev,apoln,apols,unsaire &
95     & ,unsairez,airuscv2,airvscu2,aireij1,aireij2,aireij3,aireij4     , &
96     & alpha1,alpha2,alpha3,alpha4,alpha1p2,alpha1p4,alpha2p3,alpha3p4 , &
97     & fext,constang,rlatu,rlatv,rlonu,rlonv,cuvscvgam1,cuvscvgam2     , &
98     & cvuscugam1,cvuscugam2,cvscuvgam,cuscvugam,unsapolnga1           , &
99     & unsapolnga2,unsapolsga1,unsapolsga2,unsair_gam1,unsair_gam2     , &
100     & unsairz_gam,aivscu2gam,aiuscv2gam,cuvsurcv,cvsurcuv,cvusurcu    , &
101     & cusurcvu,xprimu,xprimv
102!
103! $Id: comconst.h 1437 2010-09-30 08:29:10Z emillour $
104!
105!-----------------------------------------------------------------------
106! INCLUDE comconst.h
107
108      COMMON/comconsti/im,jm,lllm,imp1,jmp1,lllmm1,lllmp1,lcl,          &
109     &                 iflag_top_bound,mode_top_bound
110      COMMON/comconstr/dtvr,daysec,                                     &
111     & pi,dtphys,dtdiss,rad,r,kappa,cotot,unsim,g,omeg                  &
112     & ,dissip_fac_mid,dissip_fac_up,dissip_deltaz,dissip_hdelta        &
113     & ,dissip_pupstart  ,tau_top_bound,                                &
114     & daylen,molmass, ihf
115      COMMON/cpdetvenus/cpp,nu_venus,t0_venus
116
117      INTEGER im,jm,lllm,imp1,jmp1,lllmm1,lllmp1,lcl
118      REAL dtvr ! dynamical time step (in s)
119      REAL daysec !length (in s) of a standard day
120      REAL pi    ! something like 3.14159....
121      REAL dtphys ! (s) time step for the physics
122      REAL dtdiss ! (s) time step for the dissipation
123      REAL rad ! (m) radius of the planet
124      REAL r ! Reduced Gas constant r=R/mu
125             ! with R=8.31.. J.K-1.mol-1, mu: mol mass of atmosphere (kg/mol)
126      REAL cpp   ! Cp
127      REAL kappa ! kappa=R/Cp
128      REAL cotot
129      REAL unsim ! = 1./iim
130      REAL g ! (m/s2) gravity
131      REAL omeg ! (rad/s) rotation rate of the planet
132! Dissipation factors, for Earth model:
133      REAL dissip_factz,dissip_zref !dissip_deltaz
134! Dissipation factors, for other planets:
135      REAL dissip_fac_mid,dissip_fac_up,dissip_deltaz,dissip_hdelta
136      REAL dissip_pupstart
137      INTEGER iflag_top_bound,mode_top_bound
138      REAL tau_top_bound
139      REAL daylen ! length of solar day, in 'standard' day length
140      REAL molmass ! (g/mol) molar mass of the atmosphere
141
142      REAL nu_venus,t0_venus ! coeffs needed for Cp(T), Venus atmosphere
143      REAL ihf  ! (W/m2) intrinsic heat flux for giant planets
144
145
146!-----------------------------------------------------------------------
147!
148! $Header$
149!
150!
151! gestion des impressions de sorties et de débogage
152! lunout:    unité du fichier dans lequel se font les sorties
153!                           (par defaut 6, la sortie standard)
154! prt_level: niveau d'impression souhaité (0 = minimum)
155!
156      INTEGER lunout, prt_level
157      COMMON /comprint/ lunout, prt_level
158!
159! $Id: academic.h 1437 2010-09-30 08:29:10Z emillour $
160!
161      common/academic/tetarappel,knewt_t,kfrict,knewt_g,clat4
162      real :: tetarappel(ip1jmp1,llm)
163      real :: knewt_t(llm)
164      real :: kfrict(llm)
165      real :: knewt_g
166      real :: clat4(ip1jmp1)
167
168! arguments:
169      REAL,INTENT(inout) :: ucov( iip1,jjp1,llm )
170      REAL,INTENT(inout) :: vcov( iip1,jjm,llm )
171      REAL,INTENT(in) :: pdt ! time step
172
173! local variables:
174      REAL modv(iip1,jjp1),zco,zsi
175      REAL vpn,vps,upoln,upols,vpols,vpoln
176      REAL u2(iip1,jjp1),v2(iip1,jjm)
177      INTEGER  i,j,l
178      REAL,PARAMETER :: cfric=1.e-5
179      LOGICAL,SAVE :: firstcall=.true.
180      INTEGER,SAVE :: friction_type=1
181      CHARACTER(len=20) :: modname="friction_p"
182      CHARACTER(len=80) :: abort_message
183!$OMP THREADPRIVATE(firstcall,friction_type)
184      integer :: jjb,jje
185
186!$OMP SINGLE
187      IF (firstcall) THEN
188        ! set friction type
189        call getin("friction_type",friction_type)
190        if ((friction_type.lt.0).or.(friction_type.gt.1)) then
191          abort_message="wrong friction type"
192          write(lunout,*)'Friction: wrong friction type',friction_type
193          call abort_gcm(modname,abort_message,42)
194        endif
195        firstcall=.false.
196      ENDIF
197!$OMP END SINGLE COPYPRIVATE(friction_type,firstcall)
198
199      if (friction_type.eq.0) then ! friction on first layer only
200!$OMP SINGLE
201c   calcul des composantes au carre du vent naturel
202      jjb=jj_begin
203      jje=jj_end+1
204      if (pole_sud) jje=jj_end
205     
206      do j=jjb,jje
207         do i=1,iip1
208            u2(i,j)=ucov(i,j,1)*ucov(i,j,1)*unscu2(i,j)
209         enddo
210      enddo
211     
212      jjb=jj_begin-1
213      jje=jj_end+1
214      if (pole_nord) jjb=jj_begin
215      if (pole_sud) jje=jj_end-1
216     
217      do j=jjb,jje
218         do i=1,iip1
219            v2(i,j)=vcov(i,j,1)*vcov(i,j,1)*unscv2(i,j)
220         enddo
221      enddo
222
223c   calcul du module de V en dehors des poles
224      jjb=jj_begin
225      jje=jj_end+1
226      if (pole_nord) jjb=jj_begin+1
227      if (pole_sud) jje=jj_end-1
228     
229      do j=jjb,jje
230         do i=2,iip1
231            modv(i,j)=sqrt(0.5*(u2(i-1,j)+u2(i,j)+v2(i,j-1)+v2(i,j)))
232         enddo
233         modv(1,j)=modv(iip1,j)
234      enddo
235
236c   les deux composantes du vent au pole sont obtenues comme
237c   premiers modes de fourier de v pres du pole
238      if (pole_nord) then
239     
240        upoln=0.
241        vpoln=0.
242     
243        do i=2,iip1
244           zco=cos(rlonv(i))*(rlonu(i)-rlonu(i-1))
245           zsi=sin(rlonv(i))*(rlonu(i)-rlonu(i-1))
246           vpn=vcov(i,1,1)/cv(i,1)
247           upoln=upoln+zco*vpn
248           vpoln=vpoln+zsi*vpn
249        enddo
250        vpn=sqrt(upoln*upoln+vpoln*vpoln)/pi
251        do i=1,iip1
252c          modv(i,1)=vpn
253           modv(i,1)=modv(i,2)
254        enddo
255
256      endif
257     
258      if (pole_sud) then
259     
260        upols=0.
261        vpols=0.
262        do i=2,iip1
263           zco=cos(rlonv(i))*(rlonu(i)-rlonu(i-1))
264           zsi=sin(rlonv(i))*(rlonu(i)-rlonu(i-1))
265           vps=vcov(i,jjm,1)/cv(i,jjm)
266           upols=upols+zco*vps
267           vpols=vpols+zsi*vps
268        enddo
269        vps=sqrt(upols*upols+vpols*vpols)/pi
270        do i=1,iip1
271c        modv(i,jjp1)=vps
272         modv(i,jjp1)=modv(i,jjm)
273        enddo
274     
275      endif
276     
277c   calcul du frottement au sol.
278
279      jjb=jj_begin
280      jje=jj_end
281      if (pole_nord) jjb=jj_begin+1
282      if (pole_sud) jje=jj_end-1
283
284      do j=jjb,jje
285         do i=1,iim
286            ucov(i,j,1)=ucov(i,j,1)
287     s      -cfric*pdt*0.5*(modv(i+1,j)+modv(i,j))*ucov(i,j,1)
288         enddo
289         ucov(iip1,j,1)=ucov(1,j,1)
290      enddo
291     
292      jjb=jj_begin
293      jje=jj_end
294      if (pole_sud) jje=jj_end-1
295     
296      do j=jjb,jje
297         do i=1,iip1
298            vcov(i,j,1)=vcov(i,j,1)
299     s      -cfric*pdt*0.5*(modv(i,j+1)+modv(i,j))*vcov(i,j,1)
300         enddo
301         vcov(iip1,j,1)=vcov(1,j,1)
302      enddo
303!$OMP END SINGLE
304      endif ! of if (friction_type.eq.0)
305
306      if (friction_type.eq.1) then
307       ! for ucov()
308        jjb=jj_begin
309        jje=jj_end
310        if (pole_nord) jjb=jj_begin+1
311        if (pole_sud) jje=jj_end-1
312
313!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
314        do l=1,llm
315          ucov(1:iip1,jjb:jje,l)=ucov(1:iip1,jjb:jje,l)*
316     &                                  (1.-pdt*kfrict(l))
317        enddo
318!$OMP END DO NOWAIT
319       
320       ! for vcoc()
321        jjb=jj_begin
322        jje=jj_end
323        if (pole_sud) jje=jj_end-1
324       
325!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
326        do l=1,llm
327          vcov(1:iip1,jjb:jje,l)=vcov(1:iip1,jjb:jje,l)*
328     &                                  (1.-pdt*kfrict(l))
329        enddo
330!$OMP END DO
331      endif ! of if (friction_type.eq.1)
332
333      RETURN
334      END
335
Note: See TracBrowser for help on using the repository browser.