示例#1
0
def testConv_script(NN):
    NN=int(NN)
    warmup=NN/2
    params={'m':[1.,100.,0.],'T':[1e-1,1.],'L':1.,'D':1e-7,'d':0.,'a':[0.5,0.5],'b':[0.5,0.5],'kb':1.,'force':[0.,0.,0.],'accelFlag':'none'}
    pt1=geometricPt(params=params)
    pt2=geometricPt(params=params)
    for i in xrange(NN):
        pt1.step()
        pt2.step()
    rslt=np.zeros([2,NN-warmup])
    rslt[0]=np.array(pt1.vt).T[1][warmup+1:]
    rslt[1]=np.array(pt2.vt).T[1][warmup+1:]
    return testConvergence(rslt)
示例#2
0
def experimentFrameCoreQLR(fN, N=1e4, massRatio=[1]):
    # heat transfer rate as a function of mass-ratio
    qlrD = np.zeros(len(massRatio))
    srD = np.zeros(len(massRatio))
    paramsD = np.empty(len(massRatio), dtype=object)
    for i in xrange(len(massRatio)):
        params = {
            "m": [0.01, 0.5, 0.5],
            "T": [1e-1, 1.0],
            "L": 1.0,
            "D": 0.5,
            "d": 0.25,
            "a": [0.5, 0.5],
            "b": [0.5, 0.5],
            "kb": 1.0,
            "force": [0.0, 0.0, 0.0],
            "accelFlag": "none",
        }
        it = massRatio[i]
        params["m"][1] = it / (1.0 + it)
        params["m"][2] = 1 / (1.0 + it)
        pt = geometricPt(params=params)
        [pt.step() for n in xrange(int(N))]
        qlr, qrr, sr, ql, qr, s = pt.heatTransferRate()
        qlrD[i] = qlr[-1]
        srD[i] = sr[-1]
    resultsD = {"qlr": qlrD, "sr": srD, "params": paramsD, "massRatio": massRatio}
    pickle.dump(resultsD, open(fN + ".p", "wr"))
示例#3
0
def experimentFrameCore1(fN, N=1e6, massRatio=[1]):
    # mass-ratio effect on velocity, q-rate, s-rate. time-path graphs.
    resultsD = np.empty(len(massRatio), dtype=object)
    for i in xrange(len(massRatio)):
        params = {
            "m": [0.01, 0.5, 0.5],
            "T": [1e-1, 1.0],
            "L": 1.0,
            "D": 0.5,
            "d": 0.25,
            "a": [0.5, 0.5],
            "b": [0.5, 0.5],
            "kb": 1.0,
            "force": [0.0, 0.0, 0.0],
            "accelFlag": "none",
        }
        it = massRatio[i]
        params["m"][1] = it / (1.0 + it)
        params["m"][2] = 1 / (1.0 + it)
        pt = geometricPt(params=params)
        [pt.step() for n in xrange(int(N))]
        ql, qr, s = pt.heatTransfer()
        resultsD[i] = {
            "t": np.array(pt.t),
            "xt": np.array(pt.xt_noncyclic).T,
            "wt": np.array(pt.wt),
            "ql": ql,
            "s": s,
            "params": params,
        }

    pickle.dump(resultsD, open(fN + ".p", "wr"))
示例#4
0
def experimentFrameCoreEquilibrium(fN, N=1e6):
    # generate a few routine graphs demonstrating the convergence of quantities such as velocity, heat-transfer-rate, entropy-production-rate
    params = {
        "m": [0.01, 0.5, 0.5],
        "T": [1e-1, 1.0],
        "L": 1.0,
        "D": 0.1,
        "d": 0.01,
        "a": [0.5, 0.5],
        "b": [0.5, 0.5],
        "kb": 1.0,
        "force": [0.0, 0.0, 0.0],
        "accelFlag": "none",
    }
    pt = geometricPt(params=params)
    [pt.step() for n in xrange(int(N))]
    _, _, _, ql, qr, s = pt.heatTransferRate()
    ptDict = {
        "t": np.array(pt.t),
        "xt": np.array(pt.xt_noncyclic).T,
        "wt": np.array(pt.wt),
        "ql": ql,
        "qr": qr,
        "s": s,
        "params": params,
    }
    pickle.dump(ptDict, open(fN + ".p", "wr"))
示例#5
0
def experimentHeat(fN, N=1e6, a=[[1.0, 1.0], [0.5, 0.5]]):
    a = np.array(a)
    qlrD = np.zeros(np.shape(a)[1])
    qrrD = np.zeros(np.shape(a)[1])
    srD = np.zeros(np.shape(a)[1])
    qlD = np.zeros(np.shape(a)[1])
    qrD = np.zeros(np.shape(a)[1])
    sD = np.zeros(np.shape(a)[1])
    paramsD = np.empty(np.shape(a)[1], dtype=object)
    for i in xrange(np.shape(a)[1]):
        params = {
            "m": [1.0, 0.0, 0.0],
            "T": [1e-1, 1.0],
            "L": 1.0,
            "D": 0.0,
            "d": 0.0,
            "a": a.T[i],
            "b": [0.0, 0.0],
            "kb": 1.0,
            "force": [0.0, 0.0, 0.0],
            "accelFlag": "none",
        }
        pt = geometricPt(params=params)
        [pt.step() for n in xrange(int(N))]
        #        aa=np.array(pt.heatTransferRate())
        #        pdb.set_trace()
        qlrD[i], qrrD[i], srD[i], qlD[i], qrD[i], sD[i] = np.array(pt.heatTransferRate()).T[-1]
        paramsD[i] = params
    ptDict = {"a": a, "qlr": qlrD, "qrr": qrrD, "sr": srD, "ql": qlD, "qr": qrD, "s": sD, "params": paramsD}
    pickle.dump(ptDict, open(fN + ".p", "wr"))
示例#6
0
def exp_coreOne(mode="time", N=1e2, b=[1.0, 1.0], m_core=[1.0, 100.0], T=[0.1, 1.0]):
    params = {
        "m": [m_core[0], m_core[1], 0.0],
        "T": T,
        "L": 1.0,
        "D": 1e-7,
        "d": 0.0,
        "a": [0.5, 0.5],
        "b": b,
        "kb": 1.0,
        "force": [0.0, 0.0, 0.0],
        "accelFlag": "none",
    }
    pt = geometricPt(params=params)
    init_cutoff = int(N) / 2
    if mode == "step":
        [pt.step() for n in xrange(int(N))]
    elif mode == "time":
        while pt.t[-1] < N:
            pt.step()
    else:
        raise ValueError("invalid mode for exp_core_One. Either time or step")
    result_distr, result_running, result_end = summaryCalc_core(pt, init_cutoff)
    return result_distr, result_running, result_end