コード例 #1
0
ファイル: MHD1.py プロジェクト: timebridge/stablab_python
    })

    # Solve the profile
    p, s = profile_flux(p, sol)

    x = np.linspace(s['L'], s['R'], 200)
    y = soln(x, s)

    # Plot the profile
    plt.figure("Profile")
    plt.plot(x, y)
    plt.show()

    s, e, m, c = emcset(s, 'front', [2, 2], 'reg_adj_compound', A, Ak)

    circpnts, imagpnts, innerpnts = 30, 30, 32
    r = 1
    spread = 4
    zerodist = 10**(-4)
    # ksteps, lambda_steps = 32, 0
    preimage = semicirc(circpnts, imagpnts, c['ksteps'], r, spread, zerodist)

    out, domain = Evans_compute(preimage, c, s, p, m, e)
    out = out / out[0]
    w = reflect_image(out)
    windnum = winding_number(w)

    print('Winding Number: {:f}\n'.format(windnum))

    Evans_plot(w)
コード例 #2
0
    # This choice solves the right hand side via exterior products
    s, e, m, c = emcset(s, 'front', [2, 2], 'adj_reg_compound', A, Ak)

    # display a waitbar
    c.stats = 'print'  # 'on', 'print', or 'off'
    c.ksteps = 2**8

    # Preimage Contour
    # This is a semi circle. You can also do a semi annulus or a rectangle
    circpnts = 30
    imagpnts = 30
    R = 10
    spread = 2
    zerodist = 10**(-2)
    preimage = semicirc(circpnts, imagpnts, c.ksteps, R, spread, zerodist)

    # compute Evans function
    halfw, domain = Evans_compute(preimage, c, s, p, m, e)
    w = halfw / halfw[0]

    # We compute Evans function on half of contour then reflect across reals
    w = reflect_image(w)

    # Process and display data
    wnd = winding_number(w)  # determine the number of roots inside the contour
    print("Winding Number: ", wnd)

    # plot the Evans function (normalized)
    Evans_plot(w)
コード例 #3
0
    # display a waitbar
    c.stats = 'print'

    # Preimage
    points = 50
    preimage = 0.16+0.05*np.exp(2*np.pi*1j*np.linspace(0,0.5,points+(points-1)*c.ksteps)) #FIXME: this line could probably be easier to understand

    # Compute the Evans function
    halfw,preimage  = Evans_compute(preimage,c,s,p,m,e)
    w = reflect_image(halfw)
    # Normalize the Evans Output
    w = w/w[0]

    # Process and display data:
    wnd = winding_number(w)
    print("Winding Number: {:f}\n".format(wnd))
    Evans_plot(w)
    plt.show()

    #Set variables in preparation for root solving
    c.lambda_steps = 0
    c.stats = 'off'
    c.pic_stats = 'on'
    c.ksteps = 2**8
    c.moments = 'off'
    c.tol = 0.2
    c.root_fun = Evans_compute
    box = [0.1,-0.1,0.25,0.05]
    tol = 1e-3
    roots = root_solver1(box,tol,p,s,e,m,c)
コード例 #4
0
        })

    # Solve the profile
    p,s = profile_flux(p,sol)

    x = np.linspace(s['L'],s['R'],200)
    y = soln(x,s)

    # Plot the profile
    plt.figure("Profile")
    plt.plot(x,y)
    plt.show()

    s, e, m, c = emcset(s,'front',[2,2],'reg_adj_compound',A,Ak)

    circpnts, imagpnts, innerpnts = 30, 30, 32
    r = 1
    spread = 4
    zerodist = 10**(-4)
    # ksteps, lambda_steps = 32, 0
    preimage = semicirc(circpnts, imagpnts, c['ksteps'], r, spread, zerodist)

    out, domain = Evans_compute(preimage,c,s,p,m,e)
    out = out/out[0]
    w = reflect_image(out)
    windnum = winding_number(w)

    print('Winding Number: {:f}\n'.format(windnum))

    Evans_plot(w)
コード例 #5
0
ファイル: KS.py プロジェクト: timebridge/stablab_python
    # compute the Evans fucntion for HF study
    startTime = time.time()
    D, preimage2 = periodic_contour(kappa,preimage,c,s,p,m,e)
    totTime = time.time() - startTime

    # HF study output and statistics
    d.D1 = Struct()
    d.D1.time = totTime
    d.D1.points = len(preimage2)
    d.D1.D = D
    d.D1.preimage2 = preimage2

    # Determine the maximum winding number for different values of kappa
    max_wnd = 0
    for j in np.arange(1,len(kappa)):
    	max_wnd = max(max_wnd,winding_number(D[j-1,:]))
    d.D1.max_wnd = max_wnd

    #--------------------------------------------------------------------------
    # Compute the Taylor Coefficients and find eigenvalue expansion
    # coefficients
    #--------------------------------------------------------------------------

    p,s,d,st = ks_taylor(s,p,m,c,e,d)

    # -------------------------------------------------------------------------
    # Find the maximum value of lambda(k), |k|=R_remainder
    # -------------------------------------------------------------------------

    c.ksteps = 10000
    c.tol = 0.2