sw.output() for ends,name in zip([0,-1],['SOF','EOF']): inv.solve_slsqp(inv.swing['flux'][ends]) eq.run(update=False) sf.eqwrite(pf,config='SXex_{}'.format(name)) ''' rb.write_json(tf=shp.tf) loops.plot_variables(inv.Io, scale=1, postfix='MA') loops.plot_variables(inv.Lo, scale=1) sf.eqwrite(pf, config='SXex') pkl.write(data={'sf': sf, 'eq': eq, 'inv': inv}) # pickle data ''' eq.gen_opp() #rb.firstwall(calc=False,plot=True,debug=False) inv = INV(sf,eq,tf) Lpf = inv.grid_PF(nPF=5) Lcs = inv.grid_CS(nCS=3,Zbound=[-12,8],gap=0.1) Lo = np.append(Lpf,Lcs) inv.update_coils() inv.fit_PF(offset=0.3) # fit PF coils to TF inv.fix_boundary_psi(N=31,alpha=1-1e-4,factor=1) # add boundary points
tf = TF( Profile(config['TF'], family='S', part='TF', nTF=config['nTF'], obj='L', load=True)) tf.fill() eq = EQ(sf, pf, dCoil=1.0, sigma=0, n=1e4, boundary=sf.get_sep(expand=1.1), zmin=sf.Xpoint[1] - 2) eq.gen_opp() inv = INV(sf, eq, tf) #L = inv.grid_coils() Lpf = inv.grid_PF(nPF=config['nPF']) Lcs = inv.grid_CS(nCS=config['nCS'], Zbound=[-8, 8], gap=0.1, fdr=1) L = np.append(Lpf, Lcs) inv.update_coils() inv.fit_PF(offset=0.3) inv.fix_boundary_psi(N=25, alpha=1 - 1e-4, factor=1) # add boundary points inv.fix_boundary_feild(N=25, alpha=1 - 1e-4, factor=1) # add boundary points inv.add_null(factor=1, point=sf.Xpoint) inv.set_swing()