source: branches/GRISLIv3/SOURCES/velocities-polyn-0.3.f90 @ 443

Last change on this file since 443 was 375, checked in by dumas, 16 months ago

use only in subroutine SIA_velocities

File size: 5.3 KB
Line 
1!> \file velocities-polyn-0.3.f90
2!! Calcule des vitesses.
3!<
4
5!> SUBROUTINE: VELOCITIES()
6!! \author Catherine RITZ 
7!! \date mars 2007
8!! @note Cette routine permet de calculer les vitesses.
9!! @note Used modules:
10!! @note    - use module3D_phy
11!! @note    - use module_choix
12!!
13!<
14
15! ==========================================================================
16!
17subroutine SIA_velocities
18!
19!
20!                                   Cat passage en f90 en mars 2007
21!                                   moyenne sa_mx et sa_my
22!
23!     Attention la vitesse verticale est "super reduite"
24! ==========================================================================
25  !$ USE OMP_LIB
26  use runparam, only : itracebug     
27  use module3d_phy, only: nx,ny,nz,dx,flotmx,flotmy,ux,uy,sux,suy,sdx,sdy,ubx,uby,&
28       hmx,hmy,uxbar,uybar,iglen,cde,divu,uzr,bmelt,bm,flot,front,flgzmx,flgzmy,&
29       uzsdot,dtt,uzk,bdot,hdot
30  use deformation_mod_2lois, only: n1poly,n2poly,ddx,ddy,sa_mx,sa_my,s2a_mx,s2a_my
31
32  implicit none
33
34  integer :: i,j,k
35  real, dimension(nx,ny) :: hdd
36  real, dimension(nx,ny) :: xx
37
38  if (itracebug.eq.1)  call tracebug(' Entree dans routine SIA_velocity')
39
40  !$OMP PARALLEL
41  xx(:,:)=0.
42  !$OMP DO COLLAPSE(2)
43  do k=1,nz
44     do j=2,ny-1
45        do i=2,nx-1
46
47           !      flgzmx pour tous les points qui sont traites par l'equation elliptique
48           !      diagnoshelf
49
50           !     Selon X
51           !      -------------------------------------
52           !         if (.not.flgzmx(i,j)) then      ! utilise ubx au lieu de ddbx (compatibilite avec mix et spinup)
53           !            ux(i,j,k)=ddbx(i,j)
54           !            sux(i,j,k)=ddbx(i,j)*cde(k)
55
56           if (.not.flotmx(i,j)) then        ! version aout 2010 (Cat)
57              ! utilise ubx au lieu de ddbx (compatibilite avec mix et spinup)
58              ! et agit sur tous les points poses
59
60              ux(i,j,k) = 0.
61              sux(i,j,k)= 0.
62
63              do iglen=n1poly,n2poly
64                 ux(i,j,k)  = ux(i,j,k)+ddx(i,j,iglen)*sa_mx(i,j,k,iglen)
65                 sux(i,j,k) = sux(i,j,k)+ddx(i,j,iglen)*s2a_mx(i,j,k,iglen)
66              end do
67              ux(i,j,k)  = ux(i,j,k)*(-sdx(i,j))
68              ux(i,j,k)  = ux(i,j,k) + ubx(i,j)    ! ajoute le glissement
69
70              sux(i,j,k) = sux(i,j,k)*sdx(i,j)*hmx(i,j)
71              sux(i,j,k) = sux(i,j,k) - ubx(i,j) * cde(k)
72
73           else
74              sux(i,j,k) = (nz-k)*1./(nz-1.)*uxbar(i,j)*hmx(i,j)
75              ux(i,j,k)  = uxbar(i,j)
76           end if
77
78           !     Selon Y
79           !      -------------------------------------
80           !         if (.not.flgzmy(i,j)) then       
81           !            uy(i,j,k)=ddby(i,j)
82           !            suy(i,j,k)=ddby(i,j)*cde(k)
83
84           if (.not.flotmy(i,j)) then        ! version aout 2010 (Cat)
85              ! utilise uby au lieu de ddby (compatibilite avec mix et spinup)
86              ! et agit sur tous les points poses
87
88              uy(i,j,k) = 0.
89              suy(i,j,k)= 0.
90
91
92              do iglen=n1poly,n2poly
93                 uy(i,j,k)  = uy(i,j,k)+ddy(i,j,iglen)*sa_my(i,j,k,iglen)
94                 suy(i,j,k) = suy(i,j,k)+ddy(i,j,iglen)*s2a_my(i,j,k,iglen)
95              end do
96              uy(i,j,k)  = uy(i,j,k)*(-sdy(i,j))
97              uy(i,j,k)  = uy(i,j,k) + uby(i,j)    ! ajoute le glissement
98
99              suy(i,j,k) = suy(i,j,k)*sdy(i,j)*hmy(i,j)
100              suy(i,j,k) = suy(i,j,k) - uby(i,j) * cde(k)
101
102           else
103              suy(i,j,k) = (nz-k)*1./(nz-1)*uybar(i,j)*hmy(i,j)
104              uy(i,j,k)=uybar(i,j)
105           endif
106
107        end do
108     end do
109  end do
110  !$OMP END DO
111
112  !       *************************** Z VELOCITIES ******************
113
114  !$OMP DO
115  do j=2,ny-1
116     do i=2,nx-1
117
118        divu(i,j)=((uxbar(i+1,j)*hmx(i+1,j)-uxbar(i,j)*hmx(i,j))  &    ! formulation explicite
119             + (uybar(i,j+1)*hmy(i,j+1)-uybar(i,j)*hmy(i,j)))/dx
120
121        uzr(i,j,nz)=bmelt(i,j)
122        xx(i,j)=uzr(i,j,1)
123        hdd(i,j)=bm(i,j)-bmelt(i,j)-divu(i,j)                          ! formulation explicite de dH/dt
124
125        !     -------------------------------------------------------------------
126        !      attention uzr contient maintenant :
127        !      uzr=uz +u ((1-e)*dH/dx+dB/dx)+ ((1-e)*dH/dt+dB/dt)
128
129        do k=1,nz-1
130           if (.not.flot(i,j).and.(front(i,j).eq.4.).and..not.flgzmx(i,j) &
131                .and..not.flgzmx(i+1,j).and..not.flgzmy(i,j) &
132                .and..not.flgzmy(i,j+1)) then
133              uzr(i,j,k)=uzr(i,j,nz)-((sux(i+1,j,k)-sux(i,j,k)) &
134                   +(suy(i,j+1,k)-suy(i,j,k)))/dx
135              uzr(i,j,k)=uzr(i,j,k)+hdd(i,j)*cde(k)
136
137           else
138
139              !     dans l'ice-shelf la vitesse uzr est lineaire ...
140              !    -------------------------------------------------
141
142              !     attention, dans les zones stream, le vitesse verticale n'est pas
143              !     lineaire si elle est voisine d'un point .not.flgzmx
144              !     le calcul se fait alors par differences finies
145
146              uzr(i,j,k)= bm(i,j)+(k-1.)/(nz-1.)*(bmelt(i,j)-bm(i,j))
147           end if
148
149        end do
150
151     end do
152  end do
153  !$OMP END DO
154
155  !$OMP DO
156  do j=2,ny-1
157     do i=2,nx-1 
158        uzsdot(i,j)=(uzr(i,j,1)-xx(i,j))/dtt
159        uzk(i,j)=(-bdot(i,j)-hdot(i,j)+bm(i,j)-bmelt(i,j))
160     end do
161  end do
162  !$OMP END DO
163  !$OMP END PARALLEL
164
165end subroutine SIA_velocities
Note: See TracBrowser for help on using the repository browser.