source: trunk/SOURCES/slope_surf.f90 @ 37

Last change on this file since 37 was 4, checked in by dumas, 10 years ago

initial import GRISLI trunk

File size: 2.0 KB
Line 
1!> \file slope_surf.f90
2!!  File to compute the surface slope by finite difference
3!<
4
5!> SUBROUTINE:  slope_surf
6!! Compute the surface slope by finite difference
7!! \author Catritz
8!! \date ...
9!! @note Used module
10!! @note   - use module3D_phy
11!<
12
13subroutine slope_surf
14
15use module3D_phy
16implicit none
17
18real :: inv_4dx        ! inverse de dx pour eviter les divisions =1/(4*dx)
19inv_4dx = 1./(4.*dx)
20
21
22
23do j=1,ny                                 ! slope along x on node >
24   do i=2,nx
25      sdx(i,j)=(s(i,j)-s(i-1,j))/dx
26   end do
27end do
28
29do j=2,ny                                 ! slope along y on node ^
30   do i=1,nx
31      sdy(i,j)=(s(i,j)-s(i,j-1))/dy
32   end do
33end do
34
35do j=2,ny-1                               ! slope amplitude on node o
36   do i=2,nx-1
37      slope(i,j)=(s(i+1,j)-s(i-1,j))**2 + (s(i,j+1)-s(i,j-1))**2
38      slope(i,j)=slope(i,j)**0.5 / dx /2.
39   end do
40end do
41
42
43do j=2,ny                                 ! slope along x on node ^ (average)
44   do i=2,nx-1
45      sdxmy(i,j)= ((s(i+1,j)-s(i-1,j))+s(i+1,j-1)-s(i-1,j-1))*inv_4dx
46   end do
47end do
48
49do j=2,ny-1                               ! slope along y on node > (average)
50   do i=2,nx
51      sdymx(i,j)= ((s(i,j+1)-s(i,j-1))+s(i-1,j+1)-s(i-1,j-1))*inv_4dx
52   enddo
53enddo
54
55slope2mx(:,:)=sdx(:,:)**2+sdymx(:,:)**2   ! slope amplitude on node  >
56slope2my(:,:)=sdy(:,:)**2+sdxmy(:,:)**2   ! slope amplitude on node  ^
57
58! conditions on the grid boundaries
59
60slope(1,:)    =  0.
61slope(:,1)    =  0.
62slope(nx,:)   =  0.
63slope(:,ny)   =  0.
64
65slope2mx(1,:) =  0.
66slope2mx(:,1) =  0.
67slope2mx(:,ny) = 0.
68
69slope2my(1,:) =  0.
70slope2my(:,1) =  0.
71slope2my(nx,:) = 0.
72
73
74! limitation to 2e-2
75sdx(:,:)=max(sdx(:,:),-2.e-2)
76sdx(:,:)=min(sdx(:,:),2.e-2)
77sdxmy(:,:)=max(sdxmy(:,:),-2.e-2)
78sdxmy(:,:)=min(sdxmy(:,:),2.e-2)
79slope2mx(:,:)=min(slope2mx(:,:),4.e-4)
80
81sdy(:,:)=max(sdy(:,:),-2.e-2)
82sdy(:,:)=min(sdy(:,:),2.e-2)
83sdymx(:,:)=max(sdymx(:,:),-2.e-2)
84sdymx(:,:)=min(sdymx(:,:),2.e-2)
85slope2my(:,:)=min(slope2my(:,:),4.e-4)
86
87slope(:,:)=min(slope(:,:),2.e-2)
88
89
90debug_3D(:,:,21)=sdx(:,:)
91debug_3D(:,:,22)=sdy(:,:)
92end subroutine slope_surf
Note: See TracBrowser for help on using the repository browser.