Perform Laplacian operator on a box
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg | |||
| integer, | intent(in) | :: | id | |||
| integer, | intent(in) | :: | nc | |||
| integer, | intent(in) | :: | i_out |
Index of variable to store Laplacian in |
subroutine box_vlpl(mg, id, nc, i_out) type(mg_t), intent(inout) :: mg integer, intent(in) :: id integer, intent(in) :: nc integer, intent(in) :: i_out !< Index of variable to store Laplacian in integer :: i real(dp) :: idr2(2*1), a0, u0, u(2*1), a(2*1) ! Duplicate 1/dr^2 array to multiply neighbor values idr2(1:2*1:2) = 1/mg%dr(:, mg%boxes(id)%lvl)**2 idr2(2:2*1:2) = idr2(1:2*1:2) associate (cc => mg%boxes(id)%cc, n => mg_iphi, i_eps => mg_iveps) do i = 1, nc a0 = cc(i, i_eps) a(1:2) = cc(i-1:i+1:2, i_eps) u0 = cc(i, n) u(1:2) = cc(i-1:i+1:2, n) cc(i, i_out) = sum(2 * idr2 * a0*a(:)/(a0 + a(:)) * (u(:) - u0)) end do end associate end subroutine box_vlpl