source: branches/GRISLIv3/SOURCES/New-remplimat/diagno-L2_mod.f90 @ 444

Last change on this file since 444 was 444, checked in by aquiquet, 11 months ago

Cleaning branch: diagnoL2 back with use only statements

File size: 19.9 KB
Line 
1!module diagno_L2_mod               ! Nouvelle version, compatible remplimat 2008 Cat
2module diagno_mod                   ! nom pendant les tests
3 !$ USE OMP_LIB
4use module3D_phy,only: nx,ny,dx
5     
6implicit none
7
8
9
10real                   :: somint,test,delp,prec
11real, dimension(nx,ny) :: uxb1
12real, dimension(nx,ny) :: uyb1
13
14real, dimension(nx,ny) :: uxb1ramollo
15real, dimension(nx,ny) :: uyb1ramollo
16real, dimension(nx,ny) :: pvi_keep
17
18!cdc transfere dans module3d pour compatibilite avec furst_schoof_mod
19!cdc  integer, dimension(nx,ny) :: imx_diag
20!cdc  integer, dimension(nx,ny) :: imy_diag
21
22integer :: nneigh=max(int(400000./dx),1) !nb. points around the grline kept for back force comp. in case we reduce the extent
23integer, dimension(nx,ny) :: imx_reduce !afq -- to limit the number of points where vel is computed for backforce
24integer, dimension(nx,ny) :: imy_reduce !afq -- to limit the number of points where vel is computed for backforce
25
26integer :: nxd1,nxd2     ! domaine selon x Dans l'appel rempli_L2
27integer :: nyd1,nyd2     ! domaine selon y
28
29integer :: itour_pvi
30
31integer :: ifail_diagno  ! pour recuperation d'erreur
32integer :: ifail_diagno_ramollo  ! pour recuperation d'erreur shelf ramollo
33integer :: iplus1,jplus1
34integer ::  ctvisco,iumax,jumax
35real  :: delumax,errmax
36real  :: phiphi,bt2,d02,discr,ttau
37real :: sf3,sf1,epsxxm,epsyym,epsm,sf01,sf03    ! pour le calcul de la viscosite
38real :: viscm
39real :: sf_shelf                                ! coef mult enhancement factor pour shelves
40
41logical :: stopvisco,viscolin
42logical :: test_visc
43
44integer :: itour_nolin
45
46contains   
47
48!------------------------------------------------------------------------------------
49subroutine init_diagno
50
51use module3D_phy,only: num_rep_42,num_param,geoplace,pvimin
52use deformation_mod_2lois,only: sf ! afq - 07/2023 - not clean since it is in module_choix
53
54implicit none
55
56integer sffunc
57
58namelist/diagno_rheol/sf01,sf03,sffunc,pvimin
59
60! attribution des coefficients de viscosite
61
62! formats pour les ecritures dans 42
63428 format(A)
64
65! lecture des parametres du run                      block draghwat
66!--------------------------------------------------------------------
67
68rewind(num_param)        ! pour revenir au debut du fichier param_list.dat
69read(num_param,diagno_rheol)
70
71write(num_rep_42,428)'!___________________________________________________________' 
72write(num_rep_42,428) '&diagno_rheol              ! nom du bloc  diagno_rheol'
73write(num_rep_42,*)
74write(num_rep_42,*) 'sf01           = ',sf01 
75write(num_rep_42,*) 'sf03           = ',sf03
76write(num_rep_42,*) 'sffunc         = ',sffunc
77write(num_rep_42,*) 'pvimin         = ',pvimin
78write(num_rep_42,*)'/'     
79write(num_rep_42,428) '! coefficients par rapport a la loi glace posee '                       
80write(num_rep_42,428) '! sf01 : coefficient viscosite loi lineaire '
81write(num_rep_42,428) '! sf03 : coefficient viscosite loi n=3 '
82write(num_rep_42,428) '! sffunc : 1 for visco coef that depends on enh factor'
83write(num_rep_42,428) '! pvimin : valeur de pvi pour les noeuds fictifs ~ 1.e3'
84write(num_rep_42,428) '! tres petit par rapport aux valeurs standards ~ 1.e10'
85
86write(num_rep_42,*)
87
88if (sffunc.eq.1) then
89     sf01 = (1 - (sf(2)-1)/10.)/sf(2)  !the sf are known via the module_choix...
90     sf03 = (1 - (sf(1)-1)/10.)/sf(1)
91endif
92
93!      Precision utilisee dans de calcul
94prec = 1.e-2
95itour_pvi=1   ! si prend les valeurs analytiques dans le shelf
96
97if (geoplace(1:5).eq.'mism3') then
98   sf_shelf = 1.
99   itour_pvi= 0
100
101else
102   sf_shelf = 0.4
103end if
104
105return
106end subroutine init_diagno
107
108!------------------------------------------------------------------------------------
109subroutine diagnoshelf !      Resolution numerique des equations diagnostiques
110
111  use module3D_phy, only: itracebug,niter_nolin,taushelf,flot,h,pvi,coef_sflot,rog, & 
112                          gr_line_schoof,geoplace,uxbar,uybar,pvimin,debug_3D,V_limit, & 
113                          imx_diag,imy_diag,tobmx,tobmy,neffmx,neffmy,gr_line, schoof, & 
114                          betamx,betamy,flgzmx,flgzmy,uxflgz,uyflgz,taub 
115  use furst_schoof_mod, only: back_force_x,back_force_y,gr_select,frot_coef,interpol_glflux 
116  use module_choix, only: btt,dragging,mstream_dragging  ! afq - 03/2023 - not clean
117
118  implicit none
119
120  integer :: diagno_grline
121  integer itour_nolin
122  integer i,j ! loop integers
123
124 
125  if (itracebug.eq.1)  call tracebug(' Entree dans diagnoshelf')
126
127  do itour_nolin=1,niter_nolin
128
129  itour_pvi=itour_pvi+1       ! boucle sur la viscosite (pour l'instant pas actif)
130
131!  pvi(:,:)=0.
132  Taushelf(:,:)=0.
133
134  ! attention le bloc suivant est pour debug
135!!$gzmx(:,:)=.false.
136!!$gzmy(:,:)=.false.
137!!$ilemx(:,:)=.false.
138!!$ilemy(:,:)=.false.
139!!$flgzmx(:,:)=flotmx(:,:)
140!!$flgzmy(:,:)=flotmy(:,:)
141
142  call dragging                    ! doit etre appele avant imx_imy
143  call mstream_dragging ! afq -- mise a jour des masques
144
145
146if (itour_pvi.le.1) then
147  call calc_pvi                    ! calcule les viscosites integrees
148
149!$OMP PARALLEL
150!$OMP WORKSHARE
151   where (flot(:,:).and.(H.gt.1))  ! valeur analytique pour les shelfs
152      pvi(:,:) = (4./coef_Sflot/rog)**2/btt(:,:,1,1)/H(:,:)
153   end where
154!$OMP END WORKSHARE
155!$OMP END PARALLEL
156  ! avec couplage thermomecanique
157!  write(166,*) ' apres call calc_pvi',itour_pvi
158
159else
160   call calc_pvi   
161end if
162
163  call imx_imy_nx_ny         ! pour rempli_L2 : calcule les masques imx et imy qui
164
165  diagno_grline=sum(gr_line(2:(nx-1),2:(ny-1)))
166  if ((Schoof.ge.1).and.(diagno_grline.gt.0)) then
167       call imx_imy_nx_ny_reduce(1) !afq: provides imx_reduce and imy_reduce
168  endif
169
170!cdc debug Schoof !!!!!!!!!!!! 
171!~   do j=1,ny
172!~              do i=1,nx
173!~                      write(578,*) uxbar(i,j)
174!~                      write(579,*) uybar(i,j)
175!~              enddo
176!~      enddo   
177 
178  !if (Schoof.eq.1.and.nt.GT.15000) then ! flux grounding line Schoof
179! afq -- below:  if (Schoof.eq.1) then ! flux grounding line Schoof
180! afq -- below:     call interpol_glflux ! calcul flux GL + interpolation sur voisins
181! afq -- below:  endif
182
183!~       do j=1,ny
184!~              do i=1,nx
185!~                      write(588,*) uxbar(i,j)
186!~                      write(589,*) uybar(i,j)
187!~              enddo
188!~      enddo   
189!~      print*,'ecriteure termineee !!!!!!'
190!~      read(*,*)
191
192  ! donnent les cas de conditions aux limites
193  !
194  ! version pour travailler sur tout le domaine nx ny
195
196  if (geoplace(1:5).eq.'mism3') call mismip_boundary_cond
197
198
199  ! appel a la routine rempl_L2 -------------------domaine nx x ny ------------
200  !
201
202  ! pour tout le domaine
203  nxd1=1
204  nxd2=nx
205  nyd1=1
206  nyd2=ny
207
208  !call rempli_L2(1,nx,1,ny,uxbar,uybar,uxb1,uyb1,imx_diag,imy_diag,ifail_diagno)   
209  !nxd1=15
210  !nxd2=19
211  !nyd1=30
212  !nyd2=34
213
214  !nxd1=35
215  !nxd2=60
216  !nyd1=35
217  !nyd2=60
218
219       
220  !if (Schoof.eq.1.and.nt.GT.15000) then ! flux grounding line Schoof avec calcul de la back force par shelf ramollo
221  if ((Schoof.ge.1).and.(diagno_grline.gt.0)) then ! flux grounding line Schoof avec calcul de la back force par shelf ramollo
222
223    call rempli_L2(nxd1,nxd2,nyd1,nyd2,uxbar(nxd1:nxd2,nyd1:nyd2),uybar(nxd1:nxd2,nyd1:nyd2), & 
224          uxb1(nxd1:nxd2,nyd1:nyd2),uyb1(nxd1:nxd2,nyd1:nyd2),  &
225          imx_reduce(nxd1:nxd2,nyd1:nyd2),imy_reduce(nxd1:nxd2,nyd1:nyd2),ifail_diagno)
226
227    pvi_keep(:,:)=pvi(:,:)       
228    where (flot(:,:).and.H(:,:).GT.2.)
229!       pvi(:,:)=1.e5   
230       pvi(:,:)=pvimin
231    endwhere
232
233    call rempli_L2(nxd1,nxd2,nyd1,nyd2,uxbar(nxd1:nxd2,nyd1:nyd2),uybar(nxd1:nxd2,nyd1:nyd2), & 
234       uxb1ramollo(nxd1:nxd2,nyd1:nyd2),uyb1ramollo(nxd1:nxd2,nyd1:nyd2),  &
235       imx_reduce(nxd1:nxd2,nyd1:nyd2),imy_reduce(nxd1:nxd2,nyd1:nyd2),ifail_diagno_ramollo)
236       
237    pvi(:,:)=pvi_keep(:,:) 
238   
239    where (abs(uxb1ramollo(:,:)) .GT.1.e-5)
240       back_force_x(:,:) = 1.0 * abs(uxb1(:,:)) / abs(uxb1ramollo(:,:))
241    elsewhere
242       back_force_x(:,:)=1.
243    endwhere
244    where (abs(uyb1ramollo(:,:)) .GT.1.e-5)
245       back_force_y(:,:) = 1.0 * abs(uyb1(:,:)) / abs(uyb1ramollo(:,:))
246    elsewhere
247       back_force_y(:,:)=1.
248    endwhere
249    back_force_x(:,:) = min ( back_force_x(:,:), 1. )
250    back_force_y(:,:) = min ( back_force_y(:,:), 1. )
251    debug_3D(:,:,64) = back_force_x(:,:)
252    debug_3D(:,:,65) = back_force_y(:,:)
253
254    if (ifail_diagno_ramollo.gt.0) then
255!       write(6,*) ' Probleme resolution systeme L2. ramollo ifail=',ifail_diagno_ramollo
256!       STOP
257       write(*,*) ' Probleme resolution systeme L2. ramollo ifail=',ifail_diagno_ramollo
258       write(*,*) '          ... we go on anyway!'
259    endif
260!~   do j=1,ny
261!~              do i=1,nx
262!~                if (sqrt(uxb1(i,j)**2+ uyb1(i,j)**2).gt.0..and..not.flot(i,j)) then
263!~                              write(1034,*) sqrt(uxb1(i,j)**2+ uyb1(i,j)**2) / sqrt(uxb1ramollo(i,j)**2 + uyb1ramollo(i,j)**2)
264!~                else
265!~                              write(1034,*) 1.
266!~                      endif
267!~              enddo           
268!~      enddo
269
270!~   print*,'apres calcul rempli_L2'
271!~   read(*,*)
272   
273    call interpol_glflux ! calcul flux GL + interpolation sur voisins
274   
275  endif
276 
277  call rempli_L2(nxd1,nxd2,nyd1,nyd2,uxbar(nxd1:nxd2,nyd1:nyd2),uybar(nxd1:nxd2,nyd1:nyd2), & 
278       uxb1(nxd1:nxd2,nyd1:nyd2),uyb1(nxd1:nxd2,nyd1:nyd2),  &
279       imx_diag(nxd1:nxd2,nyd1:nyd2),imy_diag(nxd1:nxd2,nyd1:nyd2),ifail_diagno)
280 
281
282  ! Dans rempli_L2
283
284  !      uxprex(n1,n2)                                                 
285  !      uyprec(n1,n2) vitesses de l'iteration precedente     
286  !                                                                   
287  !      uxnew(n1,n2)                                                   
288  !      uynew(n1,n2) uynew resultat de cette iteration
289  !
290  !      imx(n1,n2) masque pour imposer les vitesses ou leur dérivee   
291  !      imy(n1,n2) masque pour imposer les vitesses ou leur dérivée   
292
293  ! eventuellement le domaine n1,n2 peut etre un sous-domaine de nx,ny
294  ! attention il faudra alors appeler avec des sous-tableaux
295
296  ! Dans l'appel uxbar -> uxprec   et Uxb1 -> Uxnew
297
298  !---------------------------------------------------------------------------
299
300  if (ifail_diagno.gt.0) then
301     write(6,*) ' Probleme resolution systeme L2. ifail=',ifail_diagno
302     STOP
303  endif
304
305  !      nouvelles vitesses         
306  !$OMP PARALLEL
307  !$OMP WORKSHARE
308  uxbar(:,:)=max(min(uxb1(:,:),V_limit),-V_limit)
309  uybar(:,:)=max(min(uyb1(:,:),V_limit),-V_limit)
310  !$OMP END WORKSHARE
311
312
313  !    calcul de tobmx et tobmy (frottement basal) apres calcul des vitesses
314  !    ---------------------------------------------------------------------
315
316  if (gr_select.eq.1) then !Tsai
317  !$OMP WORKSHARE
318     where(gr_line_schoof(:,:).gt.0)
319        tobmx(:,:) = sign( neffmx(:,:) * frot_coef , -uxbar(:,:))
320        tobmy(:,:) = sign( neffmy(:,:) * frot_coef , -uybar(:,:))
321     elsewhere
322        tobmx(:,:) = -betamx(:,:) * uxbar(:,:)
323        tobmy(:,:) = -betamy(:,:) * uybar(:,:)
324     end where
325  !$OMP END WORKSHARE
326  else
327  !$OMP WORKSHARE
328     tobmx(:,:) = -betamx(:,:) * uxbar(:,:)
329     tobmy(:,:) = -betamy(:,:) * uybar(:,:)
330  !$OMP END WORKSHARE
331  end if
332  !$OMP BARRIER
333
334  ! afq -- initMIP outputs:
335  !$OMP DO
336  do j=2,ny-1 
337     do i=2,nx-1
338        taub(i,j) = sqrt( ((tobmx(i,j)+tobmx(i+1,j))*0.5)**2 &
339             + ((tobmy(i,j)+tobmy(i,j+1))*0.5)**2 )
340     end do
341  end do
342  !$OMP END DO
343  !$OMP WORKSHARE
344  debug_3d(:,:,117) = taub(:,:)
345  !$OMP END WORKSHARE
346
347 
348  ! Mise ne réserve des vitesses flgzmx et flgzmy
349  !$OMP WORKSHARE
350  where (flgzmx(:,:))
351     uxflgz(:,:)=uxbar(:,:)
352  elsewhere
353     uxflgz(:,:)=0.
354  endwhere
355
356  where (flgzmy(:,:))
357     uyflgz(:,:)=uybar(:,:)
358  elsewhere
359     uyflgz(:,:)=0.
360  endwhere
361  !$OMP END WORKSHARE
362  !$OMP END PARALLEL
363  !i=92
364  !j=152
365  !write(6,*) 'time',time, uxbar(92,152),gzmx(92,152),ilemx(92,152),flotmx(92,152), flgzmx(92,152)
366
367  end do ! afq -- sur itour_nolin
368
369  return
370end subroutine diagnoshelf
371
372
373!-------------------------------------------------------------------
374subroutine calc_pvi
375
376use module3d_phy, only: nx,ny,nz,itracebug,pvi,pvimin,abar,flot,gzmx,gzmy, & 
377                        ilemx,ilemy,eps,taushelf,h,ramollo,debug_3d,pvm 
378use module_choix, only: btt,visc  ! afq - 03/2023 - not clean
379
380implicit none
381 
382! calcule les viscosites integrees pvi et pvm
383! loi polynomiale + couplage thermomécanique
384!
385!     Attention ne marche que si la loi est la loi en n=3 + n=1
386!     y compris le pur glen (n=3) ou le pur Newtonien (n=1)
387! --------------------------------------------------------------------
388
389!     les deformations sont supposées indépendantes de la profondeur
390!     et sont calculées dans strain_rate (appelé par main)       
391
392!     eps(i,j) -> eps
393!     ttau -> tau (2eme invariant du deviateur des contraintes)
394!     BT2 loi en n=3, phiphi loi en n=1 calculés dans flowlaw
395
396!
397     
398
399! La viscosité est calculée partout y compris pour la glace posée (ou elle est moins
400! précise qu'un calcul direct avec la loi de déformation.)
401! Pour les noeuds posés mais ayant un voisin stream ou flottant, on calcule
402! la viscosité avec stream/shelves
403! le calcul se fait sur les noeuds majeurs
404
405!$  integer :: rang ,nb_taches
406!$  logical :: paral
407
408integer i,j,k !loop integers
409
410if (itracebug.eq.1)  call tracebug(' Calc pvi')
411
412!$OMP PARALLEL PRIVATE(rang,iplus1,jplus1,sf3,sf1,BT2,phiphi,ttau,d02,discr)
413!$ paral = OMP_IN_PARALLEL()
414!$ rang=OMP_GET_THREAD_NUM()
415!$ nb_taches=OMP_GET_NUM_THREADS()
416
417!$OMP WORKSHARE
418pvi(:,:)  = pvimin
419Abar(:,:) = 0.
420!$OMP END WORKSHARE
421
422!$OMP DO
423do j=1,ny
424   do i=1,nx
425      iplus1=min(i+1,nx)
426      jplus1=min(j+1,ny)
427
428
429      if (flot(i,j)) then    ! noeuds flottants
430         sf3=sf03*sf_shelf     
431         sf1=sf01*sf_shelf
432     
433      else if (gzmx(i,j).or.gzmx(iplus1,j).or.gzmy(i,j).or.gzmy(i,jplus1)) then
434         sf1=sf01
435         sf3=max(sf03,0.01)   ! pour les fleuves de glace, un peu de Glen
436     
437      else if (ilemx(i,j).or.ilemx(iplus1,j).or.ilemy(i,j).or.ilemy(i,jplus1)) then
438         sf1=sf01
439         sf3=max(sf03,0.01)   ! pour les iles aussi
440
441      else
442!         sf1=1
443!         sf3=1
444         sf1=sf01             ! pour la viscosite anisotrope (ici en longitudinal)
445         sf3=sf03
446      endif
447
448
449      do k=1,nz 
450
451         BT2=BTT(i,j,k,1)*sf3    ! changement du sf
452         phiphi=BTT(i,j,k,2)*sf1 !  changement du sf
453
454
455
456         if (BT2.lt.1.e-25) then      ! pur newtonien
457            visc(i,j,k)=1./phiphi
458            ttau=2.*visc(i,j,k)*eps(i,j)
459         else                         ! polynomial
460
461
462!  en mettant Bt2 en facteur
463            d02=eps(i,j) 
464            discr=((phiphi/3.)**3.)/Bt2+d02**2
465            discr=discr**0.5
466
467            ttau=(d02+discr)**(1./3.)-(discr-d02)**(1./3.)
468
469
470            ttau=ttau*Bt2**(-1./3.)
471
472
473            visc(i,j,k)=Bt2*ttau*ttau+phiphi
474
475            if (visc(i,j,k).gt.1.e-15) then
476               visc(i,j,k)=1./visc(i,j,k)
477            else
478               visc(i,j,k)=1.e15
479            endif
480         endif
481         pvi(i,j)=pvi(i,j)+visc(i,j,k)
482         Abar(i,j) =(Bt2/2.)**(-1./3.) + Abar(i,j)
483         
484         Taushelf(i,j)=Taushelf(i,j)+ttau
485
486
487      end do
488     
489
490   
491      pvi(i,j)  = pvi(i,j)*H(i,j)/nz
492      Abar(i,j) = (Abar(i,j) /nz)**(-3.)
493     
494
495      Taushelf(i,j)=Taushelf(i,j)/nz
496   
497   
498   end do
499end do
500!$OMP END DO
501
502! cas des noeuds fictifs, si l'épaisseur est très petite
503! pvimin est très petit
504!$OMP WORKSHARE
505where (H(:,:).le.1.)
506   pvi(:,:) = pvimin
507end where
508
509where (ramollo(:,:).ge..5)
510   pvi(:,:) = pvimin
511end where
512
513
514debug_3D(:,:,27)=pvi(:,:)
515!$OMP END WORKSHARE
516! attention run 35
517!--------------------
518!!$if (time.gt.10.) then
519!!$   where (flot(:,:))
520!!$      pvi(:,:)=pvimin
521!!$   end where
522!!$end if
523
524!  calcul de la viscosite integree au milieu des mailles (pvm)
525!$OMP DO
526do i=2,nx
527   do j=2,ny
528
529! les lignes suivantes pour un pvm moyenne des pvi
530      pvm(i,j)=0.25*((pvi(i,j)+pvi(i-1,j-1))+    &   
531           (pvi(i,j-1)+pvi(i-1,j)))
532
533   end do
534end do
535!$OMP END DO
536!$OMP END PARALLEL
537
538end subroutine calc_pvi
539!------------------------------------------------------------------
540
541subroutine imx_imy_nx_ny
542
543use module3d_phy, only: imx_diag,imy_diag,flgzmx,flgzmy 
544         
545implicit none
546
547! definition des masques
548! pour rempli_L2 : calcule les masques imx et imy qui
549! donnent les cas de conditions aux limites
550! version pour travailler sur tout le domaine nx ny
551!----------------------------------------------------
552
553
554
555!   -34                -3   Nord              -23   
556!     !----------------------------------------!
557!     !                                        !
558!     !              1 (prescrite)             !
559!  -4 !                   ou                   ! -2
560! West!              2 (L2)                    !  Est
561!     !                                        !
562!     !                                        !
563!     !----------------------------------------!
564!    -41               -1  Sud                -12
565
566!$OMP PARALLEL
567!$OMP WORKSHARE
568imx_diag(:,:)=0
569imy_diag(:,:)=0
570
571! a l'interieur du domaine
572!-------------------------
573
574where (flgzmx(:,:))
575   imx_diag(:,:)=2             ! shelf ou stream       
576elsewhere
577   imx_diag(:,:)=1             ! vitesse imposee
578end where
579
580where (flgzmy(:,:))     
581   imy_diag(:,:)=2             ! shelf ou stream
582elsewhere
583   imy_diag(:,:)=1             ! vitesse imposee
584end where
585
586! bord sud
587imx_diag(:,1)=-1
588imy_diag(:,2)=-1
589
590! bord nord
591imx_diag(:,ny)=-3
592imy_diag(:,ny)=-3
593
594! bord Est
595imx_diag(1,:)=0    ! hors domaine a cause des mailles alternees
596imx_diag(2,:)=-4
597imy_diag(1,:)=-4
598
599! bord West
600imx_diag(nx,:)=-2
601imy_diag(nx,:)=-2
602
603! Coins
604imx_diag(2,1)=-41       ! SW
605imy_diag(1,2)=-41
606
607imx_diag(nx,1)=-12      ! SE
608imy_diag(nx,2)=-12
609
610imx_diag(nx,ny)=-23     ! NE
611imy_diag(nx,ny)=-23
612
613imx_diag(2,ny)=-34      ! NW
614imy_diag(1,ny)=-34
615
616! hors domaine
617imx_diag(1,:)=0     ! hors domaine a cause des mailles alternees
618imy_diag(:,1)=0     ! hors domaine a cause des mailles alternees
619!$OMP END WORKSHARE
620!$OMP END PARALLEL
621 
622end subroutine imx_imy_nx_ny
623
624
625subroutine imx_imy_nx_ny_reduce(choix)
626
627use module3d_phy, only: flot,imx_diag,imy_diag,gr_line 
628         
629implicit none
630
631!afq -- For the backforce computation we do not need to compute the velocities everywhere
632!       We simply compute the velocities around (nneigh) the grounding line
633
634  integer, intent(in) :: choix
635
636  integer i,j,nvx,nvy
637  integer bordouest,bordest,bordsud,bordnord
638
639  if (choix.eq.1) then ! we reduce the extent of velocity computation
640
641  imx_reduce(:,:) = 1
642  imy_reduce(:,:) = 1
643
644  where (flot(:,:)) 
645     imx_reduce(:,:) = imx_diag(:,:)
646     imy_reduce(:,:) = imy_diag(:,:)
647  endwhere
648
649  do j=1,ny
650     do i=1,nx
651        if (gr_line(i,j).eq.1) then
652           bordouest=max(i-nneigh,1)
653           bordest=min(i+nneigh,nx)
654           bordsud=max(j-nneigh,1)
655           bordnord=min(j+nneigh,ny)
656           do nvx=bordouest,bordest
657              do nvy=bordsud,bordnord
658                 imx_reduce(nvx,nvy)=imx_diag(nvx,nvy)
659                 imy_reduce(nvx,nvy)=imy_diag(nvx,nvy)
660              enddo
661           enddo
662        endif
663     enddo
664  enddo
665
666! -- we need to keep imx_diag for the domain edges for land terminating geometries
667  imx_reduce(:,1) = imx_diag(:,1)
668  imx_reduce(:,2) = imx_diag(:,2)
669  imx_reduce(:,ny) = imx_diag(:,ny)
670  imx_reduce(1,:) = imx_diag(1,:)
671  imx_reduce(2,:) = imx_diag(2,:)
672  imx_reduce(nx,:) = imx_diag(nx,:)
673
674  imy_reduce(:,1) = imy_diag(:,1)
675  imy_reduce(:,2) = imy_diag(:,2)
676  imy_reduce(:,ny) = imy_diag(:,ny)
677  imy_reduce(1,:) = imy_diag(1,:)
678  imy_reduce(2,:) = imy_diag(2,:)
679  imy_reduce(nx,:) = imy_diag(nx,:)
680
681
682  else ! we do not reduce the extent
683     imx_reduce(:,:)=imx_diag(:,:)
684     imy_reduce(:,:)=imy_diag(:,:)
685  endif
686
687end subroutine imx_imy_nx_ny_reduce
688
689
690!___________________________________________________________________________
691! pour imposer les conditions de mismip sur les bords du fleuve
692! a appeler apres imx_imy_nx_ny
693
694subroutine mismip_boundary_cond
695
696use module3d_phy, only: itracebug,imx_diag,imy_diag,uxbar,uybar 
697
698implicit none
699
700if (itracebug.eq.1)  call tracebug(' Subroutine mismip_boundray_cond')
701
702! Condition pas de flux sur les bords nord et sud
703
704 imy_diag(:,2)      = 1
705 imy_diag(:,3)      = 1
706 imy_diag(:,ny-1)   = 1
707 imy_diag(:,ny)     = 1
708
709
710 Uybar(:,2)    = 0.
711 Uybar(:,3)    = 0.
712 Uybar(:,ny-1) = 0.
713 Uybar(:,ny)   = 0.
714
715
716! condition pas de cisaillement sur les bords nord et sud
717imx_diag(:,2)    = -1
718imx_diag(:,ny-1) = -3
719
720! coins
721imx_diag(2,2)     =  -41
722imx_diag(nx,2)    =  -12
723imx_diag(2,ny-1)  =  -34
724imx_diag(nx,ny-1) =  -23
725imx_diag(1,:)     =    0     ! ces points sont hors grille
726
727end subroutine mismip_boundary_cond
728
729!end module diagno_L2_mod
730end module diagno_mod
Note: See TracBrowser for help on using the repository browser.