Prolong from a parent to a child with index offset dix
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg | |||
| integer, | intent(in) | :: | p_id |
Id of parent |
||
| integer, | intent(in) | :: | dix(2) |
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,nc) |
Prolonged values |
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(2) !< 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, nc) !< Prolonged values integer :: i, j, hnc integer :: ic, jc real(dp) :: f0, flx, fhx, fly, fhy hnc = nc/2 associate (crs => mg%boxes(p_id)%cc) do j = 1, hnc jc = j + dix(2) do i = 1, hnc ic = i + dix(1) f0 = 0.5_dp * crs(ic, jc, iv) flx = 0.25_dp * crs(ic-1, jc, iv) fhx = 0.25_dp * crs(ic+1, jc, iv) fly = 0.25_dp * crs(ic, jc-1, iv) fhy = 0.25_dp * crs(ic, jc+1, iv) fine(2*i-1, 2*j-1) = f0 + flx + fly fine(2*i , 2*j-1) = f0 + fhx + fly fine(2*i-1, 2*j) = f0 + flx + fhy fine(2*i , 2*j) = f0 + fhx + fhy end do end do end associate end subroutine mg_prolong_sparse