Пример #1
0
    def _Superheat_Forward(self, w_superheat):
        self.w_superheat = w_superheat
        DWS = DWSVals()  #DryWetSegment structure
        AS = self.AS  #AbstractState

        # Store temporary values to be passed to DryWetSegment
        DWS.A_a = self.Fins.A_a * w_superheat
        DWS.cp_da = self.Fins.cp_da
        DWS.eta_a = self.Fins.eta_a
        DWS.h_a = self.Fins.h_a * self.h_a_tuning  #Heat transfer coefficient
        DWS.mdot_da = self.mdot_da * w_superheat
        DWS.pin_a = self.Fins.Air.p
        DWS.Fins = self.Fins
        DWS.FinsType = self.FinsType

        # Inputs on the air side to two phase region are inlet air again
        DWS.Tin_a = self.Tin_a
        DWS.RHin_a = self.Fins.Air.RH

        DWS.Tin_r = self.Tdew_r
        DWS.A_r = self.A_r_wetted * w_superheat
        DWS.Rw = self.Rw / w_superheat
        AS.update(CP.PT_INPUTS, self.psat_r, self.Tdew_r + 2.5)
        DWS.cp_r = AS.cpmass(
        )  #Use a guess value of 6K superheat to calculate cp [J/kg-K]
        DWS.pin_r = self.psat_r
        DWS.mdot_r = self.mdot_r
        DWS.IsTwoPhase = False

        #Use a guess value of 6K superheat to calculate the properties
        self.f_r_superheat, self.h_r_superheat, self.Re_r_superheat = f_h_1phase_Tube(
            self.mdot_r / self.Ncircuits, self.ID, self.Tdew_r + 3,
            self.psat_r, self.AS, "Single")

        # Average Refrigerant heat transfer coefficient
        DWS.h_r = self.h_r_superheat

        #Run DryWetSegment
        DryWetSegment(DWS)

        AS.update(CP.PT_INPUTS, self.psat_r, (DWS.Tout_r + self.Tdew_r) / 2.0)
        rho_superheat = AS.rhomass()  #[kg/m^3]
        self.Charge_superheat = w_superheat * self.V_r * rho_superheat

        #Pressure drop calculations for superheated refrigerant
        v_r = 1 / rho_superheat
        #Pressure gradient using Darcy friction factor
        dpdz_r = -self.f_r_superheat * v_r * self.G_r**2 / (
            2 * self.ID)  #Pressure gradient
        self.DP_r_superheat = dpdz_r * self.Lcircuit * self.w_superheat

        #Set values
        self.Q_superheat = DWS.Q
        self.Q_sensible_superheat = DWS.Q_sensible
        self.fdry_superheat = DWS.f_dry
        self.Tout_a_superheat = DWS.Tout_a
        self.Tout_r = DWS.Tout_r
Пример #2
0
 def Calculate(self):
     """
     This function is now simply a wrapper around the DryWetSegment() 
     function in order to decrease the amount of code replication
     """
     #Initialize
     self.Initialize()
     AS_g = self.AS_g
     
     DWS=DWSVals() #DryWetSegment structure
 
     # Store temporary values to be passed to DryWetSegment
     DWS.A_a=self.Fins.A_a
     DWS.cp_da=self.Fins.cp_da
     DWS.eta_a=self.Fins.eta_a
     DWS.h_a=self.Fins.h_a*self.h_a_tuning  #Heat transfer coefficient
     DWS.mdot_da=self.Fins.mdot_da
     DWS.pin_a=self.Fins.Air.p
     DWS.Tin_a=self.Tin_a
     DWS.RHin_a=self.Fins.Air.RH
     DWS.Fins=self.Fins
     DWS.FinsType=self.FinsType              #Added to pass FinsType to DryWetSegment
 
     DWS.Tin_r=self.Tin_g
     DWS.A_r=self.A_g_wetted
     DWS.Rw=self.Rw
     
     AS_g.update(CP.PT_INPUTS, self.pin_g, (self.Tin_g+DWS.Tin_a)/2.0)
     DWS.cp_r=AS_g.cpmass() #[J/kg-K]
     DWS.pin_r=self.pin_g
     DWS.mdot_r=self.mdot_g
     DWS.IsTwoPhase=False
     
     #Use a guess value of 6K superheat to calculate the properties
     self.f_g, self.h_g, self.Re_g=f_h_1phase_Tube(self.mdot_g / self.Ncircuits, self.ID, 
         (self.Tin_g+DWS.Tin_a)/2.0, self.pin_g, self.AS_g, "Single");
     
     # Average Refrigerant heat transfer coefficient
     DWS.h_r=self.h_g*self.h_g_tuning
     
     #Run DryWetSegment
     DryWetSegment(DWS)
     
     #Average mass flux of glycol in circuit
     self.G_g = self.mdot_g/(self.Ncircuits*pi*self.ID**2/4.0) #[kg/m^2-s]
 
     #Pressure drop calculations for glycol (water)
     Dh_g=self.ID
     AS_g.update(CP.PT_INPUTS, self.pin_g, self.Tin_g)
     v_g=1/AS_g.rhomass() #[m^3/kg]
     #Pressure gradient using Darcy friction factor
     dp_dz_g=-self.f_g*v_g*self.G_g**2/(2*Dh_g)
     DP_g=dp_dz_g*self.Lcircuit
 
     self.f_dry=DWS.f_dry
     self.DP_g=DP_g*self.DP_tuning
     self.Q=DWS.Q
     self.Tout_g=DWS.Tout_r
     self.Tout_a=DWS.Tout_a
     self.hout_a=DWS.hout_a
     self.hin_a=DWS.hin_a
     self.SHR=self.Fins.cp_da*(DWS.Tout_a-DWS.Tin_a)/(DWS.hout_a-DWS.hin_a)
     self.Capacity=DWS.Q-self.Fins.Air.FanPower
