def f(q, t): z, x, Nz, Nx = q.reshape(4, Num) # all the variables are in global CS N = np.array([Nz, Nx]) r = np.array([z, x]) X = p.X(r) Y = mf.Yabs(r) dnz_dN = ri.dnz_dN(r, N) dnx_dN = ri.dnx_dN(r, N) dnz_dr = ri.dnz_dr(r, N) dnx_dr = ri.dnx_dr(r, N) dX_dr = p.dX_dr(r) dY_dr = mf.dY_dr(r) nz, nx = ri.nz(r, N), ri.nx(r, N) n = np.array([nz, nx]) vg = -np.real( dD_dN(X, Y, nz, nx, dnz_dN, dnx_dN, m) / dD_dw(X, Y, nz, nx, m)) a = np.real( dD_dr(X, Y, nz, nx, dnz_dr, dnx_dr, dX_dr, dY_dr, m) / dD_dw(X, Y, nz, nx, m)) arr = np.array([vg, a]) print(cold_disp_rel(X, Y, nz, nx, m), vg[0], vg[1]) return arr.reshape(4 * Num)
def get_vg(r, N): X = p.X(r) Y = mf.Yabs(r) dnz_dN = ri.dnz_dN(r, N) dnx_dN = ri.dnx_dN(r, N) dnz_dr = ri.dnz_dr(r, N) dnx_dr = ri.dnx_dr(r, N) dX_dr = p.dX_dr(r) dY_dr = mf.dY_dr(r) dgamma_dr = p.dgamma_dr(r) nz, nx = ri.nz(r, N), ri.nx(r, N) n = np.array([nz, nx]) if nx < 1: vg = -np.real( dD_dN(X, Y, gamma, nz, nx, dnz_dN, dnx_dN) / dD_dw(X, Y, gamma, nz, nx)) a = np.real( dD_dr(X, Y, gamma, nz, nx, dnz_dr, dnx_dr, dX_dr, dY_dr, dgamma_dr) / dD_dw(X, Y, gamma, nz, nx)) arr = np.array([vg, a]) else: vg = -np.real( ebw.dD_dN(X, Y, gamma, nz, nx, dnz_dN, dnx_dN) / ebw.dD_dw(X, Y, gamma, nz, nx)) return vg
def f(q, t): z, x, Nz, Nx = q.reshape(4, Num) # all the variables are in global CS r = np.array([z, x]) X = p.X(r) Y = mf.Yabs(r) gamma = p.gamma(Te) N = np.array([Nz, Nx]) dnz_dN = ri.dnz_dN(r, N) dnx_dN = ri.dnx_dN(r, N) dnz_dr = ri.dnz_dr(r, N) dnx_dr = ri.dnx_dr(r, N) dX_dr = p.dX_dr(r) dY_dr = mf.dY_dr(r) dgamma_dr = p.dgamma_dr(r) nz, nx = ri.nz(r, N), ri.nx(r, N) n = np.array([nz, nx]) if nx < 1: vg = -dD_dN(X, Y, gamma, nz, nx, dnz_dN, dnx_dN) / dD_dw( X, Y, gamma, nz, nx) a = dD_dr(X, Y, gamma, nz, nx, dnz_dr, dnx_dr, dX_dr, dY_dr, dgamma_dr) / dD_dw(X, Y, gamma, nz, nx) if conf.verbose == True: print('disp rel cold:{}, disp rel:{},x:{} '.format( cold_disp_rel(X, Y, nz, nx, "Xm"), disp_rel(X, Y, gamma, nz, nx), x)) #if disp_rel(X,Y,gamma,nz,nx)>0: #break else: vg = -np.real( ebw.dD_dN(X, Y, gamma, nz, nx, dnz_dN, dnx_dN) / ebw.dD_dw(X, Y, gamma, nz, nx)) if vg[0] > 1 or vg[1] > 1: print("vg", vg[0], vg[1]) if conf.verbose == True: print( "EBW", 'x:{},X:{},dispRel:{},nx:{},nz:{},'.format( x, X, disp_rel_ebw(X, Y, gamma, nz, nx), nx, nz)) #if np.abs(disp_rel_ebw(X,Y,gamma,nz,nx))>1e-4: #break a = ebw.dD_dr(X, Y, gamma, nz, nx, dnz_dr, dnx_dr, dX_dr, dY_dr, dgamma_dr) / ebw.dD_dw(X, Y, gamma, nz, nx) arr = np.array([vg, a]) arr = np.real(np.real(arr.astype(np.complex64))) return arr.reshape(4 * Num)
def f(q, t): z, x, Nz, Nx = q.reshape(4, Num) # all the variables are in global CS r = np.array([z, x]) N = np.array([Nz, Nx]) X = p.X(r) Y = mf.Yabs(r) gamma = p.gamma(10) """ if localNx<1: vg = -np.real( dD_dN( X,Y,gamma,localNz,localNx,dNz_dN,dNx_dN ) / dD_dw( X,Y,gamma,localNz,localNx ) ) a = np.real( dD_dr(X,Y,gamma,localNz,localNx,dNz_dr,dNx_dr,dX_dr,dY_dr,dgamma_dr) / dD_dw( X,Y,gamma,localNz,localNx ) ) A,B,C=get_ABC(X,Y,gamma,localNz,localNx) #print A*localNx**4 arr = np.array([vg,a]) """ dnz_dN = ri.dnz_dN(r, N) dnx_dN = ri.dnx_dN(r, N) dnz_dr = ri.dnz_dr(r, N) dnx_dr = ri.dnx_dr(r, N) dX_dr = p.dX_dr(r) dY_dr = mf.dY_dr(r) dgamma_dr = p.dgamma_dr(r) nz, nx = ri.nz(r, N), ri.nx(r, N) n = np.array([nz, nx]) if nx < 1: vg = -np.real(dD_dN(X, Y, gamma, nz, nx, dnz_dN, dnx_dN)) a = np.real( dD_dr(X, Y, gamma, nz, nx, dnz_dr, dnx_dr, dX_dr, dY_dr, dgamma_dr)) arr = np.array([vg, a]) if conf.verbose == True: print "dr", disp_rel(X, Y, gamma, nz, nx), x else: vg = -np.real(ebw.dD_dN(X, Y, gamma, nz, nx, dnz_dN, dnx_dN)) if vg[0] > 1 or vg[1] > 1: print "vg", vg[0], vg[1] if conf.verbose == True: print "EBW", x, X, disp_rel_ebw(X, Y, gamma, nz, nx), nx, nz a = np.real( ebw.dD_dr(X, Y, gamma, nz, nx, dnz_dr, dnx_dr, dX_dr, dY_dr, dgamma_dr)) arr = np.array([vg, a]) return arr.reshape(4)
def f(r,N): X=p.X(r) Y=mf.Yabs(r) gamma = p.gamma(10) """ if localNx<1: vg = -np.real( dD_dN( X,Y,gamma,localNz,localNx,dNz_dN,dNx_dN ) / dD_dw( X,Y,gamma,localNz,localNx ) ) a = np.real( dD_dr(X,Y,gamma,localNz,localNx,dNz_dr,dNx_dr,dX_dr,dY_dr,dgamma_dr) / dD_dw( X,Y,gamma,localNz,localNx ) ) A,B,C=get_ABC(X,Y,gamma,localNz,localNx) #print A*localNx**4 arr = np.array([vg,a]) """ dnz_dN=ri.dnz_dN(r,N) dnx_dN=ri.dnx_dN(r,N) dnz_dr=ri.dnz_dr(r,N) dnx_dr=ri.dnx_dr(r,N) dX_dr = p.dX_dr(r) dY_dr = mf.dY_dr(r) dgamma_dr = p.dgamma_dr(r) nz,nx=ri.nz(r,N),ri.nx(r,N) n = np.array([nz,nx]) if nx<1: a = np.real( dD_dr(X,Y,gamma,nz,nx,dnz_dr,dnx_dr,dX_dr,dY_dr,dgamma_dr) / dD_dw( X,Y,gamma,nz,nx ) ) else: a = np.real( ebw.dD_dr(X,Y,gamma,nz,nx,dnz_dr,dnx_dr,dX_dr,dY_dr,dgamma_dr) / ebw.dD_dw( X,Y,gamma,nz,nx ) ) return a