예제 #1
0
    def f(z0):
        z0 = np.array([z0])
        x0 = np.array([0.01])
        r = np.array([z0, x0])
        X = p.X(r)
        Y = mf.Yabs(r)
        Nz0 = np.sqrt(Y / (1 + Y)) - 0.001
        print "Nz_opt", Nz0
        Nx0 = coldNx_Om(X, Y, Nz0)
        data = X, Y, p.gamma(10), Nz0
        Nx0 = fsolve(hot_disp_rel_wrapp, Nx0, args=data)
        print Nx0
        N = np.array([Nz0, Nx0])
        nz, nx = ri.nz(r, N), ri.nx(r, N)

        init_cond = np.array([z0, x0, Nz0, Nx0])
        print init_cond
        soln = hot.get_ray(init_cond, ncycle)
        #make gamma in the config!
        soln = {
            "init_cond": init_cond,
            "soln": soln,
            "ncycle": ncycle,
            "gamma": p.gamma(10)
        }
        #make file exist check

        #np.save(os.path.abspath("results/mirror/simple/Obeam/plasma_bvp/gamma10/soln_"+str(z0[0])),soln)

        return soln
예제 #2
0
    def f(Y):
        params.Y = Y
        X = p.X(r)
        Nz0 = np.array([np.sqrt(Y / (1 + Y))])

        Nx0 = -coldNx_Om(
            X, Y,
            Nz0)  #Om should be called "+" mode. we actually above the O-cutoff
        data = X, Y, p.gamma(Te), Nz0

        Nx0 = fsolve(hot_disp_rel_wrapp, Nx0, args=data)

        N = np.array([Nz0, Nx0])
        nz, nx = ri.nz(r, N), ri.nx(r, N)

        init_cond = np.array([z0, x0, Nz0, Nx0])

        print mf.Yabs(np.array([z0, x0])), init_cond
        soln = hot.get_ray(init_cond, ncycle)

        soln = {
            "init_cond": init_cond,
            "soln": soln,
            "Y": params.Y,
            "ncycle": ncycle
        }
예제 #3
0
    def f(delta_Nz0):

        z0 = np.array([0])
        x0 = np.array([1.05])

        r = np.array([z0, x0])
        X = p.X(r)
        Y = mf.Yabs(r)
        Nz0 = np.sqrt(Y / (1 + Y)) + delta_Nz0
        print "Nz_opt", X, Y
        Nx0 = coldNx_Om(X, Y, Nz0)

        data = X, Y, p.gamma(10), Nz0
        Nx0 = fsolve(hot_disp_rel_wrapp, Nx0, args=data)
        print Nx0
        N = np.array([Nz0, Nx0])
        nz, nx = ri.nz(r, N), ri.nx(r, N)

        init_cond = np.array([z0, x0, Nz0, Nx0])
        print init_cond
        soln = hot.get_ray(init_cond, ncycle)
        #make gamma in the config!
        print(init_cond)
        soln = {
            "init_cond": init_cond,
            "soln": soln,
            "ncycle": ncycle,
            "gamma": p.gamma(10)
        }
        #make file exist check

        return soln
예제 #4
0
def start_Xm(Y, Nz):

    X = np.linspace(1.0001, 3, 1000)

    Nx0_Xm = coldNx_Xm(X, Y, Nz)
    Nx0_Om = coldNx_Om(X, Y, Nz)

    arrNan = np.where(np.isnan(Nx0_Xm) == True)[0]
    Nx_turnP = coldNx_Om(X[arrNan[0] - 1], Y, Nz)
    ind1 = np.where(Nx0_Om < Nx_turnP)[0]

    plus_mode_ind = ind1
    if plus_mode_ind.size != 0:
        return X[plus_mode_ind[0]]

    else:
        return X[arrNan[0]]