Пример #3
0
    def _Subcool_Forward(self, w_subcool):
        # **********************************************************************
        #                      SUPERCRITICAL_LIQUID PART
        # **********************************************************************
        self.w_subcool = w_subcool

        if self.w_subcool < 0:
            raise ValueError(
                'w_subcool in Gas cooler cannot be less than zero')

        #AbstractState
        AS = self.AS

        DWS = DWSVals()  #DryWetSegment structure

        # Store temporary values to be passed to DryWetSegment
        DWS.A_a = self.Fins.A_a * w_subcool
        DWS.cp_da = self.Fins.cp_da
        DWS.eta_a = self.Fins.eta_a
        DWS.h_a = self.Fins.h_a  #Heat transfer coefficient
        DWS.mdot_da = self.mdot_da * w_subcool
        DWS.pin_a = self.Fins.Air.p
        DWS.Fins = self.Fins
        DWS.FinsType = self.FinsType

        # Inputs on the air side to two phase region are inlet air again
        DWS.Tin_a = self.Tin_a
        DWS.RHin_a = self.Fins.Air.RH

        DWS.Tin_r = self.Tcr
        DWS.A_r = self.A_r_wetted * w_subcool

        AS.update(CP.PT_INPUTS, self.psat_r, self.Tcr - 1)
        DWS.cp_r = AS.cpmass()  #[J/kg-K]

        DWS.pin_r = self.psat_r
        DWS.mdot_r = self.mdot_r
        DWS.IsTwoPhase = False

        # Friction factor and HTC in the refrigerant portions.
        # Average fluid temps are used for the calculation of properties
        # Average temp of refrigerant is average of sat. temp and outlet temp
        # Secondary fluid is air over the fins
        self.f_r_subcool, self.h_r_subcool, self.Re_r_subcool = f_h_1phase_Tube(
            self.mdot_r / self.Ncircuits, self.ID, self.Tcr - 1.0, self.psat_r,
            self.AS, "Single")

        # Average Refrigerant heat transfer coefficient
        DWS.h_r = self.h_r_subcool

        #Run DryWetSegment
        DryWetSegment(DWS)

        AS.update(CP.PT_INPUTS, self.psat_r, (self.Tcr + DWS.Tout_r) / 2)
        rho_subcool = AS.rhomass()  #[kg/m^3]
        self.Charge_subcool = self.w_subcool * self.V_r * rho_subcool

        #Pressure drop calculations for subcooled refrigerant
        v_r = 1 / rho_subcool
        #Pressure gradient using Darcy friction factor
        dpdz_r = -self.f_r_subcool * v_r * self.G_r**2 / (2 * self.ID
                                                          )  #Pressure gradient
        self.DP_r_subcool = dpdz_r * self.Lcircuit * self.w_subcool

        # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant.
        # Heat is removed here from the refrigerant since it is condensing
        self.Q_subcool = DWS.Q
        self.fdry_subcool = DWS.f_dry
        self.Tout_a_subcool = DWS.Tout_a
        self.Tout_r = DWS.Tout_r
