Ejemplo n.º 1
0
def get_kinetic_and_classicB(path, fprefix, time, xlim=-1):
    '''
       classic_biermann,kinetic_biermann = get_kinetic_and_classicB(path,fprefix,time)
    '''
    dict = cf.load_data_all_1D(path, fpre(path), time)
    ne = dict['ne']
    Te = dict['Te']
    qx = dict['qx']
    qy = dict['qy']
    jx = dict['jx']
    jy = dict['jy']
    dxT = dict['dxT']
    dyT = dict['dyT']
    Bz = dict['Bz']
    x_grid = dict['x_grid']
    y_grid = dict['y_grid']
    Z2ni = dict['Z2ni']
    prof_Z = dict['Z']
    fo = dict['fo']
    nv = dict['nv']
    ny = dict['ny']
    nx = dict['nx']
    rA = (Z2ni)**-1

    dict_fo = cf.load_dict_1D(path, fpre(path), 'fo', time)
    fo = dict_fo['mat']
    time_col = dict_fo['time'] * tstep_factor

    rA = (Z2ni)**-1

    #===============
    grid = dict['grid']
    dxfo, dyfo = cf.get_grad_3d_varZ(grid, fo)

    omega = Bz * rA
    rho_vyx = extend_grid_xy_to_vxy(nv, ny, nx, rA)
    Bz_vyx = extend_grid_xy_to_vxy(nv, ny, nx, Bz)
    omega_vyx = extend_grid_xy_to_vxy(nv, ny, nx, omega)
    Te_vyx = extend_grid_xy_to_vxy(nv, ny, nx, Te)
    ne_vyx = extend_grid_xy_to_vxy(nv, ny, nx, ne)

    #------ NERNST -----------------------------------------------------
    print '\n\n--------- time ==================== ', time

    #v_nx,v_ny = get_v_N(grid,rho_vyx,Bz_vyx,fo)
    print(' bier init= ', np.shape(rho_vyx), np.shape(Bz_vyx),
          np.shape(ne_vyx), np.shape(Te_vyx))

    classic_biermann = get_Biermann_classic(grid, rho_vyx, Bz_vyx, ne_vyx,
                                            Te_vyx)
    kinetic_biermann = get_Biermann(grid, rho_vyx, Bz_vyx, fo)

    classic_biermann = np.transpose(classic_biermann)
    kinetic_biermann = np.transpose(kinetic_biermann)

    return classic_biermann, kinetic_biermann
Ejemplo n.º 2
0
def get_vN_from_path(path, fprefix, time):
    '''
        v_nx,v_ny = get_vN_from_path(path,fprefix,time)
    '''

    dict = cf.load_data_all_1D(path, fpre(path), time)
    ne = dict['ne']
    Te = dict['Te']
    qx = dict['qx']
    qy = dict['qy']
    jx = dict['jx']
    jy = dict['jy']
    dxT = dict['dxT']
    dyT = dict['dyT']
    Bz = dict['Bz']
    x_grid = dict['x_grid']
    y_grid = dict['y_grid']
    Z2ni = dict['Z2ni']
    prof_Z = dict['Z']
    fo = dict['fo']
    nv = dict['nv']
    ny = dict['ny']
    nx = dict['nx']
    rA = (Z2ni)**-1

    dict_fo = cf.load_dict_1D(path, fpre(path), 'fo', time)
    fo = dict_fo['mat']
    grid = fo
    v_grid = dict_fo['v_grid']
    nv, ny, nx = np.shape(fo)

    v_nx = np.zeros((ny, nx))
    v_ny = np.zeros((ny, nx))
    v_nx_hf = np.zeros((ny, nx))
    v_ny_hf = np.zeros((ny, nx))

    #v_nx,v_ny = get_v_N(grid,rho_vyx,Bz_vyx,fo)

    for ix in range(nx):
        for iy in range(ny):
            Z2ni_loc = Z2ni[iy, ix]
            v_nx[iy,
                 ix], v_ny[iy,
                           ix] = get_v_N_classical(v_grid, Z2ni_loc, ne[iy,
                                                                        ix],
                                                   Te[iy, ix], Bz[iy, ix],
                                                   dxT[iy, ix], dyT[iy, ix])

            v_nx_hf[iy, ix] = qx[iy, ix] / (2.5 * ne[iy, ix] * Te[iy, ix])
            v_ny_hf[iy, ix] = qy[iy, ix] / (2.5 * ne[iy, ix] * Te[iy, ix])

    v_nx = np.where(Bz == 0.0, 0.0, v_nx)
    v_ny = np.where(Bz == 0.0, 0.0, v_ny)
    return v_nx, v_ny, v_nx_hf, v_ny_hf
