Initialise the supercell instance by setting and calculating some basic properties. Does not deal with allocating all storage etc.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
integer, | intent(in) | :: | is | |||
integer, | intent(in) | :: | itmin | |||
integer, | intent(in) | :: | ik | |||
integer, | intent(in) | :: | nfield | |||
integer, | intent(inout) | :: | nbound |
subroutine sc_init(self, is, itmin, ik, nfield, nbound)
use theta_grid, only: ntgrid
use mp, only: mp_request_null
use kt_grids, only: itright, supercell_labels, n_cells
implicit none
class(supercell_type), intent(in out) :: self
integer, intent(in) :: is, ik, itmin, nfield
integer, intent(in out) :: nbound
integer :: it, ic
logical :: ignore_boundary
self%is_ind = is
self%it_leftmost = itmin
self%ncell = n_cells(itmin, ik)
self%ik_ind = ik
self%is_label = supercell_labels(itmin, ik)
self%nextend = 1 + 2 * ntgrid * self%ncell
self%nrow = self%nextend * nfield
self%ncol = self%nrow
self%collective_request = mp_request_null
allocate (self%initialised(self%nextend))
self%initialised = .false.
! Now setup cells
allocate (self%cells(self%ncell))
it = itmin
do ic = 1, self%ncell
!We ignore the boundary for all cells except the rightmost
ignore_boundary = ic < self%ncell
if (ignore_boundary) nbound = nbound + 1
call self%cells(ic)%init( ic, it, is, ik, nfield, &
self%nrow, self%nextend, ignore_boundary)
!Update it
if (ic < self%ncell) it = itright(it, ik)
end do
end subroutine sc_init