Пример #4
0
    def _Supercritical_Forward(self, w_supercritical):
        # **********************************************************************
        #                      SUPERCRITICAL PART
        # **********************************************************************

        #AbstractState
        AS = self.AS

        DWS = DWSVals(
        )  #DryWetSegment structure (only dry-analysis, single phase is used)

        # Store temporary values to be passed to DryWetSegment
        DWS.Fins = self.Fins
        DWS.FinsType = self.FinsType
        DWS.A_a = self.Fins.A_a * w_supercritical
        DWS.cp_da = self.Fins.cp_da
        DWS.eta_a = self.Fins.eta_a
        DWS.h_a = self.Fins.h_a  #Heat transfer coefficient, not enthalpy
        DWS.mdot_da = self.mdot_da * w_supercritical
        DWS.pin_a = self.Fins.Air.p

        DWS.Tin_a = self.Tin_a
        DWS.RHin_a = self.Fins.Air.RH

        DWS.Tin_r = self.Tin_r
        DWS.A_r = self.A_r_wetted * w_supercritical
        DWS.pin_r = self.psat_r
        DWS.mdot_r = self.mdot_r
        DWS.IsTwoPhase = False

        AS.update(CP.PT_INPUTS, self.psat_r, self.Tout_r_cr)
        hout = AS.hmass()  #[J/kg]
        #Target heat transfer to go from inlet temperature to iterative outlet temperature
        Q_target = self.mdot_r * (hout - self.hin_r)

        if Q_target > 0:
            raise ValueError('Q_target in Gas cooler must be negative')

        # This block calculates the average refrigerant heat transfer coefficient, average friction factor, average specific heat, and average density
        DWS.h_r, f_r_supercritical, DWS.cp_r, rho_supercritical = Petterson_supercritical_average(
            self.Tout_r_cr, self.Tin_r, self.T_w, self.AS, self.G_r, self.ID,
            0, self.ID / self.Lcircuit, self.mdot_r / self.Ncircuits,
            self.psat_r, -Q_target / DWS.A_r)

        #Compute Fins Efficiency based on FinsType
        DryWetSegment(DWS)

        self.T_w = DWS.Twall_s  #inner surface wall temperature (refrigerant)
        self.Q_supercritical = DWS.Q
        self.h_r_supercritical = DWS.h_r
        self.fdry_supercritical = DWS.f_dry
        self.Tout_a_supercritical = DWS.Tout_a

        #Pressure drop calculations for supercritical refrigerant
        v_r = 1. / rho_supercritical
        #Pressure gradient using Darcy friction factor
        dpdz_r = -f_r_supercritical * v_r * self.G_r**2 / (
            2 * self.ID)  #Pressure gradient
        self.DP_r_supercritical = dpdz_r * self.Lcircuit * w_supercritical
        #charge for the supercritical portion
        self.Charge_supercritical = w_supercritical * self.V_r * rho_supercritical

        if self.Verbosity > 7:
            print(w_supercritical, DWS.Q, Q_target,
                  "w_supercritical,DWS.Q,Q_target")

        return DWS.Q - Q_target
