krn_t Derived Type

type, public :: krn_t

Structure which will be used to size matrices like: coo,csr and ports


Inherits

type~~krn_t~~InheritsGraph type~krn_t krn_t type~coo_csr_t coo_csr_t type~krn_t->type~coo_csr_t imp, exp type~ff_flux_port_t FF_flux_port_t type~krn_t->type~ff_flux_port_t FF_flux_ports type~ff_src_port_t FF_src_port_t type~krn_t->type~ff_src_port_t FF_src_ports type~fs_port_t FS_port_t type~krn_t->type~fs_port_t FS_ports type~port_list_t port_list_t type~krn_t->type~port_list_t FF_flux_list, FF_src_list, FS_list, SS_flux_list, SS_src_list type~ss_flux_port_t SS_flux_port_t type~krn_t->type~ss_flux_port_t SS_flux_ports type~ss_src_port_t SS_src_port_t type~krn_t->type~ss_src_port_t SS_src_ports mkl_pardiso_handle mkl_pardiso_handle type~coo_csr_t->mkl_pardiso_handle pt type~dbl_pointer_t dbl_pointer_t type~coo_csr_t->type~dbl_pointer_t coo_ptr, csr_ptr type~port_t port_t type~ff_flux_port_t->type~port_t type~ff_src_port_t->type~port_t type~fs_port_t->type~port_t type~ss_flux_port_t->type~port_t type~ss_src_port_t->type~port_t

Components

Type Visibility Attributes Name Initial
integer, public :: idx = 1
integer, public, allocatable :: nb_state_vars(:)
integer, public, allocatable :: nb_non_zeros_exp(:)
integer, public, allocatable :: nb_non_zeros_imp(:)
type(port_list_t), public :: FF_flux_list
type(port_list_t), public :: FF_src_list
type(port_list_t), public :: FS_list
type(port_list_t), public :: SS_flux_list
type(port_list_t), public :: SS_src_list
character(len=:), public, allocatable :: PortIdxForFSLink_List
type(coo_csr_t(:)), public, allocatable :: imp

Implicit matrices in both format coo and csr

type(coo_csr_t(:)), public, allocatable :: exp

Explicit matrices in both format coo and csr

real(kind=dp), public, allocatable :: rhs_or_solution(:)

Right hand side of linear equation or it's solution

real(kind=dp), public, allocatable :: solution(:)

solution vector of the linear system

type(FF_flux_port_t), public, allocatable :: FF_flux_ports(:)

Fluid/Fluid port array --> flux

type(FF_src_port_t), public, allocatable :: FF_src_ports(:)

Fluid/Fluid port array --> source

type(FS_port_t), public, allocatable :: FS_ports(:)

Fluid/Solid port array

type(SS_flux_port_t), public, allocatable :: SS_flux_ports(:)

Solid/Solid port array --> flux

type(SS_src_port_t), public, allocatable :: SS_src_ports(:)

Solid/Solid port array --> source


Type-Bound Procedures

procedure, public :: init_part1 => krn_init_part1

Allocating kernel arrays with number components

  • public subroutine krn_init_part1(me, size)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout) :: me
    integer, intent(in) :: size

procedure, public :: add => krn_add

Used by all components add their array and port requirements

  • public subroutine krn_add(me, name, nb_state_vars, nb_non_zeros_exp, nb_non_zeros_imp, nb_FF_flux_ports, nb_FS_ports, nb_FF_src_ports, nb_SS_flux_ports, nb_SS_src_ports)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout) :: me
    character(len=*), intent(in) :: name
    integer, intent(in) :: nb_state_vars
    integer, intent(in) :: nb_non_zeros_exp
    integer, intent(in) :: nb_non_zeros_imp
    integer, intent(in) :: nb_FF_flux_ports
    integer, intent(in) :: nb_FS_ports
    integer, intent(in) :: nb_FF_src_ports
    integer, intent(in) :: nb_SS_flux_ports
    integer, intent(in) :: nb_SS_src_ports

procedure, public :: add_label => krn_add_label

Add label of 2d mesh to expose ports

  • public subroutine krn_add_label(me, name_plus_label, nb_nodes_FS, nb_nodes_SS)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout) :: me
    character(len=*), intent(in) :: name_plus_label
    integer, intent(in), optional :: nb_nodes_FS
    integer, intent(in), optional :: nb_nodes_SS

procedure, public :: init_part2 => krn_init_part2

Allocating full matrices

  • public subroutine krn_init_part2(me)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout) :: me

procedure, public :: update => krn_update

