Пример #1
0
def calc_qi(dmin, dmax, dgr, dcr, rhog, l, mu, fr):
    norm = gp.gamma_pdf_norm(mu, l)
    i1 = pisxth*rhoi*gp.gintegral_seg(mu+3, l, dmin, dth)
    i2 = ava*gp.gintegral_seg(mu+bva, l, dth, dgr)
    i3 = pisxth*rhog*gp.gintegral_seg(mu+3, l, dgr, dcr)
    i4 = 1/(1-fr)*ava*gp.gintegral_seg(mu+bva, l, dcr)
    return (i1+i2+i3+i4)*norm
Пример #2
0
def calc_qi_quad(dmin, dmax, dgr, dcr, rhog, l, mu, fr):
    dmax = 100000.0
    dgr = min(dgr, dmax)
    dcr = min(dcr, dmax)
    D = [dmin, dth, dgr, dcr, dmax]

    a = b = np.zeros(4)

    b[0] = 3.0
    b[1] = bva
    b[2] = 3.0
    b[3] = bva
    
    a[0] = pisxth*rhoi
    a[1] = ava
    a[2] = pisxth*rhog
    a[3] = 1/(1-fr)*ava

    gamma = pifrth
    sigma = bva

    norm = gp.gamma_pdf_norm(mu, l)

    # f = lambda x, alpha, beta, gamma, sigma: tv.calc_vt_simple(x, alpha, beta, gamma, sigma)*gp.gammapdf(x, mu, l)*alpha*x**beta
    f = lambda x, alpha, beta: alpha*x**(mu+beta)*np.exp(-l*x)

    integral = 0
    for i in range(4):
        tmp, err = quad(f, D[i], D[i+1], args=(a[i], b[i]))
        integral += tmp

    return integral*norm
Пример #3
0
def collision_rate_pyt(dgr, dcr, rhog, fr, mu, l):   
    Ku = ((8*calc.g)/(np.pi*calc.cd*calc.rhoa))**0.5
    Ke = calc.E_coll*calc.pifrth
    Nnorm = gp.gamma_pdf_norm(mu,l)

    D = [[0, calc.dth], [calc.dth, dgr], [dgr, dcr], [dcr, lg.dmax]]

    gfb = np.zeros((4, 3))
    gf = np.zeros((4, 3))

    b = np.zeros(4)
    a = np.zeros(4)

    b[0] = 3.0
    b[1] = calc.bva
    b[2] = 3.0
    b[3] = calc.bva
    
    a[0] = calc.pisxth*calc.rhoi
    a[1] = calc.ava
    a[2] = calc.pisxth*rhog
    a[3] = 1/(1-fr)*calc.ava

    # use lower gamma function for integral
    for i in range(3):
        for k in range(3):
            expb = mu+b[i]*0.5+k-1
            exp = mu+k
            gfb[i,k] = gp.gintegral_seg(expb, l, D[i][0], D[i][1])
            gf[i,k] = gp.gintegral_seg(exp, l, D[i][0], D[i][1])

    # use upper gamma function for integral
    for k in range(3):
        i = 3
        expb = mu+b[i]*0.5+k-1
        exp = mu+k
        gfb[i,k] = gp.gintegral_seg(expb, l, D[i][0])
        gf[i,k] = gp.gintegral_seg(exp, l, D[i][0])  

    integral = 0
    for i in np.arange(1,4):
        for j in np.arange(0,i):
            tmp1 = np.sqrt(a[i])*(gfb[i,2]*gf[j,0] + 2*gfb[i,1]*gf[j,1] + gfb[i,0]*gf[j,2])
            tmp2 = np.sqrt(a[j])*(gf[i,2]*gfb[j,0] + 2*gf[i,1]*gfb[j,1] + gf[i,0]*gfb[j,2])
            integral += tmp1-tmp2

    integral = Ku*Ke*integral*Nnorm**2

    # for i in range(4):
    #     ID1D2, err = dblquad(collision_integrand, D[i][0], D[i][1], lambda x:D[i][0], lambda x:x, args=(dgr, dcr, rhog, fr, mu, l))
    #     integral += ID1D2

    return integral