Пример #5
0
    def _Supercrit_liq_Forward(self, w_supercrit_liq):
        # **********************************************************************
        #                      SUPERCRITICAL_LIQUID PART
        # **********************************************************************
        self.w_supercrit_liq = w_supercrit_liq

        if self.w_supercrit_liq < 0:
            raise ValueError(
                'w_supercrit_liq in Gas cooler cannot be less than zero')

        #AbstractState
        AS = self.AS

        DWS = DWSVals()  #DryWetSegment structure

        # Store temporary values to be passed to DryWetSegment
        DWS.A_a = self.Fins.A_a * w_supercrit_liq
        DWS.cp_da = self.Fins.cp_da
        DWS.eta_a = self.Fins.eta_a
        DWS.h_a = self.Fins.h_a * self.h_a_tuning  #Heat transfer coefficient
        DWS.mdot_da = self.mdot_da * w_supercrit_liq
        DWS.pin_a = self.Fins.Air.p
        DWS.Fins = self.Fins
        DWS.FinsType = self.FinsType

        # Inputs on the air side to two phase region are inlet air again
        DWS.Tin_a = self.Tin_a
        DWS.RHin_a = self.Fins.Air.RH

        DWS.Tin_r = self.Tcr
        DWS.A_r = self.A_r_wetted * w_supercrit_liq
        DWS.Rw = self.Rw / w_supercrit_liq

        AS.update(CP.PT_INPUTS, self.psat_r, self.Tcr - 1)
        DWS.cp_r = AS.cpmass()  #[J/kg-K]

        DWS.pin_r = self.psat_r
        DWS.mdot_r = self.mdot_r
        DWS.IsTwoPhase = False

        #         # Friction factor and HTC in the refrigerant portions.
        #         # Average fluid temps are used for the calculation of properties
        #         # Average temp of refrigerant is average of sat. temp and outlet temp
        #         # Secondary fluid is air over the fins
        #         self.f_r_supercrit_liq, self.h_r_supercrit_liq, self.Re_r_supercrit_liq=f_h_1phase_Tube(
        #           self.mdot_r / self.Ncircuits, self.ID, self.Tcr-1.0, self.psat_r, self.AS,
        #           "Single")
        #
        #         # Average Refrigerant heat transfer coefficient
        #         DWS.h_r=self.h_r_supercrit_liq*self.h_r_tuning
        #
        #         #Run DryWetSegment
        #         DryWetSegment(DWS)
        #
        #         AS.update(CP.PT_INPUTS, self.psat_r, (self.Tcr + DWS.Tout_r) / 2)
        #         rho_supercrit_liq=AS.rhomass() #[kg/m^3]
        #         self.Charge_supercrit_liq = self.w_supercrit_liq * self.V_r * rho_supercrit_liq
        #
        #         #Pressure drop calculations for supercrit_liqed refrigerant
        #         v_r=1/rho_supercrit_liq
        #         #Pressure gradient using Darcy friction factor
        #         dpdz_r=-self.f_r_supercrit_liq*v_r*self.G_r**2/(2*self.ID)  #Pressure gradient
        #         self.DP_r_supercrit_liq=dpdz_r*self.Lcircuit*self.w_supercrit_liq
        #
        #         # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant.
        #         # Heat is removed here from the refrigerant since it is condensing
        #         self.Q_supercrit_liq=DWS.Q
        #         self.fdry_supercrit_liq=DWS.f_dry
        #         self.Tout_a_supercrit_liq=DWS.Tout_a
        #         self.Tout_r=DWS.Tout_r

        AS.update(CP.PT_INPUTS, self.psat_r, self.Tout_r_sc)
        hout = AS.hmass()  #[J/kg]
        #Target heat transfer to go from inlet temperature (critical) to iterative outlet temperature
        Q_target = self.mdot_r * (hout - self.hcr)

        if Q_target > 0:
            raise ValueError('Q_target in Gas cooler must be negative')

        # Friction factor and HTC in the refrigerant portions.
        # Average fluid temps are used for the calculation of properties
        # Average temp of refrigerant is average of sat. temp and outlet temp
        # Secondary fluid is air over the fins
        h_r, self.f_r_supercrit_liq, DWS.cp_r, rho_supercrit_liq = Petterson_supercritical_average(
            self.Tout_r_sc, self.Tcr, self.T_w, self.AS, self.G_r, self.ID, 0,
            self.ID / self.Lcircuit, self.mdot_r / self.Ncircuits, self.psat_r,
            -Q_target / DWS.A_r)
        DWS.h_r = h_r * self.h_r_tuning  #Correct refrigerant HTC with tuning factor

        #Run DryWetSegment
        DryWetSegment(DWS)

        # Positive Q is heat input to the refrigerant, negative Q is heat output from refrigerant.
        # Heat is removed here from the refrigerant since it is condensing
        self.T_w = DWS.Twall_s  #inner surface wall temperature (refrigerant)
        self.Q_supercrit_liq = DWS.Q
        self.h_r_supercrit_liq = DWS.h_r
        self.fdry_supercrit_liq = DWS.f_dry
        self.Tout_a_supercrit_liq = DWS.Tout_a
        self.Tout_r = DWS.Tout_r

        self.Charge_supercrit_liq = self.w_supercrit_liq * self.V_r * rho_supercrit_liq

        #Pressure drop calculations for supercrit_liqed refrigerant
        v_r = 1 / rho_supercrit_liq
        #Pressure gradient using Darcy friction factor
        dpdz_r = -self.f_r_supercrit_liq * v_r * self.G_r**2 / (
            2 * self.ID)  #Pressure gradient
        self.DP_r_supercrit_liq = dpdz_r * self.Lcircuit * self.w_supercrit_liq

        return Q_target - DWS.Q
