mdot_derivatives Subroutine

public subroutine mdot_derivatives(me, deriv_wr_both_br)

Arguments

Type IntentOptional Attributes Name
type(circulator_t), intent(inout) :: me
type(derivatives_involving_both_branches_t), intent(out) :: deriv_wr_both_br

Calls

proc~~mdot_derivatives~~CallsGraph proc~mdot_derivatives mdot_derivatives proc~jacobian_rot jacobian_roT proc~mdot_derivatives->proc~jacobian_rot proc~eos_terms eos_terms proc~jacobian_rot->proc~eos_terms proc~eos_e_terms eos_e_terms proc~eos_terms->proc~eos_e_terms proc~fill_f_terms fill_f_terms proc~eos_terms->proc~fill_f_terms 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_g_dreg_terms fill_g_Dreg_terms proc~fill_e_tpart->proc~fill_g_dreg_terms

Called by

proc~~mdot_derivatives~~CalledByGraph proc~mdot_derivatives mdot_derivatives proc~circulator_resolution_from_and_to_ports circulator_resolution_from_and_to_ports proc~circulator_resolution_from_and_to_ports->proc~mdot_derivatives proc~main_loop main_loop proc~main_loop->proc~circulator_resolution_from_and_to_ports program~reims_p reims_p program~reims_p->proc~main_loop

Source Code

subroutine mdot_derivatives(me,deriv_wr_both_br)
    type(circulator_t), intent(inout) :: me
    type(derivatives_involving_both_branches_t), intent(out) :: deriv_wr_both_br

    real(dp) :: dPres,dMdotdPin,dMdotdPout
    real(dp), dimension(Nb_VarC) :: dPindUin,dPoutdUout
    real(dp) :: kk, KKK, dedT, dPdT, HH, dPde

    if(me%SubType=="pump") then
        deriv_wr_both_br%DerMdotDerUin(:)=0.0_dp
        deriv_wr_both_br%DerMdotDerUout(:)=0.0_dp
    else if(me%SubType=="compressor") then
        dPres=me%br(2)%p%Prim(Pri_P)-me%br(1)%p%Prim(Pri_P)

        if(dPres<=0.0_dp) then
            deriv_wr_both_br%DerMdotDerUin(:)=0.0_dp
            deriv_wr_both_br%DerMdotDerUout(:)=0.0_dp
        else if(dPres>=me%dp0) then
            deriv_wr_both_br%DerMdotDerUin(:)=0.0_dp
            deriv_wr_both_br%DerMdotDerUout(:)=0.0_dp
        else
            dMdotdPin=2.0_dp*me%mdot0*dPres/(me%dp0**2)
            dMdotdPout=-2.0_dp*me%mdot0*dPres/(me%dp0**2)

            if(R_Correction) then
                dPindUin(1)=-0.5_dp*(me%br(1)%p%Cons(Con_Qdm)**2)/(me%br(1)%p%Cons(Con_Mas)**2)
                dPindUin(2)=me%br(1)%p%Cons(Con_Qdm)/me%br(1)%p%Cons(Con_Mas)
                dPindUin(3)=-1.0_dp
                dPindUin(4)=1.0_dp
                
                dPoutdUout(1)=-0.5_dp*(me%br(2)%p%Cons(Con_Qdm)**2)/(me%br(2)%p%Cons(Con_Mas)**2)
                dPoutdUout(2)=me%br(2)%p%Cons(Con_Qdm)/me%br(2)%p%Cons(Con_Mas)
                dPoutdUout(3)=-1.0_dp
                dPoutdUout(4)=1.0_dp         
            else
                HH=me%br(1)%p%Prim(Pri_e)+me%br(1)%p%Prim(Pri_P)/me%br(1)%p%Prim(Pri_ro)+0.5_dp*me%br(1)%p%Prim(Pri_u)**2
                call jacobian_roT(me%br(1)%p%Prim(Pri_ro), me%br(1)%p%Prim(Pri_T), dedT, dPdT)
                dPde=dPdT/dedT
                kk=dPde/me%br(1)%p%Prim(Pri_ro)
                KKK=me%br(1)%p%Prim(Pri_c)**2+kk*(me%br(1)%p%Prim(Pri_u)**2-HH)
                dPindUin(1)=KKK
                dPindUin(2)=-kk*me%br(1)%p%Prim(Pri_u)
                dPindUin(3)=kk
                dPindUin(4)=0.0_dp
                
                HH=me%br(2)%p%Prim(Pri_e)+me%br(2)%p%Prim(Pri_P)/me%br(2)%p%Prim(Pri_ro)+0.5_dp*me%br(2)%p%Prim(Pri_u)**2
                call jacobian_roT(me%br(2)%p%Prim(Pri_ro), me%br(2)%p%Prim(Pri_T), dedT, dPdT)
                dPde=dPdT/dedT
                kk=dPde/me%br(2)%p%Prim(Pri_ro)
                KKK=me%br(2)%p%Prim(Pri_c)**2+kk*(me%br(2)%p%Prim(Pri_u)**2-HH)
                dPoutdUout(1)=KKK
                dPoutdUout(2)=-kk*me%br(2)%p%Prim(Pri_u)
                dPoutdUout(3)=kk
                dPoutdUout(4)=0.0_dp 
            endif
            deriv_wr_both_br%DerMdotDerUin(:)=dMdotdPin*dPindUin(:)
            deriv_wr_both_br%DerMdotDerUout(:)=dMdotdPout*dPoutdUout(:)
        endif
    endif
end subroutine mdot_derivatives