inv.ff.plot() mc = main_chamber('dtt', date='2017_03_08') mc.load_data(plot=True) # load from file mc.shp.plot_bounds() rb = RB(sf, Setup(name)) rb.generate(mc, debug=False) #profile = Profile(config['TF'],family='S',part='TF',nTF=nTF,obj='L') shp = Shape(tf.profile, eqconf=config['eq_base'], ny=3) shp.add_vessel(rb.segment['vessel_outer']) #shp.minimise(ripple=ripple,verbose=True) shp.tf.fill() sf.eqwrite(sf, config='SXex') ''' inv.Lnorm = Lnorm sw = SWING(inv,sf) sw.flat_top() 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')
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() inv.update_limits(LCS=[-11.5, 10.5]) L = inv.optimize(L) #inv.plot_fix(tails=True) inv.fix_flux(inv.swing['flux'][1]) inv.solve_slsqp() eq.gen_opp() sf.contour(boundary=True, plot_vac=False) pf.plot(coils=pf.coil, label=True, plasma=False, current=True) rb.firstwall(mode='calc', plot=True, debug=False) rb.trim_sol() #loops.plot_variables(inv.Io,scale=1,postfix='MA') #loops.plot_variables(inv.Lo,scale=1) sf.eqwrite(pf, config=config['eq']) pkl = PKL(config['eq'], directory='../../Movies/') pkl.write(data={'sf': sf, 'eq': eq, 'inv': inv}) # pickle data
nTF=nTF,obj='L',load=False,symetric=True) shp = Shape(profile,nTF=nTF,obj='L',eqconf=config['eq'],ny=1) shp.add_vessel(rb.segment['vessel_outer']) shp.loop.adjust_xo('l',lb=0.75) # 1/tesion shp.loop.adjust_xo('lower',lb=0.5) shp.minimise(ripple=False,verbose=True) shp.update() tf = TF(profile,sf=sf) tf.fill() ''' pl.tight_layout() ''' sf.eqwrite(pf,config=config['eq'],CREATE=True) pkl = PKL(config['eq'],directory='../../Movies/') sf,eq,inv = pkl.fetch(['sf','eq','inv']) for i,(flux,S) in enumerate(zip(inv.swing['flux'],['SOF','MOF','EOF'])): inv.fix_flux(flux) # swing inv.solve_slsqp() inv.eq.gen_opp() sf.eqwrite(inv.eq.pf,config=config['eq']+'_{}'.format(S),CREATE=True) data = {} for loop in ['first_wall','blanket','vessel_inner','vessel_outer']: data[loop] = {} for var in rb.segment[loop]:
eq.gen_opp() #eq.get_Vcoil() #eq.gen(ztarget=zref) sf.contour(boundary=False, plot_vac=True) pf.plot(coils=pf.coil, label=True, plasma=True, current=True) #inv.plot_fix(tails=True) rb.firstwall(mode='calc', plot=True, debug=False) rb.trim_sol() tf.fill() loops.plot_variables(inv.Io, scale=1, postfix='MA') loops.plot_variables(inv.Lo, scale=1) sf.eqwrite(pf, config=config['TF'] + '_{:d}PF_{:d}CS'.format(inv.nPF, inv.nCS), CREATE=True) #pkl = PKL('SF',directory='../../Movies/') #pkl.write(data={'sf':sf,'eq':eq,'inv':inv}) # pickle data ''' inv.fix_flux(inv.swing['flux'][1]) inv.solve_slsqp() #eq.run() eq.gen_opp() pf.plot(coils=inv.eq.pf.coil,label=True,plasma=True,current=True) tf.fill() sf.contour(boundary=False) pl.plot(sf.Xpoint[0],sf.Xpoint[1],'d') inv.plot_fix(tails=True)
inv.plot_fix(tails=True) tf.fill() demo = DEMO() demo.fill_part('Vessel') demo.fill_part('Blanket') pl.plot(demo.limiter['L3']['r'],demo.limiter['L3']['z']) pl.axis('equal') pl.tight_layout() loops.plot_variables(inv.Io,scale=1,postfix='MA') loops.plot_variables(inv.Lo,scale=1) pkl.write(data={'sf':sf,'eq':eq,'inv':inv}) # pickle data sf.eqwrite(pf,config=config['TF']+'_{:d}PF_{:d}TF'.format(inv.nPF,nTF)) ''' #inv.write_swing() #sf.eqwrite(config='SXex') for swing in np.linspace(-20,80,5): pl.figure() pl.axis('equal') pl.axis('off') inv.swing_fix(swing) inv.solve() inv.update_coils(plot=True)