Пример #6
0
    def _TwoPhase_Forward(self, w_2phase):

        DWS = DWSVals()  #DryWetSegment structure

        # Store temporary values to be passed to DryWetSegment
        DWS.Fins = self.Fins
        DWS.FinsType = self.FinsType
        DWS.A_a = self.Fins.A_a * w_2phase
        DWS.cp_da = self.Fins.cp_da
        DWS.eta_a = self.Fins.eta_a
        DWS.h_a = self.Fins.h_a * self.h_a_tuning  #Heat transfer coefficient, not enthalpy
        DWS.mdot_da = self.mdot_da * w_2phase
        DWS.pin_a = self.Fins.Air.p
        DWS.Tdew_r = self.Tdew_r
        DWS.Tbubble_r = self.Tbubble_r

        DWS.Tin_a = self.Tin_a
        DWS.RHin_a = self.Fins.Air.RH

        DWS.Tin_r = self.Tsat_r
        DWS.A_r = self.A_r_wetted * w_2phase
        DWS.Rw = self.Rw / w_2phase
        DWS.cp_r = 1.0e15  #In the two-phase region the cp is infinite, use 1e15 as a big number;
        DWS.pin_r = self.psat_r
        DWS.mdot_r = self.mdot_r
        DWS.IsTwoPhase = True

        #Target heat transfer to go from inlet quality to saturated vapor
        Q_target = self.mdot_r * (self.xout_2phase - self.xin_r) * self.h_fg

        if Q_target < 0:
            raise ValueError('Q_target in Evaporator must be positive')

        # Average Refrigerant heat transfer coefficient
        try:
            if self.AS.name() in 'CarbonDioxide':
                h_r = KandlikarEvaporation_average(self.xin_r,
                                                   self.xout_2phase, self.AS,
                                                   self.G_r, self.ID,
                                                   self.psat_r,
                                                   Q_target / DWS.A_r,
                                                   self.Tbubble_r, self.Tdew_r)
            else:
                h_r = ShahEvaporation_Average(self.xin_r, self.xout_2phase,
                                              self.AS, self.G_r, self.ID,
                                              self.psat_r, Q_target / DWS.A_r,
                                              self.Tbubble_r, self.Tdew_r)
        except:
            h_r = ShahEvaporation_Average(self.xin_r, self.xout_2phase,
                                          self.AS, self.G_r, self.ID,
                                          self.psat_r, Q_target / DWS.A_r,
                                          self.Tbubble_r, self.Tdew_r)

        DWS.h_r = h_r * self.h_tp_tuning  #correct refrigerant side convection heat transfer

        #Run the DryWetSegment to carry out the heat and mass transfer analysis
        DryWetSegment(DWS)

        self.Q_2phase = DWS.Q
        self.Q_sensible_2phase = DWS.Q_sensible
        self.h_r_2phase = DWS.h_r
        self.fdry_2phase = DWS.f_dry
        self.Tout_a_2phase = DWS.Tout_a

        rho_average = TwoPhaseDensity(self.AS,
                                      self.xin_r,
                                      self.xout_2phase,
                                      self.Tdew_r,
                                      self.Tbubble_r,
                                      slipModel='Zivi')
        self.Charge_2phase = rho_average * w_2phase * self.V_r

        #Frictional pressure drop component
        DP_frict = LMPressureGradientAvg(
            self.xin_r, self.xout_2phase, self.AS, self.G_r, self.ID,
            self.Tbubble_r, self.Tdew_r) * self.Lcircuit * w_2phase
        #Accelerational pressure drop component
        try:
            if self.AS.name() in 'CarbonDioxide':
                DP_accel = AccelPressureDrop(
                    self.xin_r,
                    self.xout_2phase,
                    self.AS,
                    self.G_r,
                    self.Tbubble_r,
                    self.Tdew_r,
                    D=self.ID,
                    slipModel='Premoli') * self.Lcircuit * w_2phase
            else:
                DP_accel = AccelPressureDrop(
                    self.xin_r,
                    self.xout_2phase,
                    self.AS,
                    self.G_r,
                    self.Tbubble_r,
                    self.Tdew_r,
                    slipModel='Zivi') * self.Lcircuit * w_2phase
        except:
            DP_accel = AccelPressureDrop(
                self.xin_r,
                self.xout_2phase,
                self.AS,
                self.G_r,
                self.Tbubble_r,
                self.Tdew_r,
                slipModel='Zivi') * self.Lcircuit * w_2phase
        self.DP_r_2phase = DP_frict + DP_accel
        if self.Verbosity > 7:
            print(w_2phase, DWS.Q, Q_target, self.xin_r,
                  "w_2phase,DWS.Q,Q_target,self.xin_r")
        return DWS.Q - Q_target
