Esempio n. 1
0
def i_heat_N_flux():
    '''Writes on text the Z-component of the exb and parallel ion heat flux.'''
    option = 1
    start = 0
    time_range = 200
    cut = accuracy / 2

    #new_file = open("Norm_i_heat_Fluxes@%s.txt" %(cut),'a')
    new_file = open("Norm_i_heat_Fluxes_Bottom.txt", 'a')
    new_file.write("Eq_exb" + "\t" + "Tur_exb" + "\t" + "Eq_par" + "\t" +
                   "Tur_par" + "\t" + "R" + "\t" + "psi" + "\n")
    br = core.getcutvalue_hor(core.bfield[:, 0], cut, 1)

    temp = np.array(
        [[core.getcutvRvZ(iz, it, cut) for iz in range(core.Nplanes)]
         for it in range(start, start + time_range)])
    VZ_all = temp[:, :, 1, :]
    print("VZ_all done...")
    ne_all = np.array([[
        core.getcutvalue_hor(core.ne[:, iz, it], cut, option)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("ne_all done...")
    Ti_perp_all = np.array([[
        core.map_array(core.i_T_perp, (iz - 1) % core.Nplanes, it, cut)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("Ti_perp_all done...")
    Ei_para_all = np.array([[
        core.map_array(core.i_E_para, (iz - 1) % core.Nplanes, it, cut)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("Ei_para_all done...")
    Vpar_all = np.array([[
        core.map_array(core.e_u_para, (iz - 1) % core.Nplanes, it, cut)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("Vpar_all done...")

    for Flux_ip in range(0, accuracy):
        if math.isnan(br[Flux_ip]) == True:
            pass
        else:
            exb, par = core.i_heat_flux_norm(cut, Flux_ip, VZ_all, ne_all,
                                             Ti_perp_all, Ei_para_all,
                                             Vpar_all)
            R = (Rmin + unitR * Flux_ip)
            psi = core.psii[Flux_ip]
            new_file.write(
                str(exb) + "\t" + str(par) + "\t" + str(R) + "\t" + str(psi) +
                "\n")
    new_file.close()
    return ("Done!")
Esempio n. 2
0
def i_mag_heat_N_flux():
    '''Writes on text the Z-component of the magnetic drifts ion heat flux.'''
    option = 1
    start = 0
    time_range = 200
    cut = accuracy / 2

    #new_file = open("Norm_i_mag_heat_Fluxes@%s.txt" %(cut),'a')
    new_file = open("Norm_i_mag_heat_Fluxes_Bottom.txt", 'a')
    new_file.write("Magnetic" + "\t" + "R" + "\t" + "psi" + "\n")
    br = core.getcutvalue_hor(core.bfield[:, 0], cut, 1)

    ne_all = np.array([[
        core.getcutvalue_hor(core.ne[:, iz, it], cut, option)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("ne_all done...")
    Ti_perp_all = np.array([[
        core.map_array(core.i_T_perp, (iz - 1) % core.Nplanes, it, cut)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("Ti_perp_all done...")
    Ei_para_all = np.array([[
        core.map_array(core.i_E_para, (iz - 1) % core.Nplanes, it, cut)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("Ei_para_all done...")

    for Flux_ip in range(0, accuracy):
        if math.isnan(br[Flux_ip]) == True:
            pass
        else:
            mag = core.mag_i_heat_flux_norm(cut, Flux_ip, ne_all, Ti_perp_all,
                                            Ei_para_all)
            R = (Rmin + unitR * Flux_ip)
            psi = core.psii[Flux_ip]
            new_file.write(str(mag) + "\t" + str(R) + "\t" + str(psi) + "\n")
    new_file.close()
    return ("Done!")
Esempio n. 3
0
def Particle_N_flux():
    '''Writes on text the Z-component (normal to a horizontal line) of the particle fluxes (exb and parallel components).'''
    option = 1
    start = 0
    time_range = 200
    cut = accuracy / 2

    #new_file = open("Norm_Particle_Fluxes_higher@%s.txt" %(cut),'a')
    new_file = open("Norm_Particle_Fluxes_Top.txt", 'a')
    new_file.write("ExB" + "\t" + "Par" + "\t" + "R" + "\t" + "psi" + "\n")
    br = core.getcutvalue_hor(core.bfield[:, 0], cut, 1)

    #loading arrays
    temp = np.array(
        [[core.getcutvRvZ(iz, it, cut) for iz in range(core.Nplanes)]
         for it in range(start, start + time_range)])
    VZ_all = temp[:, :, 1, :]
    print("VZ_all done...")

    ne_all = np.array([[
        core.getcutvalue_hor(core.ne[:, iz, it], cut, option)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("ne_all done...")

    Vpar_all = np.array([[
        core.map_array(core.e_u_para, (iz - 1) % core.Nplanes, it, cut)
        for iz in range(core.Nplanes)
    ] for it in range(start, start + time_range)])
    print("Vpar_all done...")

    for Flux_ip in range(0, accuracy):
        if math.isnan(br[Flux_ip]) == True:
            pass
        else:
            exb, par = core.particle_fluxes_norm(cut, Flux_ip, ne_all, VZ_all,
                                                 Vpar_all)
            R = (Rmin + unitR * Flux_ip)
            psi = core.psii[Flux_ip]
            new_file.write(
                str(exb) + "\t" + str(par) + "\t" + str(R) + "\t" + str(psi) +
                "\n")
    new_file.close()
    return ("Done!")