source: branches/GRISLIv3/SOURCES/diffusiv-polyn-0.6.f90 @ 446

Last change on this file since 446 was 446, checked in by aquiquet, 8 months ago

Cleaning branch: use only statement in module3D

File size: 7.0 KB
Line 
1!> \file diffusiv-polyn-0.5.f90
2!! Contient la subroutine de calcul diffusivites
3!<
4
5!> SUBROUTINE: diffusiv
6!! Calcule de  diffusivites
7!! \author Catherine
8!! \date   18 mars 2006
9!! @note Used modules:
10!! @note    - use module3D_phy
11!! @note    - use module_choix
12!!
13!<
14subroutine diffusiv
15
16  !     ===============================================================
17  !     **     DIFFUSIVITIES                    18 mars 2006   ***
18  !     glissement avec reserve d'eau 29 Avril 97
19  !     choix sur le type de discretisation (locale iloc=1 )   
20  !
21  !     Modification Vince --> 2 fev 95
22  !     pour couplage avec Shelf
23  !
24  !     Modification C. Dumas Dec 99
25  !     DDX, SA,S2A,... ont une dimension en plus (loi de deformation)
26  !
27  !     Modifications  de Cat du 11 juin 2000
28  !     Modif Christophe 24 janv 2002 : passage au fortran 90
29  !     pour optimisation de la routine
30  !     Modif Vincent dec 2003 : on utilise plus frontmx/y > commentaires
31  !
32  !     Modif Cat mars 2003
33  !                  modif mars 2007 : moyennes de S2a avec S2a_mx et S2a_my
34
35  !     ===============================================================
36  !$ USE OMP_LIB
37  use module3D_phy, only: V_limit,iglen,diffmx,diffmy,flgzmx,flgzmy,ubx,uby,&
38       uxflgz,uyflgz,ddbx,ddby,sdx,sdy,flotmx,flotmy,slope2mx,slope2my,hmx,hmy,uxdef,uydef,&
39       uxbar,uybar,H,flot
40  use geography, only: nx,ny,dx,dy
41  use runparam, only: itracebug
42  use param_phy_mod, only:rog
43  use deformation_mod_2lois, only:n1poly,n2poly,glen,ddx,ddy,s2a_mx,s2a_my
44  use module_choix, only:sliding
45
46  implicit none
47
48  integer :: i,j
49  real :: ulgliss,ultot,uldef,glenexp
50  real :: INV_4DX ! inverse de dx pour eviter les divisions =1/(4*dx)
51  real :: INV_4DY ! inverse de dy pour eviter les divisions =1/(4*dy)
52
53  if (itracebug.eq.1)  call tracebug(' Entree dans routine diffusiv')
54
55  !     la valeur de ff est donnee dans initial
56  !     limitation de la vitesse de glissement de déformation et totale
57  ulgliss = V_limit
58  ultot   = V_limit
59  uldef   = 2000.
60
61
62  INV_4DX=1/(4*dx)
63  INV_4DY=1/(4*dy)
64
65  ! initialisation de la diffusion
66  !$OMP PARALLEL
67  !$OMP WORKSHARE
68  diffmx(:,:)=0.
69  diffmy(:,:)=0.
70  !$OMP END WORKSHARE
71  !$OMP END PARALLEL
72
73  ! calcul de SDX, SDY et de la pente au carre en mx et en my :
74
75  call slope_surf
76
77  call sliding     ! au sens vitesse de glissement
78
79  !  le glissement est maintenant dans un module a part choisi dans le module choix
80  !  pour l'instant seules les lois Heino (loigliss=4) et Bindshadler(loigliss=2)
81  !  sont programmees.
82
83  !      ddbx et ddby termes dus au glissement
84  !      relation avec la vitesse de glissement ubx et uby
85  !      ubx=-ddbx*sdx et uby=-ddby*sdy
86  !      -------------------------------------------------
87
88  ! Calcul de la vitesse de glissement, qu'elle soit calculee par diagno ou par sliding
89  !------------------------------------------------------------------------------------
90  !$OMP PARALLEL
91  !$OMP WORKSHARE
92  where (flgzmx(:,:))
93     ubx(:,:) = uxflgz(:,:)
94  elsewhere
95     ubx(:,:) = ddbx(:,:)* (-sdx(:,:))     ! on pourrait mettre une limitation
96  endwhere
97
98  where (flgzmy(:,:))
99     uby(:,:) = uyflgz(:,:)
100  elsewhere
101     uby(:,:) = ddby(:,:)* (-sdy(:,:))
102  endwhere
103  !$OMP END WORKSHARE
104  !$OMP END PARALLEL
105  if (itracebug.eq.1) call tracebug(' diffusiv  apres calcul glissement')
106
107
108
109  ! Deformation SIA : Calcul de ddy  et ddx pour chaque valeur de iglen
110  !------------------------------------------------------------------
111  do iglen=n1poly,n2poly
112     glenexp=max(0.,(glen(iglen)-1.)/2.)
113     !$OMP PARALLEL
114     !$OMP DO
115     do j=1,ny
116        do i=1,nx
117           if (.not.flotmy(i,j)) then !  On calcule quand la deformation même pour les ice streams
118              ddy(i,j,iglen)=((slope2my(i,j)**  &  ! slope2my calcule en debut de routine
119                   glenexp)*(rog)**glen(iglen)) &
120                   *hmy(i,j)**(glen(iglen)+1)
121           endif
122        end do
123     end do
124     !$OMP END DO
125     !$OMP END PARALLEL
126  end do
127
128
129
130  do iglen=n1poly,n2poly
131     glenexp=max(0.,(glen(iglen)-1.)/2.)
132     !$OMP PARALLEL
133     !$OMP DO
134     do j=1,ny 
135        do i=1,nx
136           if (.not.flotmx(i,j)) then      ! bug y->x corrige le 5 avril 2008 (
137              ddx(i,j,iglen)=((slope2mx(i,j)**  & ! slope2mx calcule en debut de routine
138                   glenexp)*(rog)**glen(iglen)) &
139                   *hmx(i,j)**(glen(iglen)+1)
140           endif
141        end do
142     end do
143     !$OMP END DO
144     !$OMP END PARALLEL
145  end do
146
147
148  ! vitesse due a la déformation-----------------------------------------------
149  !$OMP PARALLEL
150  !$OMP DO
151  ydef: do j=2,ny
152     do i=1,nx 
153
154        if (.not.flotmy(i,j)) then !  On calcule la deformation même pour les ice streams
155
156           uydef(i,j)=0.
157           diffmy(i,j)=0.
158
159           do iglen=n1poly,n2poly
160              diffmy(i,j)=diffmy(i,j)+ddy(i,j,iglen)*(s2a_my(i,j,1,iglen))
161           end do
162
163           uydef(i,j)=diffmy(i,j)*(-sdy(i,j))    ! partie deformation
164           uydef(i,j)=min(uydef(i,j),uldef)
165           uydef(i,j)=max(uydef(i,j),-uldef)
166
167           diffmy(i,j)=diffmy(i,j)+ddby(i,j)     ! pour utilisation comme diffusion, a multiplier par H
168
169           uybar(i,j)=uby(i,j)+uydef(i,j)
170
171
172        else    ! points flottants
173           uydef(i,j)=0.   ! normalement uxbed est attribue         
174        endif
175     end do
176  end do ydef
177  !$OMP END DO
178
179  !$OMP DO
180  xdef: do j=1,ny
181     do i=2,nx 
182
183        if (.not.flotmx(i,j)) then !  On calcule la deformation même pour les ice streams
184
185           uxdef(i,j)=0.
186           diffmx(i,j)=0.
187
188           do iglen=n1poly,n2poly
189              diffmx(i,j)=diffmx(i,j)+ddx(i,j,iglen)*(s2a_mx(i,j,1,iglen))
190           end do
191
192           uxdef(i,j)=diffmx(i,j)*(-sdx(i,j))    ! partie deformation
193           uxdef(i,j)=min(uxdef(i,j),uldef)
194           uxdef(i,j)=max(uxdef(i,j),-uldef)
195
196
197           diffmx(i,j)=diffmx(i,j)+ddbx(i,j)     ! pour utilisation comme diffusion,
198           ! a multiplier par H
199           uxbar(i,j)=ubx(i,j)+uxdef(i,j)
200
201
202        else    ! points flottants
203           uxdef(i,j)=0.   ! normalement uxbed est attribue         
204        endif
205     end do
206  end do xdef
207  !$OMP END DO
208
209  if (itracebug.eq.1) call tracebug(' diffusiv  avant limit')
210
211
212  ! limitation par ultot----------------------------------------------------------
213
214  ! la limitation selon x
215  !$OMP WORKSHARE
216  where(.not.flgzmx(:,:))
217     uxbar(:,:)=min(uxbar(:,:),ultot)
218     uxbar(:,:)=max(uxbar(:,:),-ultot)
219  end where
220
221  ! la limitation selon y
222  where(.not.flgzmy(:,:))
223     uybar(:,:)=min(uybar(:,:),ultot)
224     uybar(:,:)=max(uybar(:,:),-ultot)
225  end where
226  !$OMP END WORKSHARE
227
228  !    cas particulier des sommets ou il ne reste plus de neige.
229  !$OMP DO
230  do j=2,ny-1
231     do i=2,nx-1
232        if ((H(i,j).le.1.).and.(.not.flot(i,j))) then
233           uxbar(i+1,j)=min(uxbar(i+1,j),ultot)  ! n'agit que si ux ->
234           uxbar(i,j)=max(uxbar(i,j),-ultot)     ! n'agit que si ux <-
235           uybar(i,j+1)=min(uybar(i,j+1),ultot)
236           uybar(i,j)=max(uybar(i,j),-ultot)
237        endif
238     end do
239  end do
240  !$OMP END DO
241  !$OMP END PARALLEL
242  if (itracebug.eq.1)  call tracebug(' fin diffusiv ')
243
244  return
245end subroutine diffusiv
246
Note: See TracBrowser for help on using the repository browser.