예제 #5
0
    def f(Y):
        params.Y = Y
        Nz0_opt = np.array([np.sqrt(Y / (1 + Y))])
        allSolns = []
        for Nz0 in np.linspace(Nz0_opt + 0.001, Nz0_opt + 0.001, 1):
            Nz0 = np.array([Nz0])
            #TODO: use the cold dispersion relation to find which refractive index to use, becasue I want to do the angular scan. We need to choose the proper branch
            if (Nz0 < Nz0_opt):
                #get the starting point of a ray
                x0 = np.array([brentq(cold_C_wrapp, 1.001, 40, args=(Y, Nz0))
                               ]) + 0.001
                print "x0", x0
            else:
                x0 = np.array([1.001])  #more or less arbitrary
            z0 = np.array([0])
            r = np.array([z0, x0])
            X = p.X(r)
            print r, X

            Nx0 = -coldNx_Om(X, Y, Nz0)
            print Nx0
            data = X, Y, p.gamma(10), Nz0

            Nx0 = fsolve(hot_disp_rel_wrapp, Nx0, args=data)

            N = np.array([Nz0, Nx0])
            nz, nx = ri.nz(r, N), ri.nx(r, N)

            init_cond = np.array([z0, x0, Nz0, Nx0])

            print mf.Yabs(np.array([z0, x0])), init_cond
            soln = hot.get_ray(init_cond, ncycle)

            soln = {
                "init_cond": init_cond,
                "soln": soln,
                "Y": params.Y,
                "ncycle": ncycle
            }
            allSolns.append(soln)
            #Idea: investigate vg_perp/v_parallel of as function of Nz in the slabb model. We willl find the that the dependy is weak! (hopefully) -> EBW is not affected much the injection angle
        #np.save(os.path.abspath("results/slab/Obeam/harm1/gamma10/NzScan/soln_"+str(params.Y)),allSolns)

        return np.array(allSolns)
예제 #6
0
    plus_mode_ind = ind1
    if plus_mode_ind.size != 0:
        return X[plus_mode_ind[0]]

    else:
        return X[arrNan[0]]


plot = True
if plot == True:

    z0 = np.zeros(1000)
    x0 = np.linspace(0, 2, 1000)

    r = np.array([z0, x0])

    Y = mf.Yabs(r)
    X = p.X(r)

    import params

    Y = params.Y * np.ones(1000)
    Nz0 = u.Nz_opt(Y[0]) + 0.1

    Nx0_Xm = coldNx_Xm(X, Y, Nz0)
    Nx0_Om = coldNx_Om(X, Y, Nz0)

    plt.plot(X, Nx0_Om)
    plt.plot(X, Nx0_Xm)
    plt.scatter(start_Xm(Y[0], Nz0), 0)
예제 #7
0
    ]
    return A(Nz, dielTen), B(Nz, dielTen), C(Nz, dielTen)


coldNxXm = np.sqrt(coldNx_Xm(p.X([0, 1.139]), p.Yabs([0, 1.139]), 0.6))
A, B, C = get_ABC(p.X([0, 1.139]), p.Yabs([0, 1.139]), p.gamma(1), 0.6,
                  coldNxXm)

print coldNxXm
print B**2 - 4 * A * C

i = 0
for x in np.linspace(0, 5, 1000):
    Nx_Xm = coldNx_Xm(p.X([0, x]), p.Yabs([0, x]), 0.01)

    Nx_Om = coldNx_Om(p.X([0, x]), p.Yabs([0, x]), 0.01)

    print Nx_Om, Nx_Xm
    #plt.scatter(p.X([0,x]),Nx_Xm)
    #plt.scatter(p.X([0,x]),Nx_Om)
    plt.scatter(x, Nx_Xm)
    plt.scatter(x, Nx_Om)

    i += 1

x = -0.18
Nx_Xm = coldNx_Xm(p.X([0, x]), p.Yabs([0, x]), 0.1)**2

Nx_Om = coldNx_Om(p.X([0, x]), p.Yabs([0, x]), 0.1)**2

#plt.ylim([0,1000])