fieldmat_type Derived Type

type, private :: fieldmat_type

This is the top level object, consisting of a collection of ky blocks.


Contents

Source Code


Components

Type Visibility Attributes Name Initial
type(ky_type), public, dimension(:), allocatable :: kyb

The ky blocks

integer, public :: naky

Number of ky blocks

integer, public :: ntheta0
integer, public :: npts

Total number of theta grid points on all extended domains

integer, public :: nbound

Number of ignored boundary points

logical, public :: is_local

Does this supercell have any data on this proc?

logical, public :: is_empty

Have we got any data for the fieldmat on this proc?

logical, public :: is_all_local

Is all of this supercells data on this proc?

type(comm_type), public :: fm_sub_all

Sub communicator involving all processors with fieldmat

type(comm_type), public :: fm_sub_headsc_p0

Sub communicator involving the supercell heads and proc0

integer, public :: prepare_type = 0

What sort of preparation do we do to the field matrix

integer, public, dimension(:,:), allocatable :: heads

An array that holds the iproc (from comm world) of the supercell head for a given ik,it point

logical, public :: no_populate = .false.

Advanced usage only, if true then don't populate response

logical, public :: no_prepare = .false.

Advanced usage only, if true then don't prepare (invert) response


Type-Bound Procedures

procedure, private, :: deallocate => fm_deallocate

  • private subroutine fm_deallocate(self)

    Deallocate storage space

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: allocate => fm_allocate

  • private subroutine fm_allocate(self)

    Allocate storage space

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: debug_print => fm_debug_print

  • private subroutine fm_debug_print(self)

    Debug printing

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self

procedure, private, :: get_field_update => fm_get_field_update

  • private subroutine fm_get_field_update(self, phi, apar, bpar)

    A routine to calculate the update to the fields DD>Could improve performance by using a "smart" routine which only operates on local/not empty data

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self
    complex, intent(inout), dimension(:,:,:) :: phi
    complex, intent(inout), dimension(:,:,:) :: apar
    complex, intent(inout), dimension(:,:,:) :: bpar

procedure, private, :: init => fm_init

  • private subroutine fm_init(self)

    Initialise the field objects

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: reset => fm_reset

  • private subroutine fm_reset(self)

    A routine to reset the object

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: populate => fm_populate

  • private subroutine fm_populate(self)

    Find the response of g to delta-fn field perturbations and store at the row level

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: init_next_field_points => fm_init_next_field_points

  • private subroutine fm_init_next_field_points(self, field, pts_remain, kwork_filter, ifl)

    Initialise the next set of delta functions, find the response and store in the appropriate rows. DD>Could improve performance by using a "smart" routine which only operates on local/not empty data

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self
    complex, intent(inout), dimension(-ntgrid:ntgrid,ntheta0,naky) :: field
    integer, intent(inout) :: pts_remain
    logical, intent(inout), dimension(ntheta0, naky) :: kwork_filter
    integer, intent(in) :: ifl

procedure, private, :: prepare => fm_prepare

  • private subroutine fm_prepare(self)

    Prepare the field matrix for calculating field updates

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: make_subcom_1 => fm_make_subcom_1

  • private subroutine fm_make_subcom_1(self)

    Create all the necessary subcommunicators

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: make_subcom_2 => fm_make_subcom_2

  • private subroutine fm_make_subcom_2(self)

    Create the secondary subcommunicators

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: calc_sc_heads => fm_calc_sc_heads

procedure, private, :: gather_fields => fm_gather_fields

  • private subroutine fm_gather_fields(self, ph, ap, bp, to_all_in, do_allreduce_in)

    Gather all the fields to proc0/all for diagnostics etc. DD>TAGGED:Worth looking at improving this bad memory pattern

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self
    complex, intent(inout), dimension(:,:,:) :: ph
    complex, intent(inout), dimension(:,:,:) :: ap
    complex, intent(inout), dimension(:,:,:) :: bp
    logical, intent(in), optional :: to_all_in
    logical, intent(in), optional :: do_allreduce_in

procedure, private, :: unpack_to_field => fm_unpack_to_field

  • private subroutine fm_unpack_to_field(self, ph, ap, bp)

    A routine to unpack the supercell tmp_sum vectors to full field arrays

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self
    complex, intent(inout), dimension(-ntgrid:,:,:) :: ph
    complex, intent(inout), dimension(-ntgrid:,:,:) :: ap
    complex, intent(inout), dimension(-ntgrid:,:,:) :: bp

procedure, private, :: write_debug_data => fm_write_debug_data

  • private subroutine fm_write_debug_data(self)

    Write some debug data to file

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self

procedure, private, :: set_is_local => fm_set_is_local

  • private subroutine fm_set_is_local(self)

    Just work out the locality (also sets is_empty etc. but is not intended for this)

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: count_subcom => fm_count_subcom

  • private subroutine fm_count_subcom(self)

    Count how many subcommunicators will be created

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(inout) :: self

procedure, private, :: getfieldeq_nogath => fm_getfieldeq_nogath

  • private subroutine fm_getfieldeq_nogath(self, phi, apar, bpar, fieldeq, fieldeqa, fieldeqp)

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self
    complex, intent(in), dimension (-ntgrid:,:,:) :: phi
    complex, intent(in), dimension (-ntgrid:,:,:) :: apar
    complex, intent(in), dimension (-ntgrid:,:,:) :: bpar
    complex, intent(inout), dimension (-ntgrid:,:,:) :: fieldeq
    complex, intent(inout), dimension (-ntgrid:,:,:) :: fieldeqa
    complex, intent(inout), dimension (-ntgrid:,:,:) :: fieldeqp

