Exemplo n.º 1
0
def test_hard_sphere_mix():
    TOL = 1e-2

    fpackHS_a=np.array([0.2333, 0.2692, 0.3106, 0.3583, 0.3808, 0.4393, 0.5068])
    dHS = np.array([1, 3])
    xHS = np.array([0.5, 0.5])

    V_a = np.sum( xHS*np.pi/6*dHS**3 )/fpackHS_a

    FexHS_kT = np.zeros( V_a.shape )
    debug_output = None

    debug_output = None
    for ind, V in enumerate(V_a):
        iFexHS_kT, idebug_output = hsmix.hard_sphere_mix( V, xHS, dHS, debug_output=True )
        FexHS_kT[ind] = iFexHS_kT
        if debug_output is None:
            debug_output = {}
            for key in idebug_output:
                debug_output[key] = np.array(idebug_output[key])

        else:
            for key in idebug_output:
                debug_output[key] = np.append(debug_output[key],
                                              idebug_output[key])


    Z_a = np.array([2.368,2.772,3.356,4.241,4.764,6.567,9.898])
    Sk_a = -np.array([0.139,.205,.306,.467,.564,.898,1.495])

    assert np.all(np.abs(np.log(debug_output['S_k']/Sk_a)) < TOL),  \
        'S_k  values disagree with Mansoori 1971 Table 2.'
    assert np.all(np.abs(np.log(debug_output['Z']/Z_a)) < TOL), \
        'Z  values disagree with Mansoori 1971 Table 2.'

    assert False,  'excess S values do not match Mansoori 1971 Table 2 values'
Exemplo n.º 2
0
def eval_hs_mix_energy(self, V, T, X_a, dHS):
    kT = KT300 * T / 300.0
    Fhsmix_kT, = hsmix.hard_sphere_mix(V, X_a, dHS)
    Fhsmix = kT * Fhsmix_kT
    return Fhsmix
Exemplo n.º 3
0
def eval_hs_mix_energy(self, V, T, X_a, dHS):
    kT = KT300 * T / 300.0
    Fhsmix_kT, = hsmix.hard_sphere_mix(V, X_a, dHS)
    Fhsmix = kT * Fhsmix_kT
    return Fhsmix