Exemplo n.º 1
0
def load(prefix, ts, d):
    for n in range(profile.SIZE):
        d[profile.LZ0 * n:profile.LZ0 * (n + 1), :] = np.fromfile(
            file.input([prefix, ts, n]),
            np.float64).reshape(profile.LZ, profile.LY, profile.LX,
                                3)[2:2 + profile.LZ0, profile.LY // 2,
                                   profile.LX // 2 - 80:profile.LX // 2 + 80,
                                   index]
Exemplo n.º 2
0
def load(prefix, ts, k):
    rank = k // profile.LZ0;
    kk = 2 + k % profile.LZ0;

    d = np.fromfile(file.input([prefix, ts, rank]), np.float64).reshape(profile.LZ, profile.LY, profile.LX, 3)[kk, :, :, index]

    #print(np.min(d))
    #print(np.max(d))
    
    return d
Exemplo n.º 3
0
def load(prefix, ts, pid):
    for n in range(profile.SIZE):
        #print(file.input([prefix, ts, n]))
        d = np.loadtxt(file.input([prefix, ts, n]), delimiter="\t")
        if (d.size > 0):
            d = d.reshape(d.size // 7, 7)

            if (d == pid).any():
                pid_ = np.where(d == pid)
                d[pid_[0], 1] = d[pid_[0], 1] - 2.0 + n * profile.LZ0
                return np.c_[d[pid_[0], 1:4][0]]
Exemplo n.º 4
0
def main():

    x = np.array([i for i in range(profile.TIMESTEP_MAX + 1)])
    #eles = setup_data(file_in('eles_k'))
    #ions = setup_data(file_in('ions_k'))
    eles = load_r(file.input('energy_eles_r.txt'))
    ions = load_r(file.input('energy_ions_r.txt'))
    f_b = load(file.input('energy_f_b.txt'))
    f_e = load(file.input('energy_f_e.txt'))

    t0 = f_e[1000] + ions[1000] + eles[1000]
    #t0 = f_b[0] + f_e[0]
    f_e /= t0
    eles /= t0
    ions /= t0

    plt.fill_between(x, 0, f_e, facecolor='cyan', alpha=0.3)
    plt.fill_between(x, 0, ions, facecolor='red', alpha=0.3)
    plt.fill_between(x, 0, eles, facecolor='blue', alpha=0.3)

    plt.legend()

    plt.savefig(file.output('energy_f_e+plasma'),
                bbox_inches='tight',
                transparent=True)

    plt.xlim(0, 2000)

    plt.savefig(file.output('energy_f_e+plasma_xlim2000'),
                bbox_inches='tight',
                transparent=True)

    plt.xlim(0, profile.TIMESTEP_MAX)

    plt.yscale("log")

    plt.savefig(file.output('energy_f_e+plasma_log'),
                bbox_inches='tight',
                transparent=True)

    plt.clf()
Exemplo n.º 5
0
def load(prefix, ts):
    d = np.zeros((profile.LZ0 * profile.SIZE, profile.LY, profile.LX))
    for n in range(profile.SIZE):
        d[profile.LZ0 * n:profile.LZ0 * (n + 1), :, :] = np.fromfile(
            file.input([prefix, ts, n]),
            np.float64).reshape(profile.LZ, profile.LY, profile.LX,
                                3)[2:2 + profile.LZ0, :, :, index]

    #print(d.shape)

    #print(np.min(d))
    #print(np.max(d))

    return d
Exemplo n.º 6
0
def main():

    x = np.array([i for i in range(profile.TIMESTEP_MAX + 1)])
    #eles = setup_data(file_in('eles_k'))
    #ions = setup_data(file_in('ions_k'))
    eles = load_r(file.input('energy_eles_r.txt'))
    ions = load_r(file.input('energy_ions_r.txt'))
    f_b = load(file.input('energy_f_b.txt'))
    f_e = load(file.input('energy_f_e.txt'))

    t0 = eles[1000] + ions[1000] + f_b[1000] + f_e[1000]
    #t0 = f_b[0] + f_e[0]

    eles /= t0
    ions /= t0
    f_b /= t0
    f_e /= t0

    plt.fill_between(x, 0, f_b, facecolor='green', alpha=0.3)
    plt.fill_between(x, 0, f_e, facecolor='cyan', alpha=0.3)
    plt.fill_between(x, 0, eles, facecolor='blue', alpha=0.3)
    plt.fill_between(x, 0, ions, facecolor='red', alpha=0.3)

    plt.plot(x, eles, color='blue', alpha=1.00, label='eles_r')
    plt.plot(x, ions, color='red', alpha=1.00, label='ions_r')
    plt.plot(x, f_b, color='green', alpha=1.00, label='B')
    plt.plot(x, f_e, color='cyan', alpha=1.00, label='E')
    plt.legend()

    plt.savefig(file.output('energy'), bbox_inches='tight', transparent=True)
    plt.yscale("log")

    plt.savefig(file.output('energy_log'),
                bbox_inches='tight',
                transparent=True)

    plt.clf()
Exemplo n.º 7
0
def plot(ts):
    d = load(file.input([prefix, ts, rank]))
    #print(np.max(d))
    fig = plt.figure()

    plt.imshow(d,
               origin=ORIGIN,
               interpolation=INTERPOLATION,
               cmap=C_MAP,
               vmin=C_MAX,
               vmax=C_MIN)
    plt.colorbar()

    save(file.output(['2d_' + prefix, ts, rank]), fig)
    plt.clf()
Exemplo n.º 8
0
def main():

    x = np.array([i for i in range(profile.TIMESTEP_MAX + 1)])
    #eles = setup_data(file_in('eles_k'))
    #ions = setup_data(file_in('ions_k'))
    #eles = load_r(file.input('energy_eles_r.txt'))
    #ions = load_r(file.input('energy_ions_r.txt'))
    f_b = load(file.input('energy_f_b.txt'))
    #f_e = load(file.input('energy_f_e.txt'))

    t0 = f_b[1000, 0] + f_b[1000, 1] + f_b[1000, 2]
    #t0 = f_b[0] + f_e[0]
    f_b[:, 0] /= t0
    f_b[:, 1] /= t0
    f_b[:, 2] /= t0

    f_b[:, 1] += f_b[:, 0]
    f_b[:, 2] += f_b[:, 1]


    plt.fill_between(x, 0, f_b[:,0], facecolor='green', label='Bz', alpha=0.3)
    plt.fill_between(x, f_b[:,0], f_b[:,1], facecolor='cyan', label='By', alpha=0.3)
    plt.fill_between(x, f_b[:,1], f_b[:,2], facecolor='red', label='Bx', alpha=0.3)

    plt.legend()
    
    plt.savefig(file.output('energy_f_b'), bbox_inches='tight', transparent=True)

    plt.xlim(0, 2000)

    plt.savefig(file.output('energy_f_b_xlim2000'), bbox_inches='tight', transparent=True)

    plt.xlim(0, profile.TIMESTEP_MAX)

    plt.yscale("log")

    plt.savefig(file.output('energy_f_b_log'), bbox_inches='tight', transparent=True)

    plt.clf()
Exemplo n.º 9
0
def loop(p):
    for ts in range(profile.TIMESTEP_STEP * p, profile.TIMESTEP_MAX + 1,
                    profile.TIMESTEP_STEP * PROC):
        print(file.input([prefix, ts, rank]))
        plot(ts)