Ejemplo n.º 3
0
def get_Nernst_abs(path, time):
    '''
    data_x,data_y = get_Nernst_ratio(path,time)
    '''
    dict = cf.load_data_all_1D(path, fpre(path), time)
    ne = dict['ne']
    Te = dict['Te']
    qx = dict['qx']
    qy = dict['qy']
    jx = dict['jx']
    jy = dict['jy']
    dxT = dict['dxT']
    dyT = dict['dyT']
    Bz = dict['Bz']
    x_grid = dict['x_grid']
    y_grid = dict['y_grid']
    Z2ni = dict['Z2ni']
    prof_Z = dict['Z']
    fo = dict['fo']
    nv = dict['nv']
    ny = dict['ny']
    nx = dict['nx']
    rA = (Z2ni)**-1

    dict_fo = cf.load_dict_1D(path, fpre(path), 'fo', time)
    fo = dict_fo['mat']

    rA = (Z2ni)**-1

    #===============
    grid = dict['grid']
    dxfo, dyfo = cf.get_grad_3d_varZ(grid, fo)
    rho = rA
    omega = Bz * rA
    rho_vyx = extend_grid_xy_to_vxy(nv, ny, nx, rA)
    Bz_vyx = extend_grid_xy_to_vxy(nv, ny, nx, Bz)
    omega_vyx = extend_grid_xy_to_vxy(nv, ny, nx, omega)
    #------ NERNST -----------------------------------------------------
    v_nx, v_ny = get_v_N(grid, rho_vyx, Bz_vyx, fo)
    v_nx_classical, v_ny_classical, v_nx_hf, v_ny_hf = get_vN_from_path(
        path, fpre(path), time)

    v_nx_c = np.transpose(v_nx_classical)
    v_ny_c = np.transpose(
        v_ny_classical)  #np.transpoe(v_ny_classical)#[:,::-1]
    v_nx_k = np.transpose(v_nx)
    v_ny_k = np.transpose(v_ny)  #np.transpose(v_ny)#[:,::-1]

    return v_nx_k, v_ny_k, v_nx_c, v_ny_c
Ejemplo n.º 4
0
def get_kinetic_heatflow_b(path, time):
    '''
        dict = get_kinetic_heatflow_b(path,time)
        var_list = ['q_SH_x','q_SH_y','q_RL_x','q_RL_y','q_TE_x','q_TE_y','q_E_x','q_E_y']
        for var in range(len(dict.keys())):
            var_name = var_list[var]
            ax = fig.add_subplot(ny_plots,nx_plots,var+1)
            plot_2D(ax,dict[var_name]['data'],dict[var_name]['name'])
    
    '''

    dict = cf.load_data_all_1D(path, fpre(path), time)
    ne = dict['ne']
    Te = dict['Te']
    qx = dict['qx']
    qy = dict['qy']
    jx = dict['jx']
    jy = dict['jy']
    dxT = dict['dxT']
    dyT = dict['dyT']
    Bz = dict['Bz']
    x_grid = dict['x_grid']
    y_grid = dict['y_grid']
    Z2ni = dict['Z2ni']
    prof_Z = dict['Z']
    fo = dict['fo']
    nv = dict['nv']
    ny = dict['ny']
    nx = dict['nx']
    rA = (Z2ni)**-1

    dict_fo = cf.load_dict_1D(path, fpre(path), 'fo', time)

    #===============
    grid = dict['grid']
    dxfo, dyfo = cf.get_grad_3d_varZ(grid, fo)
    rho = rA
    omega = Bz * rA
    rho_vyx = extend_grid_xy_to_vxy(nv, ny, nx, rA)
    Bz_vyx = extend_grid_xy_to_vxy(nv, ny, nx, Bz)
    omega_vyx = extend_grid_xy_to_vxy(nv, ny, nx, omega)
    dict = get_qSH_kinetic(grid, rho_vyx, Bz_vyx, jx, jy, fo)
    dict['x_grid'] = dict_fo['x_grid']
    dict['y_grid'] = dict_fo['y_grid']
    dict['v_grid'] = dict_fo['v_grid']
    dict['time'] = dict_fo['time']
    return dict
