1 | !> \file moy_mxmy_shift.f90 |
---|
2 | !! Fait la moyenne ponderee d'un tableau X2D sur les mailles staggered |
---|
3 | !< |
---|
4 | |
---|
5 | !> SUBROUTINE: moy_mxmy() |
---|
6 | !! \author ... |
---|
7 | !! \date ... |
---|
8 | !! @note Cette routine permet de faire la moyenne ponderee d'un tableau X2D sur les mailles staggered |
---|
9 | !! \param n1 [in] dimension des tableaux |
---|
10 | !! \param n2 [in] dimension des tableaux |
---|
11 | !! \param X2D [in] tableau sur les noeuds majeurs |
---|
12 | !! \param X_mx [out] tableau sur les noeuds mineurs x |
---|
13 | !! \param X_my [out] tableau sur les noeuds mineurs y |
---|
14 | !! \return X_mx, X_my |
---|
15 | !< |
---|
16 | subroutine moy_mxmy(n1,n2,X2D,X_mx,X_my) |
---|
17 | ! fait la moyenne ponderee d'un tableau X2D sur les mailles staggered |
---|
18 | |
---|
19 | implicit none |
---|
20 | integer, intent(in) :: n1,n2 !< dimension des tableaux |
---|
21 | real, dimension(n1,n2),intent(in) :: X2D !< tableau sur les noeuds majeurs |
---|
22 | real, dimension(n1,n2),intent(out) :: X_mx !< tableau sur les noeuds mineurs x |
---|
23 | real, dimension(n1,n2),intent(out) :: X_my !< tableau sur les noeuds mineurs y |
---|
24 | |
---|
25 | ! tableaux de travail |
---|
26 | |
---|
27 | real, dimension(n1,n2) :: X_sud |
---|
28 | real, dimension(n1,n2) :: X_nord |
---|
29 | real, dimension(n1,n2) :: X_west |
---|
30 | real, dimension(n1,n2) :: X_est |
---|
31 | real, dimension(n1,n2) :: X_SW |
---|
32 | real, dimension(n1,n2) :: X_SE |
---|
33 | real, dimension(n1,n2) :: X_NW |
---|
34 | real, dimension(n1,n2) :: X_NE |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | integer :: i,j |
---|
39 | integer :: i_moins1,j_moins1,i_plus1,j_plus1 |
---|
40 | |
---|
41 | ! l'orientation correspond a la direction vers laquelle on se deplace |
---|
42 | !--------------------------------------------------------------------- |
---|
43 | X_west = eoshift(X2D(:,:),shift=-1,boundary=0.,dim=1) ! X_west(i,j) = X(i-1,j) |
---|
44 | X_est = eoshift(X2D(:,:),shift=+1,boundary=0.,dim=1) ! X_est(i,j) = X(i+1,j) |
---|
45 | X_sud = eoshift(X2D(:,:),shift=-1,boundary=0.,dim=2) ! X_sud(i,j) = X(i,j-1) |
---|
46 | X_nord = eoshift(X2D(:,:),shift=+1,boundary=0.,dim=2) ! X_nord(i,j) = X(i,j+1) |
---|
47 | |
---|
48 | X_se = eoshift( X_sud(:,:),shift=+1,boundary=0.,dim=1) ! X_se(i,j) = X(i+1,j-1) |
---|
49 | X_sw = eoshift( X_sud(:,:),shift=-1,boundary=0.,dim=1) ! X_sw(i,j) = X(i-1,j-1) |
---|
50 | X_ne = eoshift(X_nord(:,:),shift=+1,boundary=0.,dim=1) ! X_ne(i,j) = X(i+1,j+1) |
---|
51 | X_nw = eoshift(X_nord(:,:),shift=-1,boundary=0.,dim=1) ! X_nw(i,j) = X(i-1,j+1) |
---|
52 | |
---|
53 | X_mx = 0.25*(X2D+X_west)+0.125*((X_nw+X_nord)+(X_sw+X_sud)) |
---|
54 | X_my = 0.25*(X2D+X_sud)+0.125*((X_est+X_se)+(X_sw+X_west)) |
---|
55 | |
---|
56 | |
---|
57 | return |
---|
58 | end subroutine moy_mxmy |
---|
59 | |
---|
60 | |
---|