procedure, private, :: reduce_an => fm_reduce_an_head_send_broadcast

  • private subroutine fm_reduce_an_head_send_broadcast(self, antot, antota, antotp)

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self
    complex, intent(inout), dimension (-ntgrid:,:,:) :: antot
    complex, intent(inout), dimension (-ntgrid:,:,:) :: antota
    complex, intent(inout), dimension (-ntgrid:,:,:) :: antotp

procedure, private, :: check_an => fm_check_an

  • private subroutine fm_check_an(self, antot, tempantot, antota, tempantota, antotp, tempantotp)

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self
    complex, intent(in), dimension (-ntgrid:,:,:) :: antot
    complex, intent(in), dimension (-ntgrid:,:,:) :: tempantot
    complex, intent(in), dimension (-ntgrid:,:,:) :: antota
    complex, intent(in), dimension (-ntgrid:,:,:) :: tempantota
    complex, intent(in), dimension (-ntgrid:,:,:) :: antotp
    complex, intent(in), dimension (-ntgrid:,:,:) :: tempantotp

procedure, private, :: getfieldeq1_nogath => fm_getfieldeq1_nogath

  • private subroutine fm_getfieldeq1_nogath(self, phi, apar, bpar, antot, antota, antotp, fieldeq, fieldeqa, fieldeqp)

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self
    complex, intent(in), dimension (-ntgrid:,:,:) :: phi
    complex, intent(in), dimension (-ntgrid:,:,:) :: apar
    complex, intent(in), dimension (-ntgrid:,:,:) :: bpar
    complex, intent(in), dimension (-ntgrid:,:,:) :: antot
    complex, intent(in), dimension (-ntgrid:,:,:) :: antota
    complex, intent(in), dimension (-ntgrid:,:,:) :: antotp
    complex, intent(inout), dimension (-ntgrid:,:,:) :: fieldeq
    complex, intent(inout), dimension (-ntgrid:,:,:) :: fieldeqa
    complex, intent(inout), dimension (-ntgrid:,:,:) :: fieldeqp

procedure, private, :: update_fields => fm_update_fields

  • private subroutine fm_update_fields(self, phi, apar, bpar)

    Update the fields using calculated update

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self
    complex, intent(inout), dimension(:,:,:) :: phi
    complex, intent(inout), dimension(:,:,:) :: apar
    complex, intent(inout), dimension(:,:,:) :: bpar

procedure, private, :: update_fields_newstep => fm_update_fields_newstep

procedure, private, :: get_condition_numbers => fm_get_condition_numbers

  • private subroutine fm_get_condition_numbers(self)

    Fetch all condition numbers to proc0 and report on worrying values as required.

    Arguments

    Type IntentOptional Attributes Name
    class(fieldmat_type), intent(in) :: self

Source Code

  type, private :: fieldmat_type
     type(ky_type), dimension(:), allocatable :: kyb !< The ky blocks
     integer :: naky !< Number of ky blocks
     integer :: ntheta0 
     integer :: npts !< Total number of theta grid points on all extended domains
     integer :: nbound !< Number of ignored boundary points
     logical :: is_local !< Does this supercell have any data on this proc?
     logical :: is_empty !< Have we got any data for the fieldmat on this proc?
     logical :: is_all_local !< Is all of this supercells data on this proc?
     type(comm_type) :: fm_sub_all !< Sub communicator involving all processors with fieldmat
     type(comm_type) :: fm_sub_headsc_p0 !< Sub communicator involving the supercell heads and proc0
     integer :: prepare_type=0 !< What sort of preparation do we do to the field matrix
     !Currently only support:
     !0   : Invert the field matrix
     !In the future may wish to do things like LU decomposition etc.
     !Could also do things like eigenvalue analysis etc.
     integer, dimension(:,:), allocatable :: heads !<  An array that holds the iproc (from comm world) of the supercell head for a given ik,it point
     logical :: no_populate=.false. !< Advanced usage only, if true then don't populate response
     logical :: no_prepare=.false. !< Advanced usage only, if true then don't prepare (invert) response
   contains
     private
     procedure :: deallocate => fm_deallocate
     procedure :: allocate => fm_allocate
     procedure :: debug_print => fm_debug_print
     procedure :: get_field_update => fm_get_field_update
     procedure :: init => fm_init
     procedure :: reset => fm_reset
     procedure :: populate => fm_populate
     procedure :: init_next_field_points => fm_init_next_field_points
     procedure :: prepare => fm_prepare
     procedure :: make_subcom_1 => fm_make_subcom_1
     procedure :: make_subcom_2 => fm_make_subcom_2
     procedure :: calc_sc_heads => fm_calc_sc_heads
     procedure :: gather_fields => fm_gather_fields
     procedure :: unpack_to_field => fm_unpack_to_field
     procedure :: write_debug_data => fm_write_debug_data
     procedure :: set_is_local => fm_set_is_local
     procedure :: count_subcom => fm_count_subcom
     procedure :: getfieldeq_nogath => fm_getfieldeq_nogath
     procedure :: reduce_an => fm_reduce_an_head_send_broadcast
     procedure :: check_an => fm_check_an
     procedure :: getfieldeq1_nogath => fm_getfieldeq1_nogath
     procedure :: update_fields => fm_update_fields
     procedure :: update_fields_newstep => fm_update_fields_newstep
     procedure :: get_condition_numbers => fm_get_condition_numbers
  end type fieldmat_type