Beispiel #1
0
    def eq_heat_balance(self):

        eq = self.CreateEquation("HeatBal", "Heat balance - T")
        ydomains = distribute_on_domains(self.YDomains, eq, eClosedClosed)
        xdomains = distribute_on_domains(self.XDomains, eq, eOpenClosed)
        domains = xdomains + ydomains

        L = self.L()
        D = daeVariable_wrapper(self.D, domains)
        k = daeVariable_wrapper(self.k, domains)
        Qout = daeVariable_wrapper(self.Qout, domains)
        T = daeVariable_wrapper(self.T, domains)
        P = daeVariable_wrapper(self.P, domains)
        Tast = T / Constant(1 * K)
        Past = P / Constant(1 * Pa)

        cp = heat_capacity(Tast, Past, simplified=True) * Constant(1 *
                                                                   (J**(1)) *
                                                                   (K**(-1)) *
                                                                   (kg**(-1)))
        rho = density(Tast, Past, simplified=True) * Constant(1 * (kg**(1)) *
                                                              (m**(-3)))

        A = 0.25 * 3.14 * D**2
        eq.Residual = self.dt(rho * cp * A * T) + \
                      d(k * cp * T, self.x, eCFDM) / L - \
                      Qout
Beispiel #2
0
    def eq_calculate_hint(self):

        eq = self.CreateEquation("InternalConvection", "Internal convection - hint")
        domains = distribute_on_domains(self.Domains, eq, eClosedClosed)

        T = daeVariable_wrapper(self.T, domains)
        P = daeVariable_wrapper(self.P, domains)
        fD = daeVariable_wrapper(self.fD, domains)
        hint = daeVariable_wrapper(self.hint, domains)
        D = daeVariable_wrapper(self.D, domains)
        v = daeVariable_wrapper(self.v, domains)

        # Calculates the Nussel dimensionless number using Petukhov correlation modified by Gnielinski. See Incropera 4th Edition [8.63]
        mu = viscosity( T / Constant(1 * K) , P / Constant(1 * Pa), simplified = True)
        kappa = conductivity( T / Constant(1 * K), P / Constant(1 * Pa), simplified = True)
        cp = heat_capacity( T / Constant(1 * K), P / Constant(1 * Pa), simplified = True)
        rho = density( T / Constant(1 * K), P / Constant(1 * Pa), simplified = True)

        Dast = D / Constant(1 * m )
        vast = v / Constant(1 * m * s ** -1)

        Re = Dast * Abs(vast) * rho / mu
        prandtl = cp * mu / kappa
        nusselt = (fD / 8.) * (Re - 1000.) * prandtl / (
                1. + 12.7 * Sqrt(fD / 8.) * (prandtl ** (2 / 3)) - 1.)
        eq.Residual = hint - nusselt * kappa / Dast * Constant(1 * W/(K * m**2))
def calculate_ext(Tvap, Pvap, To, fNtub_tube, L, Do):

    # Calculating properties
    T = 0.5 * (Tvap + To)

    g = 9.80665

    film_density = density(T, Pvap, simplified=True)
    film_heat_capacity = heat_capacity(T, Pvap, simplified=True)
    film_conductivity = conductivity(T, Pvap, simplified=True)
    film_viscosity = viscosity(T, Pvap, simplified=True)
    film_prandtl = film_heat_capacity * film_viscosity / film_conductivity

    exhaust_steam_density = vapour_density(Pvap, simplified=True)
    exhaust_vaporization_heat = vaporization_enthalpy(Pvap, simplified=True)

    num = (g * film_density * (film_density - exhaust_steam_density) *
           film_conductivity**3. * exhaust_vaporization_heat)
    den = film_viscosity * (Tvap - To) * Do
    hext_row1 = 0.729 * (num / den)**0.25
    Resext_row1 = 1 / (pi * Do * hext_row1 * L)

    hext = hext_row1 * fNtub_tube
    Resext = Resext_row1 / fNtub_tube

    return hext, Resext, exhaust_vaporization_heat
Beispiel #4
0
    def eq_entalphy(self):

        eq = self.CreateEquation("Entalphy", "Fluid Entalphy")
        xdomains = distribute_on_domains(self.XDomains, eq, eClosedClosed)
        ydomains = distribute_on_domains(self.YDomains, eq, eClosedClosed)
        domains = xdomains + ydomains

        k = daeVariable_wrapper(self.k, domains)

        H = daeVariable_wrapper(self.H, domains)
        T = daeVariable_wrapper(self.T, domains)
        P = daeVariable_wrapper(self.P, domains)
        Tast = T / Constant(1 * K)
        Past = P / Constant(1 * Pa)
        cp = heat_capacity( Tast, Past, simplified = True) * Constant(1 * (J ** (1))*(K ** (-1))*(kg ** (-1)))

        eq.Residual = k * cp * T - H
Beispiel #5
0
    def eq_energy_balance(self):
        """
        This method writes the mass balance to the correspondent node instance
        :return:
        """

        # Starting with the external mass flow rate
        cp_ext = heat_capacity(self.Text()/Constant(1*K), self.data['parameters']['Pext'], simplified=True)
        residual_aux = self.w() * self.Text() * cp_ext * Constant(1 * (J ** (1)) * (K ** (-1)) * (kg ** (-1)))

        for edge_name in self.get_inlet():
            residual_aux += self.Parent.submodels[edge_name].Hub()

        # Mass to the node outlet
        for edge_name in self.get_outlet():
            residual_aux -= self.Parent.submodels[edge_name].Hlb()

        eq = self.CreateEquation("NEB_source_energy_balance_2")
        eq.Residual = residual_aux
def calculate_int(Tin, Tout, Pin, Pout, m_tube, ep, Df, L, Di):

    g = 9.81

    T = 0.5 * (Tin + Tout)
    P = 0.5 * (Pin + Pout)

    # Calculating properties
    int_film_density = density(T, P, simplified=True)
    int_film_heat_capacity = heat_capacity(T, P, simplified=True)
    int_film_conductivity = conductivity(T, P, simplified=True)
    int_film_viscosity = viscosity(T, P, simplified=True)
    int_film_prandtl = int_film_heat_capacity * int_film_viscosity / int_film_conductivity

    v = (m_tube / int_film_density) / (0.25 * pi * Df**2)  # m/s
    v_abs = abs(v)

    Re_tube = Df * int_film_density * v_abs / int_film_viscosity

    ff = calculate_fanning(ep, Df, Re_tube)
    fD_tube = 4 * ff

    # Calculating Darcy
    int_film_Re = Df * int_film_density * v_abs / int_film_viscosity
    int_film_fD = calculate_darcy(fD_tube, ep, Df, int_film_Re)

    # Calculates the Nussel dimensionless number using Petukhov correlation modified by Gnielinski. See Incropera 4th Edition [8.63]
    nusselt = (int_film_fD / 8.) * (int_film_Re - 1000.) * int_film_prandtl / (
        1. + 12.7 * (int_film_fD / 8.)**0.5 * (int_film_prandtl**(2 / 3) - 1.))

    hint = nusselt * int_film_conductivity / Di  # W/m2K
    Resint = 1 / (pi * Df * hint * L)  # W/K

    tau = (1 / 8) * fD_tube * int_film_density * v**2
    hL = 0.5 * fD_tube * v**2 / (Di * g)
    DeltaP = g * int_film_density * hL
    pressure_loss_in_tube = DeltaP * L
    Pout_ = Pin - pressure_loss_in_tube

    return hint, Resint, int_film_heat_capacity, Pout_, fD_tube, pressure_loss_in_tube, v, Re_tube, int_film_density, int_film_viscosity