Used by state owners to set ports locations and get back link to them

  • public subroutine krn_update(me, rhs_or_solution_view, FF_flux_p_loc, FS_p_loc, FF_src_p_loc, SS_flux_p_loc, SS_src_p_loc, CompName, FF_flux_p_view, FS_p_view, FF_src_p_view, SS_flux_p_view, SS_src_p_view)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout), target :: me
    real(kind=dp), intent(out), optional, pointer :: rhs_or_solution_view(:)

    Returns pointer with rhs or solution array

    integer, intent(in), optional :: FF_flux_p_loc(:)

    Position (state index) of the FF_flux ports local to the component

    integer, intent(in), optional :: FS_p_loc(:)

    Position (state index) of the FS ports local to the component

    integer, intent(in), optional :: FF_src_p_loc(:)

    Position (state index) of the FF_src ports local to the component

    integer, intent(in), optional :: SS_flux_p_loc(:)

    Position (state index) of the SS_flux ports local to the component

    integer, intent(in), optional :: SS_src_p_loc(:)

    Position (state index) of the SS_src ports local to the component

    character(len=*), intent(in), optional :: CompName
    type(FF_flux_port_t), intent(out), optional, pointer :: FF_flux_p_view(:)

    Returns pointer with array of FF_flux ports for this component

    type(FS_port_t), intent(out), optional, pointer :: FS_p_view(:)

    Returns pointer with array of FS ports for this component

    type(FF_src_port_t), intent(out), optional, pointer :: FF_src_p_view(:)

    Returns pointer with array of FF_src ports for this component

    type(SS_flux_port_t), intent(out), optional, pointer :: SS_flux_p_view(:)

    Returns pointer with array of SS_flux ports for this component

    type(SS_src_port_t), intent(out), optional, pointer :: SS_src_p_view(:)

    Returns pointer with array of SS_src ports for this component

procedure, public :: coo_add => krn_coo_add

Used by state owners to add coordinate format array to the full array

  • public subroutine krn_coo_add(me, for_explicit, col, row, val)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout), target :: me
    logical, intent(in) :: for_explicit

    if true add to explicit arrays otherwise to implicit

    integer, intent(in) :: col(:)

    relative indexes of the variables placed into global matrix

    integer, intent(in) :: row(:)

    relative indexes of the variables placed into global matrix

    type(dbl_pointer_t), intent(in) :: val(:)

    pointer to the value which should be placed into global matrix

procedure, public :: coo_add_link => krn_coo_add_link

Used by links to add coordinate format array to the full array

  • public subroutine krn_coo_add_link(me, port1, port2, col, row, val, val_out)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout) :: me
    class(port_t), intent(in) :: port1
    class(port_t), intent(in) :: port2
    integer, intent(in) :: col(:)

    relative indexes of the variables placed into global matrix

    integer, intent(in) :: row(:)

    relative indexes of the variables placed into global matrix

    type(dbl_pointer_t), intent(in) :: val(:)

    pointer to the value which should be placed into global matrix

    type(dbl_pointer_t), intent(out), optional :: val_out(:)

    in case of overlapping matrix

procedure, public :: coo_to_csr => krn_coo_to_csr

Conversion full coordinate format array to sparse compressed row array

  • public subroutine krn_coo_to_csr(me)

    Arguments

    Type IntentOptional Attributes Name
    class(krn_t), intent(inout) :: me

Source Code

    type krn_t
        !! Structure which will be used to size matrices like: coo,csr and ports 
        integer :: idx = 1
        integer, allocatable :: nb_state_vars(:)
        integer, allocatable :: nb_non_zeros_exp(:)
        integer, allocatable :: nb_non_zeros_imp(:)

        type(port_list_t) :: FF_flux_list, FF_src_list, FS_list, SS_flux_list, SS_src_list
        character(:), allocatable :: PortIdxForFSLink_List

        type(coo_csr_t(:)), allocatable :: imp      !! Implicit matrices in both format coo and csr
        type(coo_csr_t(:)), allocatable :: exp      !! Explicit matrices in both format coo and csr

        real(dp), allocatable :: rhs_or_solution(:) !! Right hand side of linear equation or it's solution
        real(dp), allocatable :: solution(:)        !! solution vector of the linear system
        type(FF_flux_port_t),    allocatable :: FF_flux_ports(:)      !! Fluid/Fluid port array --> flux
        type(FF_src_port_t),     allocatable :: FF_src_ports(:)       !! Fluid/Fluid port array --> source        
        type(FS_port_t),         allocatable :: FS_ports(:)           !! Fluid/Solid port array
        type(SS_flux_port_t),    allocatable :: SS_flux_ports(:)      !! Solid/Solid port array --> flux
        type(SS_src_port_t),     allocatable :: SS_src_ports(:)       !! Solid/Solid port array --> source
        ! TODO should be here also state space 3 vectors?

    contains
        procedure :: init_part1   => krn_init_part1   !! Allocating kernel arrays with number components
        procedure :: add          => krn_add          !! Used by all components add their array and port requirements 
        procedure :: add_label    => krn_add_label    !! Add label of 2d mesh to expose ports
        procedure :: init_part2   => krn_init_part2   !! Allocating full matrices
                
        procedure :: update       => krn_update       !! Used by state owners to set ports locations and get back link to them
        procedure :: coo_add      => krn_coo_add      !! Used by state owners to add coordinate format array to the full array
        procedure :: coo_add_link => krn_coo_add_link !! Used by links to add coordinate format array to the full array
        ! before it was also get function now is used by find index
        procedure :: coo_to_csr   => krn_coo_to_csr   !! Conversion full coordinate format array to sparse compressed row array
    end type krn_t