1 | |
---|
2 | !> \file moy_mxmy.f90 |
---|
3 | !! Fait la moyenne ponderee d'un tableau X2D sur les mailles staggered |
---|
4 | !< |
---|
5 | |
---|
6 | |
---|
7 | !> SUBROUTINE: moy_mxmy() |
---|
8 | !! \author ... |
---|
9 | !! \date ... |
---|
10 | !! @note Cette routine permet de faire la moyenne ponderee d'un tableau X2D sur les mailles staggered |
---|
11 | !! \param n1 [in] dimension des tableaux |
---|
12 | !! \param n2 [in] dimension des tableaux |
---|
13 | !! \param X2D [in] tableau sur les noeuds majeurs |
---|
14 | !! \param X_mx [out] tableau sur les noeuds mineurs x |
---|
15 | !! \param X_my [out] tableau sur les noeuds mineurs y |
---|
16 | !! \return X_mx, X_my |
---|
17 | !< |
---|
18 | subroutine moy_mxmy(n1,n2,X2D,X_mx,X_my) |
---|
19 | ! fait la moyenne ponderee d'un tableau X2D sur les mailles staggered |
---|
20 | !$ USE OMP_LIB |
---|
21 | implicit none |
---|
22 | integer, intent(in) :: n1,n2 !< dimension des tableaux |
---|
23 | real, dimension(n1,n2),intent(in) :: X2D !< tableau sur les noeuds majeurs |
---|
24 | real, dimension(n1,n2),intent(out) :: X_mx !< tableau sur les noeuds mineurs x |
---|
25 | real, dimension(n1,n2),intent(out) :: X_my !< tableau sur les noeuds mineurs y |
---|
26 | |
---|
27 | integer :: i,j |
---|
28 | integer :: i_moins1,j_moins1,i_plus1,j_plus1 |
---|
29 | |
---|
30 | |
---|
31 | !$OMP PARALLEL PRIVATE(i_moins1,j_moins1,i_plus1,j_plus1) |
---|
32 | !$OMP DO |
---|
33 | do j=1,n2 |
---|
34 | do i=1,n1 |
---|
35 | i_moins1=max(1,i-1) |
---|
36 | j_moins1=max(1,j-1) |
---|
37 | i_plus1=min(n1,i+1) |
---|
38 | j_plus1=min(n2,j+1) |
---|
39 | |
---|
40 | X_mx(i,j)=0.25*(X2D(i,j)+X2D(i_moins1,j)) & |
---|
41 | + 0.125*((X2D(i_moins1,j_plus1)+X2D(i,j_plus1)) & |
---|
42 | + (X2D(i_moins1,j_moins1)+X2D(i,j_moins1))) |
---|
43 | |
---|
44 | X_my(i,j)=0.25*(X2D(i,j)+X2D(i,j_moins1)) & |
---|
45 | + 0.125*((X2D(i_plus1,j_moins1)+X2D(i_plus1,j)) & |
---|
46 | + (X2D(i_moins1,j_moins1)+X2D(i_moins1,j))) |
---|
47 | end do |
---|
48 | end do |
---|
49 | !$OMP END DO |
---|
50 | !$OMP END PARALLEL |
---|
51 | |
---|
52 | return |
---|
53 | end subroutine moy_mxmy |
---|
54 | |
---|
55 | |
---|