Пример #7
0
    def _TwoPhase_Forward(self,w_2phase):
    
        DWS=DWSVals() #DryWetSegment structure
    
        # Store temporary values to be passed to DryWetSegment
        DWS.Fins=self.Fins
        DWS.FinsType = self.FinsType                                            
        DWS.A_a=self.Fins.A_a*w_2phase
        DWS.cp_da=self.Fins.cp_da
        DWS.eta_a=self.Fins.eta_a
        DWS.h_a=self.Fins.h_a*self.h_a_tuning  #Heat transfer coefficient, not enthalpy
        DWS.mdot_da=self.mdot_da*w_2phase
        DWS.pin_a=self.Fins.Air.p
        DWS.Tdew_r=self.Tdew_r
        DWS.Tbubble_r=self.Tbubble_r

        DWS.Tin_a=self.Tin_a
        DWS.RHin_a=self.Fins.Air.RH
    
        DWS.Tin_r=self.Tsat_r
        DWS.A_r=self.A_r_wetted*w_2phase
        DWS.Rw=self.Rw/w_2phase
        DWS.cp_r=1.0e15 #In the two-phase region the cp is infinite, use 1e15 as a big number;
        DWS.pin_r=self.psat_r
        DWS.mdot_r=self.mdot_r
        DWS.IsTwoPhase=True
        
        #Target heat transfer to go from inlet quality to saturated vapor
        Q_target=self.mdot_r*(self.xout_2phase-self.xin_r)*self.h_fg
        
        if Q_target<0:
            raise ValueError('Q_target in Evaporator must be positive')
        
        # Average Refrigerant heat transfer coefficient
        #Shah correlation
        #h_r=ShahEvaporation_Average(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Dh,self.psat_r,Q_target/DWS.A_r,self.Tbubble_r,self.Tdew_r)
        #Bertsch correlation
        #h_r=Bertsch_MC_Average(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Dh,Q_target/DWS.A_r,self.Lcircuit,self.Tbubble_r,self.Tdew_r)
        #Kandlikar correlation
        #h_r=KandlikarEvaporation_average(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Dh,self.psat_r,Q_target/DWS.A_r,self.Tbubble_r,self.Tdew_r)
        #Kim and Mudawar (2013)
        DPDZ_frict_2phase, h_r = KM_Evap_Average(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Dh,self.Tbubble_r,self.Tdew_r,self.psat_r,self.beta,Q_target/DWS.A_r,self.PH_PF)
        DWS.h_r=h_r*self.h_tp_tuning #correct refrigerant side convection heat transfer
        
        #Run the DryWetSegment to carry out the heat and mass transfer analysis
        DryWetSegment(DWS)
        
        self.Q_2phase=DWS.Q
        self.Q_sensible_2phase=DWS.Q_sensible
        self.h_r_2phase=DWS.h_r
        self.fdry_2phase=DWS.f_dry
        self.Tout_a_2phase=DWS.Tout_a
        
        rho_average=TwoPhaseDensity(self.AS,self.xin_r,self.xout_2phase,self.Tdew_r,self.Tbubble_r,slipModel='Zivi')
        self.Charge_2phase = rho_average * w_2phase * self.V_r        
        
        #Frictional pressure drop component
        #Lockhart-Martinelli correlation
        #DP_frict=LMPressureGradientAvg(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Dh,self.Tbubble_r,self.Tdew_r)*self.Lcircuit*w_2phase
        #using the pressure gradient of Kim & Mudawar (2013) 
        DP_frict=DPDZ_frict_2phase*self.Lcircuit*w_2phase
        
        #Accelerational pressure drop component    
        if self.Ref in 'CarbonDioxide' or 'CO2' or 'R744': #TODO: self.AS.name() is not available yet for all backends, using self.Ref for now
            DP_accel=AccelPressureDrop(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Tbubble_r,self.Tdew_r,D=self.Dh,slipModel='Premoli')*self.Lcircuit*w_2phase
        else:
            DP_accel=AccelPressureDrop(self.xin_r,self.xout_2phase,self.AS,self.G_r,self.Tbubble_r,self.Tdew_r,slipModel='Zivi')*self.Lcircuit*w_2phase
        self.DP_r_2phase=DP_frict+DP_accel;
        
        if self.Verbosity>7:
            print (w_2phase,DWS.Q,Q_target,self.xin_r,"w_2phase,DWS.Q,Q_target,self.xin_r")
        return DWS.Q-Q_target