strand_init_part2 Subroutine

public subroutine strand_init_part2(me, krn, cfg)

Fluid port initialisation for strands

Arguments

Type IntentOptional Attributes Name
type(strand_t), intent(inout), target :: me
type(krn_t), intent(inout) :: krn
class(input_t), intent(in), pointer :: cfg

Calls

proc~~strand_init_part2~~CallsGraph proc~strand_init_part2 strand_init_part2 proc~input_str input_t%input_str proc~strand_init_part2->proc~input_str proc~krn_coo_add krn_t%krn_coo_add proc~strand_init_part2->proc~krn_coo_add proc~krn_update krn_t%krn_update proc~strand_init_part2->proc~krn_update proc~input_has_key input_t%input_has_key proc~input_str->proc~input_has_key proc~input_node input_t%input_node proc~input_str->proc~input_node proc~select_scalar select_scalar proc~input_str->proc~select_scalar interface~to_str to_str proc~krn_update->interface~to_str proc~port_list_update port_list_t%port_list_update proc~krn_update->proc~port_list_update proc~str_from_int str_from_int interface~to_str->proc~str_from_int proc~str_from_real str_from_real interface~to_str->proc~str_from_real get get proc~input_has_key->get proc~select_dict select_dict proc~input_has_key->proc~select_dict proc~input_node->get proc~dictionary_traverse dictionary_traverse proc~input_node->proc~dictionary_traverse proc~input_node->proc~select_dict proc~dictionary_traverse->proc~dictionary_traverse get_dictionary get_dictionary proc~dictionary_traverse->get_dictionary proc~abort_if abort_if proc~dictionary_traverse->proc~abort_if

Called by

proc~~strand_init_part2~~CalledByGraph proc~strand_init_part2 strand_init_part2 program~reims_p reims_p program~reims_p->proc~strand_init_part2

Source Code

subroutine strand_init_part2(me, krn, cfg)
    !! Fluid port initialisation for strands
    type(strand_t), target, intent(inout) :: me
    type(krn_t),          intent(inout) :: krn
    class(input_t), pointer, intent(in) :: cfg  

    integer :: NbSubM,i,idx,PrevRowIdx,PrevColIdx
    real(dp), pointer :: rhs(:)
    integer, allocatable :: list_thp_loc(:)
    type(FS_port_t), pointer :: FS_ports(:)
    type(SS_flux_port_t), pointer :: SS_flux_ports(:)

    ! SS_flux ports --> always 2 ports implemented
    call krn%update(rhs_or_solution_view=rhs,SS_flux_p_loc=[1,me%SC_Prop%NbCells],SS_flux_p_view=SS_flux_ports)
    me%SC_Prop%in  => SS_flux_ports(1)
    me%SC_Prop%out => SS_flux_ports(2)
    me%SC_Prop%in%AreaS   = sum(me%ct(:)%area)
    me%SC_Prop%in%rhoMS   = me%ro_M
    me%SC_Prop%in%Sgn4lk  = -1.0_dp   
    me%SC_Prop%in%dxLoc   = me%SC_Prop%dxLoc(1)
    me%SC_Prop%in%Flx           = 0.0_dp
    me%SC_Prop%in%derFlx_derCon = 0.0_dp
    me%SC_Prop%out%AreaS  = sum(me%ct(:)%area) 
    me%SC_Prop%out%rhoMS  = me%ro_M
    me%SC_Prop%out%Sgn4lk = 1.0_dp    
    me%SC_Prop%out%dxLoc  = me%SC_Prop%dxLoc(me%SC_Prop%NbCells)
    me%SC_Prop%out%Flx           = 0.0_dp
    me%SC_Prop%out%derFlx_derCon = 0.0_dp      
    
    me%big%bvS(1:me%SC_Prop%NbCells) => rhs

    if(me%SC_Prop%FSlink) then
      allocate(list_thp_loc(me%SC_Prop%NbCells),me%SC_Prop%thermP(me%SC_Prop%NbCells))
      list_thp_loc=[(i,i=1,me%SC_Prop%NbCells)]
      call krn%update(FS_p_loc=list_thp_loc,CompName=cfg%str('id'),FS_p_view=FS_ports)
      do i=1,me%SC_Prop%NbCells
          me%SC_Prop%thermP(i)%p => FS_ports(i)
          me%SC_Prop%thermP(i)%p%typeS = 'strand'
          me%SC_Prop%thermP(i)%p%AreaS = sum(me%ct(:)%area)
          me%SC_Prop%thermP(i)%p%rhoMS = me%ro_M
      enddo
    endif

    NbSubM=me%SC_Prop%NbCells
    allocate(me%bigLS%ValExp(NbSubM),me%bigLS%RowExp(NbSubM),me%bigLS%ColExp(NbSubM))

    NbSubM=2*2+(me%SC_Prop%NbCells-2)*3
    allocate(me%bigLS%ValImp(NbSubM),me%bigLS%RowImp(NbSubM),me%bigLS%ColImp(NbSubM))

    idx=1

    PrevColIdx=0
    PrevRowIdx=0
    do i=1,me%SC_Prop%NbCells
        me%bigLS%ValExp(idx)%p => me%big%bmS(i)
        me%bigLS%ColExp(idx)=PrevColIdx+1
        me%bigLS%RowExp(idx)=PrevRowIdx+1

        me%bigLS%ValImp(idx)%p => me%big%bmS(i)
        me%bigLS%ColImp(idx)=PrevColIdx+1
        me%bigLS%RowImp(idx)=PrevRowIdx+1

        idx=idx+1
        PrevColIdx=PrevColIdx+1
        PrevRowIdx=PrevRowIdx+1
    enddo
    call krn%coo_add(.true.,me%bigLS%ColExp,me%bigLS%RowExp,me%bigLS%ValExp)

    PrevColIdx=1
    PrevRowIdx=0
    do i=1,me%SC_Prop%NbCells-1
        me%bigLS%ValImp(idx)%p => me%big%cmS(i)
        me%bigLS%ColImp(idx)=PrevColIdx+1
        me%bigLS%RowImp(idx)=PrevRowIdx+1          
        
        idx=idx+1
        PrevColIdx=PrevColIdx+1
        PrevRowIdx=PrevRowIdx+1      
    enddo
    PrevColIdx=0
    PrevRowIdx=1
    do i=1,me%SC_Prop%NbCells-1
        me%bigLS%ValImp(idx)%p => me%big%amS(i)
        me%bigLS%ColImp(idx)=PrevColIdx+1
        me%bigLS%RowImp(idx)=PrevRowIdx+1 
        
        idx=idx+1
        PrevColIdx=PrevColIdx+1
        PrevRowIdx=PrevRowIdx+1
    enddo
    call krn%coo_add(.false.,me%bigLS%ColImp,me%bigLS%RowImp,me%bigLS%ValImp)

    deallocate(me%bigLS%ValExp,me%bigLS%RowExp,me%bigLS%ColExp)
    deallocate(me%bigLS%ValImp,me%bigLS%RowImp,me%bigLS%ColImp)

end subroutine strand_init_part2