1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
! +---------------------------------+
! | Smoothing |
! +---------------------------------+
do IT=1,1
! Periodic
if(BoundMG(1,1) == 12) VG(1)%U(0,:,:) = VG(1)%U(n1(1),:,:)
if(BoundMG(1,2) == 12) VG(1)%U(n1(1)+1,:,:) = VG(1)%U(1,:,:)
if(BoundMG(2,1) == 12) VG(1)%U(:,0,:) = VG(1)%U(:,n2(1),:)
if(BoundMG(2,2) == 12) VG(1)%U(:,n2(1)+1,:) = VG(1)%U(:,1,:)
! Neumann
if(BoundMG(1,1) == 1) VG(1)%U(0,:,:) = VG(1)%U(2,:,:)
if(BoundMG(1,2) == 1) VG(1)%U(n1(1)+1,:,:) = VG(1)%U(n1(1)-1,:,:)
if(BoundMG(2,1) == 1) VG(1)%U(:,0,:) = VG(1)%U(:,2,:)
if(BoundMG(2,2) == 1) VG(1)%U(:,n2(1)+1,:) = VG(1)%U(:,n2(1)-1,:)
! Center Pass for Red Nodes
do i=1+m01,n1(1)-m11,1
do j=1+m02+mod(i-1,2),n2(1)-m12,2
VG(1)%U(i,j,1) = (VG(1)%U(i+1,j,1) + VG(1)%U(i-1,j,1) + VG(1)%U(i,j+1,1) + &
& VG(1)%U(i,j-1,1) - h(1)*h(1)*VG(1)%F(i,j,1))/4.0d0
end do
end do
! Periodic
if(BoundMG(1,1) == 12) VG(1)%U(0,:,:) = VG(1)%U(n1(1),:,:)
if(BoundMG(1,2) == 12) VG(1)%U(n1(1)+1,:,:) = VG(1)%U(1,:,:)
if(BoundMG(2,1) == 12) VG(1)%U(:,0,:) = VG(1)%U(:,n2(1),:)
if(BoundMG(2,2) == 12) VG(1)%U(:,n2(1)+1,:) = VG(1)%U(:,1,:)
! Neumann
if(BoundMG(1,1) == 1) VG(1)%U(0,:,:) = VG(1)%U(2,:,:)
if(BoundMG(1,2) == 1) VG(1)%U(n1(1)+1,:,:) = VG(1)%U(n1(1)-1,:,:)
if(BoundMG(2,1) == 1) VG(1)%U(:,0,:) = VG(1)%U(:,2,:)
if(BoundMG(2,2) == 1) VG(1)%U(:,n2(1)+1,:) = VG(1)%U(:,n2(1)-1,:)
! Center Pass for Black Nodes
do i=1+m01,n1(1)-m11,1
do j=1+m02+mod(i,2),n2(1)-m12,2
VG(1)%U(i,j,1) = (VG(1)%U(i+1,j,1) + VG(1)%U(i-1,j,1) + VG(1)%U(i,j+1,1) + &
& VG(1)%U(i,j-1,1) - h(1)*h(1)*VG(1)%F(i,j,1))/4.0d0
end do
end do
end do
! +---------------------------------+
! | Residut Calculation |
! +---------------------------------+
do i=1+m01,n1(1)-m11,1
do j=1+m02,n2(1)-m12,1
VG(1)%Residut(i,j,1) = VG(1)%F(i,j,1) - (VG(1)%U(i+1,j,1) + VG(1)%U(i-1,j,1) + &
& VG(1)%U(i,j+1,1) + VG(1)%U(i,j-1,1) - 4*VG(1)%U(i,j,1))/(h(1)*h(1))
end do
end do
! +---------------------------------+
! | Restriction |
! +---------------------------------+
k=1
do i=1,n1(2),1
do j=1,n2(2),1
ii=(i-1)*2+1
jj=(j-1)*2+1
VG(2)%F(i,j,1) = (VG(1)%Residut(ii, jj,1)+VG(1)%Residut(ii+1,jj,1)+ &
& VG(1)%Residut(ii,jj+1,1)+VG(1)%Residut(ii+1,jj+1,1))*0.25d0
end do
end do |
Partager