Perform Gauss-Seidel relaxation on box for a Helmholtz operator
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg | |||
| integer, | intent(in) | :: | id | |||
| integer, | intent(in) | :: | nc | |||
| integer, | intent(in) | :: | redblack_cntr |
Iteration counter |
subroutine box_gs_helmh(mg, id, nc, redblack_cntr) type(mg_t), intent(inout) :: mg integer, intent(in) :: id integer, intent(in) :: nc integer, intent(in) :: redblack_cntr !< Iteration counter integer :: i, i0, di real(dp) :: idr2(1), fac logical :: redblack idr2 = 1/mg%dr(:, mg%boxes(id)%lvl)**2 fac = 1.0_dp / (2 * sum(idr2) + helmholtz_lambda) i0 = 1 redblack = (mg%smoother_type == mg_smoother_gsrb) if (redblack) then di = 2 else di = 1 end if ! The parity of redblack_cntr determines which cells we use. If ! redblack_cntr is even, we use the even cells and vice versa. associate (cc => mg%boxes(id)%cc, n => mg_iphi) if (redblack) i0 = 2 - iand(redblack_cntr, 1) do i = i0, nc, di cc(i, n) = fac * ( idr2(1) * (cc(i+1, n) + cc(i-1, n)) - cc(i,& mg_irhs)) end do end associate end subroutine box_gs_helmh