Ejemplo n.º 5
0
def get_q_abs(path, time):
    '''
    dict_ratio = get_q_ratio(path,time)
    '''
    time_int = int(time)
    dict = cf.load_data_all_1D(path, fpre(path), time)
    ne = dict['ne']
    Te = dict['Te']
    qx = dict['qx']
    qy = dict['qy']
    jx = dict['jx']
    jy = dict['jy']
    dxT = dict['dxT']
    dyT = dict['dyT']
    Bz = dict['Bz']
    U = dict['U']
    x_grid = dict['x_grid']
    y_grid = dict['y_grid']
    Z2ni = dict['Z2ni']
    prof_Z = dict['Z']
    fo = dict['fo']
    nv = dict['nv']
    ny = dict['ny']
    nx = dict['nx']
    rA = (Z2ni)**-1

    dict_fo = cf.load_dict_1D(path, fpre(path), 'fo', time)
    fo = dict_fo['mat']
    rA = (Z2ni)**-1

    #===============
    grid = dict['grid']
    dxfo, dyfo = cf.get_grad_3d_varZ(grid, fo)
    rho = rA
    omega = Bz * rA
    rho_vyx = extend_grid_xy_to_vxy(nv, ny, nx, rA)
    Bz_vyx = extend_grid_xy_to_vxy(nv, ny, nx, Bz)
    omega_vyx = extend_grid_xy_to_vxy(nv, ny, nx, omega)
    #heat flow ratios

    #--- kinetic
    dict = get_qSH_kinetic(grid, rho_vyx, Bz_vyx, jx, jy, fo)
    name_list = [
        'q_SH_x', 'q_SH_y', 'q_RL_x', 'q_RL_y', 'q_TE_x', 'q_TE_y', 'q_E_x',
        'q_E_y'
    ]
    for name in name_list:
        dict[name]['data'] = np.transpose(dict[name]['data'])[:]

    q_KSH_x, q_KSH_y, q_KRL_x, q_KRL_y, q_KTE_x, q_KTE_y, q_KE_x, q_KE_y = dict[
        'q_SH_x']['data'], dict['q_SH_y']['data'], dict['q_RL_x'][
            'data'], dict['q_RL_y']['data'], dict['q_TE_x']['data'], dict[
                'q_TE_y']['data'], dict['q_E_x']['data'], dict['q_E_y']['data']
    #--- classical

    q_dir = path + '/'
    q_SH_x = np.load(q_dir + 'q_SH_x.txt.npy')
    q_SH_y = np.load(q_dir + 'q_SH_y.txt.npy')
    q_RL_x = np.load(q_dir + 'q_RL_x.txt.npy')
    q_RL_y = np.load(q_dir + 'q_RL_y.txt.npy')
    q_E_x = np.load(q_dir + 'q_E_x.txt.npy')
    q_E_y = np.load(q_dir + 'q_E_y.txt.npy')
    q_xX = np.load(q_dir + 'q_xX.txt.npy')
    q_yY = np.load(q_dir + 'q_yY.txt.npy')
    #nt,ny,nx
    q_x_VFP = (q_xX[:, 1:, :] + q_xX[:, :-1, :]) * 0.5
    q_y_VFP = (q_yY[:, :, 1:] + q_yY[:, :, :-1]) * 0.5
    q_x_B = q_RL_x + q_E_x + q_SH_x
    q_y_B = q_RL_y + q_E_y + q_SH_y

    dict_c = {}
    dict_c['tot x'] = q_x_B[time_int, :, :]  #q_xc
    dict_c['tot y'] = q_y_B[time_int, :, :]

    dict_c['SH x'] = q_SH_x[time_int, :, :]  #q_SH_x[time_int,:x_lim,:]
    dict_c['SH y'] = q_SH_y[time_int, :, :]  #q_SH_y[time_int,:x_lim,:]
    dict_c['RL x'] = q_RL_x[time_int, :, :]
    dict_c['RL y'] = q_RL_y[time_int, :, :]
    dict_c['E x'] = q_E_x[time_int, :, :]
    dict_c['E y'] = q_E_y[time_int, :, :]

    dict_k = {}
    dict_k['tot x'] = q_x_VFP[time_int, :, :]
    dict_k['tot y'] = q_y_VFP[time_int, :, :]

    dict_k['SH x'] = q_KSH_x  #q_SH_x[time_int,:x_lim,:]
    dict_k['SH y'] = q_KSH_y  #q_SH_y[time_int,:x_lim,:]
    dict_k['RL x'] = q_KRL_x
    dict_k['RL y'] = q_KRL_y
    dict_k['E x'] = q_KTE_x + q_KE_x
    dict_k['E y'] = q_KTE_y + q_KE_y

    dict_k['time'] = dict_fo['time']
    dict_c['x_grid'] = x_grid[1:-1]
    dict_c['y_grid'] = y_grid
    dict_k['x_grid'] = x_grid[1:-1]
    dict_k['y_grid'] = y_grid
    dict_k['ne'] = np.transpose(ne)
    dict_k['Te'] = np.transpose(Te)
    dict_k['jx'] = np.transpose(jx)
    dict_k['jy'] = np.transpose(jy)
    dict_k['dxT'] = np.transpose(dxT)
    dict_k['dyT'] = np.transpose(dyT)
    dict_k['Bz'] = np.transpose(Bz)
    dict_k['Z2ni'] = np.transpose(Z2ni)
    dict_k['U'] = np.transpose(U)

    return dict_c, dict_k