def inductance(self, dCoil=0.5, Iscale=1): pf = deepcopy(self) inv = INV(pf, Iscale=Iscale, dCoil=dCoil) Nf = np.array([ 1 / inv.coil['active'][coil]['Nf'] for coil in inv.coil['active'] ]) for i, coil in enumerate(inv.adjust_coils): r, z = inv.pf.coil[coil]['r'], inv.pf.coil[coil]['z'] inv.add_psi(1, point=(r, z)) inv.set_foreground() fillaments = np.dot(np.ones((len(Nf), 1)), Nf.reshape(1, -1)) self.M = 2 * np.pi * inv.G * fillaments # PF/CS inductance matrix
rb = RB(setup, sf) pf = PF(sf.eqdsk) profile = Profile(config['TF'], family='S', part='TF', nTF=nTF, obj='L', load=True) tf = TF(profile, sf=sf) eq = EQ(sf, pf, dCoil=2.0, limit=[5.2, 13, -6.5, 6], n=5e3) # eq.get_plasma_coil() eq.run(update=False) inv = INV(sf, eq, tf) Lpf = inv.grid_PF(nPF=nPF) Lcs = inv.grid_CS(nCS=nCS, Zbound=[-12, 8], gap=0.1) Lo = np.append(Lpf, Lcs) inv.update_coils() inv.fit_PF(offset=0.3) ''' inv.fix_boundary_psi(N=31,alpha=1-1e-4,factor=1) # add boundary points inv.fix_boundary_feild(N=31,alpha=1-1e-4,factor=1) # add boundary points inv.add_null(factor=3,point=sf.Xpoint) Rex,arg = 1.5,40 R = sf.Xpoint[0]*(Rex-1)/np.sin(arg*np.pi/180) target = (R,arg) inv.add_alpha(1,factor=1,polar=target) # 20 inv.add_B(0,[-15],factor=1,polar=target) # -30 '''
pf.coil[coil]['dr'] = 0.8 profile = Profile(config['TF'], family='S', part='TF', nTF=nTF, obj='L') tf = TF(profile=profile, sf=sf) #tf.adjust_xo('dz',value=-2) #tf.fill() eq = EQ(sf, pf, dCoil=2.0, sigma=0, boundary=sf.get_sep(expand=1.0), zmin=-10, n=2e3) inv = INV(pf, tf, dCoil=0.25) inv.load_equlibrium(sf) inv.fix_boundary() inv.fix_target() inv.plot_fix(tails=True) inv.add_plasma() Lnorm = inv.snap_coils() ''' Lpf = inv.grid_PF(nPF=4) Lcs = inv.grid_CS(nCS=5,Zbound=[-10,8],gap=0.1,Ro=2.7,dr=0.8) L = np.append(Lpf,Lcs) inv.set_Lo(L) # set position bounds Lnorm = loops.normalize_variables(inv.Lo) '''