solid_init_part2 Subroutine

public subroutine solid_init_part2(me, krn, cfg)

Fluid port initialisation for solids

Arguments

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

Calls

proc~~solid_init_part2~~CallsGraph proc~solid_init_part2 solid_init_part2 proc~input_str input_t%input_str proc~solid_init_part2->proc~input_str proc~krn_coo_add krn_t%krn_coo_add proc~solid_init_part2->proc~krn_coo_add proc~krn_update krn_t%krn_update proc~solid_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~~solid_init_part2~~CalledByGraph proc~solid_init_part2 solid_init_part2 program~reims_p reims_p program~reims_p->proc~solid_init_part2

Source Code

subroutine solid_init_part2(me, krn, cfg)
    !! Fluid port initialisation for solids
    type(solid_t), target, intent(inout) :: me
    type(krn_t),          intent(inout) :: krn
    class(input_t), pointer, intent(in) :: cfg  

    integer :: NbSubM,i,idx,PrevRowIdx,PrevColIdx,j
    real(dp), pointer :: rhs(:)
    integer, allocatable :: list_thp_loc(:),list_thS_loc(:)
    type(FS_port_t), pointer :: FS_ports(:)
    type(SS_src_port_t), pointer :: SS_src_ports(:)

    call krn%update(rhs_or_solution_view=rhs)
    me%big%bvS(1:me%MC_Prop%NbCells) => rhs

    if(me%MC_Prop%nb_FS_ports>0) then
      allocate(list_thp_loc(me%MC_Prop%nb_FS_ports),me%MC_Prop%thermP(me%MC_Prop%nb_FS_ports))

      list_thp_loc = pack([(i, i=1, me%MC_Prop%NbCells)], me%MC_Prop%FSlink)
      call krn%update(FS_p_loc=list_thp_loc,CompName=cfg%str('id'),FS_p_view=FS_ports)
      
      j=1
      do i=1,me%MC_Prop%NbCells
          if(me%MC_Prop%FSlink(i)) then
              me%MC_Prop%idxFSlk(i)=j
              me%MC_Prop%thermP(j)%p => FS_ports(j)
              me%MC_Prop%thermP(j)%p%typeS   = 'solid'
              me%MC_Prop%thermP(j)%p%rhoMS   = me%mat%density
              me%MC_Prop%thermP(j)%p%VolMS   = me%MC_Prop%volLoc(i)
              j=j+1
          endif
      enddo
    endif

    if(me%MC_Prop%SSsrcLink) then
      allocate(list_thS_loc(me%MC_Prop%NbCells),me%MC_Prop%thermS(me%MC_Prop%NbCells))
      list_thS_loc=[(i,i=1,me%MC_Prop%NbCells)]
      call krn%update(SS_src_p_loc=list_thS_loc,SS_src_p_view=SS_src_ports)
      do i=1,me%MC_Prop%NbCells
          me%MC_Prop%thermS(i)%p => SS_src_ports(i)
          me%MC_Prop%thermS(i)%p%typeS   = 'solid'
          me%MC_Prop%thermS(i)%p%rhoS    = me%mat%density
          me%MC_Prop%thermS(i)%p%VolS    = me%MC_Prop%volLoc(i)
          me%MC_Prop%thermS(i)%p%Height  = me%MC_Prop%dxLoc(i)
      enddo
    endif    

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

    if(me%MC_Prop%cond_btw_nodes) then
        NbSubM=2*2+(me%MC_Prop%NbCells-2)*3
    else
        NbSubM=me%MC_Prop%NbCells
    endif
    allocate(me%bigLS%ValImp(NbSubM),me%bigLS%RowImp(NbSubM),me%bigLS%ColImp(NbSubM))

    idx=1

    PrevColIdx=0
    PrevRowIdx=0
    do i=1,me%MC_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)

    if(me%MC_Prop%cond_btw_nodes) then
        PrevColIdx=1
        PrevRowIdx=0
        do i=1,me%MC_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%MC_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
    endif
    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 solid_init_part2