box_lpl Subroutine

private subroutine box_lpl(mg, id, nc, i_out)

Perform Laplacian operator on a box

Arguments

Type IntentOptional 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


Source Code

  subroutine box_lpl(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(1)

    idr2 = 1 / mg%dr(:, mg%boxes(id)%lvl)**2

    associate (cc => mg%boxes(id)%cc, n => mg_iphi)
      do i = 1, nc
            cc(i, i_out) = idr2(1) * (cc(i-1, n) + cc(i+1, n) - 2 * cc(i, n))
         end do
    end associate
  end subroutine box_lpl