This is the next level up of data and represents the supercell type. A supercell represents a collection of connected cells
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(cell_type), | public, | dimension(:), allocatable | :: | cells |
These are the cells |
||
integer, | public | :: | ncell | ||||
integer, | public | :: | nextend |
Length of the extended domain |
|||
integer, | public | :: | nrow |
The number of rows and columns. Equal to nextend*nfield |
|||
integer, | public | :: | ncol |
The number of rows and columns. Equal to nextend*nfield |
|||
integer, | public | :: | it_leftmost |
It index of leftmost cell |
|||
integer, | public | :: | head_iproc_world |
The proc id (in comm world) of the head proc |
|||
integer, | public | :: | head_iproc |
The proc id (in sc_sub_all) of the head proc |
|||
integer, | public | :: | head_iproc_pd |
The proc id (in sc_sub_pd) of the head proc |
|||
logical, | public | :: | is_local |
Does this supercell have any data on this proc? |
|||
logical, | public | :: | is_empty |
Have we got any data for this supercell on this proc? |
|||
logical, | public | :: | is_all_local |
Is all of this supercells data on this proc? |
|||
complex, | public, | dimension(:), allocatable | :: | tmp_sum |
Work space for field update |
||
type(comm_type), | public | :: | sc_sub_all |
Sub communicator involving all processors with this supercell |
|||
type(comm_type), | public | :: | sc_sub_pd |
Sub communicator for all procs with some data but not all of it |
|||
type(comm_type), | public | :: | parent_sub |
Sub communicator involving all processors in parent |
|||
integer, | public, | dimension(:), allocatable | :: | nb_req_hand |
For non-blocking broadcast request handle storage |
||
logical, | public | :: | initdone |
Have we finished initialising this block? |
|||
logical, | public, | dimension(:), allocatable | :: | initialised |
Have we initialised each point? |
||
logical, | public | :: | is_head | = | .false. |
Are we the head of this supercell? |
|
integer, | public | :: | is_ind |
The is_ind value is the index of the supercell in the parent ky_type's supercell array. |
|||
integer, | public | :: | is_label |
The is_label is the supercell_label of this supercell as determined by calculate_supercell_labels from elsewhere. |
|||
integer, | public | :: | ik_ind |
Parent properties |
|||
integer, | public | :: | collective_request | ||||
real, | public | :: | condition_number | = | -1 |
Condition number of the associated response matrix. Only valid on the head. |
Deallocate storage space
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
Allocate storage space
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
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 |
Debug printing
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self |
Get the field update DD>TAGGED
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
complex, | intent(in), | dimension(:,:) | :: | fq | ||
complex, | intent(in), | dimension(:,:) | :: | fqa | ||
complex, | intent(in), | dimension(:,:) | :: | fqp |
Reduce the field update across cells to give the final answer DD>TAGGED: As we currently have to do fm_gather_fields on every time step we only need
DD> At this point the head of the supercell has the field update stored in self%tmp_sum
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
Convert the extended domain index to ig, it and ifl
The iex_to routines all need testing!
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | iex | |||
integer, | intent(out) | :: | ig | |||
integer, | intent(out) | :: | ic | |||
integer, | intent(out) | :: | it | |||
integer, | intent(out) | :: | ifl |
Convert the extended domain index to ifl
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | iex | |||
integer, | intent(out) | :: | ifl |
Convert the extended domain index to ic
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | iex | |||
integer, | intent(out) | :: | ic |
Convert the extended domain index to ig
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | iex | |||
integer, | intent(out) | :: | ig |
Convert the extended domain index to it
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | iex | |||
integer, | intent(out) | :: | it |
Is the passed it a member of this supercell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | it |
A routine to reset the object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
Set the locality of each object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
class(pc_type), | intent(in) | :: | pc |
Given an it value get the it of the left connected cell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | it |
Store the field equations at row level
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
complex, | intent(in), | dimension(:, :) | :: | fq | ||
complex, | intent(in), | dimension(:, :) | :: | fqa | ||
complex, | intent(in), | dimension(:, :) | :: | fqp | ||
integer, | intent(in) | :: | ifl_in | |||
integer, | intent(in) | :: | it_in | |||
integer, | intent(in) | :: | ig_in |
A routine to collect all the row level data and store in passed array Gather the row blocks up for this cell to fill an array DD>FOR NOW USE ALL_REDUCE AS EASIER, BUT SHOULD BE ABLE
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
complex, | intent(out), | dimension(:,:) | :: | arr |
A routine to distribute an array to appropriate row blocks
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
complex, | intent(in), | dimension(self%nrow,self%ncol) | :: | arr |
Prepare the field matrix for calculating field updates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
integer, | intent(in) | :: | prepare_type | |||
class(pc_type), | intent(in) | :: | pc |
A routine to invert the field matrix
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
class(pc_type), | intent(in) | :: | pc |
A routine to invert the field matrix locally
Currently every processor which is responsible for a chunk of the response matrix at the solve stage will do this inversion. This is obviously duplicated work but allows us to skip any communication in the push_arr_to_rows method. If only one processor did the inversion then we would need to communicate the result back. We are unlikely to want to do this in a non-blocking manner as it would require that we hold onto the tmp_arr for each response matrix, only freeing this memory after the non-blocking communications have completed. As these matrices are large we don't want them hanging around longer than required. In the typical use case where we have large minnrow, we would expect most matrices to belong to just one or a few processors so this point may not be important in most cases.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
A routine to invert the field matrix using mpi
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
Debug routine to dump the current supercell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self | |||
character(len=*), | intent(in), | optional | :: | prefix |
Create primary (top level) sub communicators
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
Create the secondary (intraobject) subcommunicators
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
Routine to write the response matrix for this supercell to netcdf file.
Only the head processor actually writes to file. However, in current use we only call this routine on processors which have this supercell local and which don't consider it empty. This is usually ok, but for box runs the mode with ky=kx=0 (super)cell is forced to be considered empty which means that, as it stands, this supercell won't be dumped here (although it is for the fields_implicit approach). This could cause issues for restoring these response matrices as we end up recalculating these if we can't load any expected file. As such we have to be careful how we deal with this matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
The instance of the supercell class |
||
character(len=*), | intent(in), | optional | :: | suffix |
If passed then use as part of file suffix |
Routine to read the response matrix for this supercell from netcdf file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(inout) | :: | self |
The instance of the supercell class |
||
logical, | intent(out) | :: | could_read |
Flag to indicate if the file was successfully read |
||
character(len=*), | intent(in), | optional | :: | suffix |
If passed then use as part of file suffix |
type :: supercell_type
type(cell_type), dimension(:), allocatable :: cells !< These are the cells
integer :: ncell
integer :: nextend !< Length of the extended domain
integer :: nrow, ncol !< The number of rows and columns. Equal to nextend*nfield
integer :: it_leftmost !< It index of leftmost cell
integer :: head_iproc_world !< The proc id (in comm world) of the head proc
integer :: head_iproc !< The proc id (in sc_sub_all) of the head proc
integer :: head_iproc_pd !< The proc id (in sc_sub_pd) of the head proc
logical :: is_local !< Does this supercell have any data on this proc?
logical :: is_empty !< Have we got any data for this supercell on this proc?
logical :: is_all_local !< Is all of this supercells data on this proc?
complex, dimension(:),allocatable :: tmp_sum !< Work space for field update
type(comm_type) :: sc_sub_all !< Sub communicator involving all processors with this supercell
type(comm_type) :: sc_sub_pd !< Sub communicator for all procs with some data but not all of it
type(comm_type) :: parent_sub !< Sub communicator involving all processors in parent
integer, dimension(:),allocatable :: nb_req_hand !< For non-blocking broadcast request handle storage
logical :: initdone !< Have we finished initialising this block?
logical, dimension(:), allocatable :: initialised !< Have we initialised each point?
logical :: is_head = .false. !< Are we the head of this supercell?
!Cell and parent properties. Mostly for debug printing.
!> The is_ind value is the index of the supercell in the parent ky_type's
!> supercell array.
integer :: is_ind
!> The is_label is the supercell_label of this supercell as determined
!> by calculate_supercell_labels from elsewhere.
integer :: is_label
integer :: ik_ind !< Parent properties
integer :: collective_request
real :: condition_number = -1 !< Condition number of the associated response matrix. Only valid on the head.
contains
procedure :: deallocate => sc_deallocate
procedure :: allocate => sc_allocate
procedure :: init => sc_init
procedure :: debug_print => sc_debug_print
procedure :: get_field_update => sc_get_field_update
procedure :: reduce_tmpsum => sc_reduce_tmpsum
procedure :: iex_to_dims => sc_iex_to_dims
procedure :: iex_to_ifl => sc_iex_to_ifl
procedure :: iex_to_ic => sc_iex_to_ic
procedure :: iex_to_ig => sc_iex_to_ig
procedure :: iex_to_it => sc_iex_to_it
procedure :: has_it => sc_has_it
procedure :: reset => sc_reset
procedure :: set_locality => sc_set_locality
procedure :: get_left_it => sc_get_left_it
procedure :: store_fq => sc_store_fq
procedure :: pull_rows_to_arr => sc_pull_rows_to_arr
procedure :: push_arr_to_rows => sc_push_arr_to_rows
procedure :: prepare => sc_prepare
procedure :: invert => sc_invert
procedure :: invert_local => sc_invert_local
procedure :: invert_mpi => sc_invert_mpi
procedure :: dump => sc_dump
procedure :: make_subcom_1 => sc_make_subcom_1
procedure :: make_subcom_2 => sc_make_subcom_2
procedure :: dump_to_file => sc_dump_to_file
procedure :: read_from_file => sc_read_from_file
end type supercell_type