FFsrcLink_Prelax_resolution_from_and_to_ports Subroutine

public subroutine FFsrcLink_Prelax_resolution_from_and_to_ports(me)

Arguments

Type IntentOptional Attributes Name
type(FFsrcLink_t), intent(inout) :: me

Calls

proc~~ffsrclink_prelax_resolution_from_and_to_ports~~CallsGraph proc~ffsrclink_prelax_resolution_from_and_to_ports FFsrcLink_Prelax_resolution_from_and_to_ports proc~he_prop he_prop proc~ffsrclink_prelax_resolution_from_and_to_ports->proc~he_prop proc~state_rot state_roT proc~ffsrclink_prelax_resolution_from_and_to_ports->proc~state_rot proc~t_rop T_roP proc~ffsrclink_prelax_resolution_from_and_to_ports->proc~t_rop proc~jacobian_rot jacobian_roT proc~he_prop->proc~jacobian_rot proc~set_error set_error proc~he_prop->proc~set_error proc~state_rot->proc~jacobian_rot proc~brent brent proc~t_rop->proc~brent proc~fill_f_terms fill_f_terms proc~t_rop->proc~fill_f_terms proc~fill_g_dreg_terms fill_g_Dreg_terms proc~t_rop->proc~fill_g_dreg_terms proc~brent->proc~set_error f f proc~brent->f proc~zero zero proc~brent->proc~zero proc~eos_terms eos_terms proc~jacobian_rot->proc~eos_terms proc~eos_terms->proc~fill_f_terms proc~eos_e_terms eos_e_terms proc~eos_terms->proc~eos_e_terms proc~zero->f proc~fill_e_tpart fill_e_Tpart proc~eos_e_terms->proc~fill_e_tpart proc~fill_ff_terms fill_ff_terms proc~eos_e_terms->proc~fill_ff_terms proc~fill_e_tpart->proc~fill_g_dreg_terms

Called by

proc~~ffsrclink_prelax_resolution_from_and_to_ports~~CalledByGraph proc~ffsrclink_prelax_resolution_from_and_to_ports FFsrcLink_Prelax_resolution_from_and_to_ports proc~main_loop main_loop proc~main_loop->proc~ffsrclink_prelax_resolution_from_and_to_ports program~reims_p reims_p program~reims_p->proc~main_loop

Source Code

subroutine FFsrcLink_Prelax_resolution_from_and_to_ports(me)
    type(FFsrcLink_t), intent(inout) :: me

    real(dp), dimension(Nb_VarP,2) :: Pr
    real(dp), dimension(Nb_VarC,2) :: Cs
    real(dp), dimension(2) :: Kappak, rok, pk, rokstar, tkstar, rCorrkstar, ekstar, ckstar
    real(dp), dimension(2) :: ukstar, Vitk, Area
    real(dp) :: VitBar, hBar, pstar
    real(dp) :: ccv,ccp,mmu,llambda,dPdT_Ro,hk,Phik,T_temp
    integer :: k,i

    do i = 1, me%sizeNodes
      do k = 1, 2
        Pr(:,k)=me%lk(k,i)%p%Prim(:)
        Cs(:,k)=me%lk(k,i)%p%Cons(:)
        Area(k)=me%lk(k,i)%p%AreaP
      enddo

      if(Pr(Pri_p,1)>=Pr(Pri_p,2)) then
        VitBar=Pr(Pri_u,1)
        if(R_Correction) then
          hBar=Pr(Pri_R,1)/Pr(Pri_ro,1)
        else
          hBar=Pr(Pri_e,1)+Pr(Pri_p,1)/Pr(Pri_ro,1)
        endif
      else
        VitBar=Pr(Pri_u,2)
        if(R_Correction) then
          hBar=Pr(Pri_R,2)/Pr(Pri_ro,2)
        else
          hBar=Pr(Pri_e,2)+Pr(Pri_p,2)/Pr(Pri_ro,2)
        endif
      endif

      do k = 1, 2
        call he_prop(Pr(Pri_ro,k),Pr(Pri_T,k),ccv,ccp,mmu,llambda,dPdT_Ro)
        if (sim_error > 0) return
        rok(k)=Pr(Pri_ro,k)
        pk(k)=Pr(Pri_p,k)
        if(R_Correction) then
          hk=Pr(Pri_R,k)/Pr(Pri_ro,k)
        else
          hk=Pr(Pri_e,k)+Pr(Pri_p,k)/Pr(Pri_ro,k)
        endif
        Vitk(k)=Pr(Pri_u,k)
        Phik=1.0_dp/(Pr(Pri_ro,k)*(ccv/dPdT_Ro))
        Kappak(k)=Phik*((hBar-hk)+0.5_dp*((VitBar-Vitk(k))**2))/Area(k)+(Pr(Pri_c,k)**2)/Area(k)
      enddo  

      pstar=0.5_dp*(pk(1)+pk(2))+0.5_dp*(pk(1)-pk(2))*(Kappak(2)-Kappak(1))/(Kappak(1)+Kappak(2))

      do k = 1, 2
        rokstar(k)=rok(k)+(pstar-pk(k))/(Area(k)*Kappak(k))
        T_temp=T_roP(rokstar(k),pstar)
        tkstar(k)=T_temp
        call state_roT(rokstar(k), tkstar(k), rCorrkstar(k), Pstar, ekstar(k), ckstar(k))
        ukstar(k)=Vitk(k)+(VitBar-Vitk(k))*(rokstar(k)-rok(k))/rok(k)
  
        Pr(Pri_ro,k)=rokstar(k)
        Pr(Pri_u,k)=ukstar(k)
        Pr(Pri_p,k)=Pstar
        Pr(Pri_e,k)=ekstar(k)
        Pr(Pri_T,k)=tkstar(k)
        Pr(Pri_c,k)=ckstar(k)
        if(R_Correction) Pr(Pri_R,k)=rCorrkstar(k)
  
        Cs(Con_Mas,k)=rokstar(k)
        Cs(Con_Qdm,k)=rokstar(k)*ukstar(k)
        Cs(Con_Ene,k)=rokstar(k)*(ekstar(k)+0.5_dp*(ukstar(k)**2))
        if(R_Correction) Cs(Con_R,k)=rCorrkstar(k)
  
        me%lk(k,i)%p%Prim(:)=Pr(:,k)
        me%lk(k,i)%p%Cons(:)=Cs(:,k)
      enddo
    enddo

end subroutine FFsrcLink_Prelax_resolution_from_and_to_ports