mg_prolong_sparse Subroutine

public subroutine mg_prolong_sparse(mg, p_id, dix, nc, iv, fine)

Prolong from a parent to a child with index offset dix

Arguments

Type IntentOptional Attributes Name
type(mg_t), intent(inout) :: mg
integer, intent(in) :: p_id

Id of parent

integer, intent(in) :: dix(1)

Offset of child in parent grid

integer, intent(in) :: nc

Child grid size

integer, intent(in) :: iv

Prolong from this variable

real(kind=dp), intent(out) :: fine(nc)

Prolonged values


Source Code

  subroutine mg_prolong_sparse(mg, p_id, dix, nc, iv, fine)
    type(mg_t), intent(inout) :: mg
    integer, intent(in)       :: p_id
    !< Id of parent
    integer, intent(in)       :: dix(1)
    !< Offset of child in parent grid
    integer, intent(in)       :: nc
    !< Child grid size
    integer, intent(in)       :: iv
    !< Prolong from this variable
    real(dp), intent(out)     :: fine(nc)
    !< Prolonged values

    integer  :: i, hnc
    integer  :: ic
    real(dp) :: f0, flx, fhx

    hnc = nc/2

    associate (crs => mg%boxes(p_id)%cc)
      do i = 1, hnc
         ic = i + dix(1)

         f0  = 0.75_dp * crs(ic, iv)
         flx = 0.25_dp * crs(ic-1, iv)
         fhx = 0.25_dp * crs(ic+1, iv)

         fine(2*i-1)   = f0 + flx
         fine(2*i  )   = f0 + fhx
      end do
    end associate
  end subroutine mg_prolong_sparse