sns.set(context='paper', style='white', font='sans-serif', palette='Set2', font_scale=7 / 8, rc=rc) Color = cycle(sns.color_palette('Set2')) #pkl = PKL('moveSX_Dev3') nPF, nCS, nTF = 4, 3, 18 config = {'TF': 'dtt', 'eq': 'SN'} config['TF'] = '{}{}{:d}'.format(config['eq'], config['TF'], nTF) setup = Setup(config['eq']) sf = SF(setup.filename) 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)
pl.plot(tf.Rmid,tf.Zmid) ''' #setup = Setup('SN') #sf = SF(setup.filename) #eq = EQ(sf,pf,sigma=0.2,boundary=rb.get_fw(expand=0.25),n=7.5e4) #eq.plotj(trim=True) #pl.plot(sf.rbdry,sf.zbdry,color=0.75*np.ones(3),lw=1.5) for conf in ['SN', 'X', 'SFm', 'SX', 'SXex']: # print(conf) setup = Setup(conf) sf = SF(setup.filename) pf = PF(sf.eqdsk) rb = RB(setup, sf) rb.firstwall(calc=False, plot=True, debug=False) rb.vessel() pf.plot(coils=pf.coil, label=True, plasma=False, current=False) tf = TF(nTF=18, shape={ 'vessel': rb.loop, 'pf': pf, 'fit': False, 'setup': setup, 'plot': True, 'config': conf, 'coil_type': 'A' }) tf.fill()
inv.update_position(Lnorm, update_area=True) inv.optimize(Lnorm) #swing = SWING(inv,sf,plot=True) eq.run(update=False) sf.contour() pf.plot(subcoil=False, current=True, label=True) pf.plot(subcoil=True) 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']):
'lines.linewidth': 0.75 } sns.set(context='paper', style='white', font='sans-serif', palette='Set2', font_scale=7 / 8, rc=rc) Color = cycle(sns.color_palette('Set2')) nTF = 18 #,nPF,nCS = 18,6,5 config = {'TF': 'dtt', 'eq': 'SFp'} config, setup = select(config, nTF=nTF, update=False) # nPF=nPF,nCS=nCS sf = SF(setup.filename) rb = RB(setup, sf) pf = PF(sf.eqdsk) tf = TF( Profile(config['TF'], family='S', part='TF', nTF=nTF, obj='L', load=True)) rb.firstwall(symetric=True, DN=True, plot=True) #pf.plot(coils=pf.coil,label=False,plasma=False,current=True) tf.fill() #sf.cpasma *= 1.1 eq = EQ(sf, pf, dCoil=1.5, sigma=0, boundary=sf.get_sep(expand=1.1), n=3e3) eq.gen_bal() #eq.gen_opp() sf.contour() inv = INV(sf, eq, tf)
#ax[i][j].set_xlim([2.6000000000000001, 17.699999999999999]) #ax[i][j].set_ylim([-14.292150967273809, 9.0768966517738079]) ax[i][j].axis('off') title = ['SN', 'X', 'SF-', 'SF+', 'SX', 'SXex'] for j, config in enumerate(['SN', 'X', 'SFm', 'SFp', 'SX', 'SXex']): print('') print(config) pl.sca(ax[0][j]) pl.title(title[j]) Color = cycle(sns.color_palette('Set2')) setup = Setup(config) sf = SF(setup.filename) rb = RB(setup, sf) pf = PF(sf.eqdsk) eq = EQ(sf, pf, sigma=0.1, boundary=rb.get_fw(expand=0.25), n=5e4) #eq = EQ(sf,pf,sigma=0.1,boundary=rb.get_fw(expand=0.25),n=5e3) sf.contour(Nlevel=21, lw=0.5) pl.plot([14, 14], [-14.5, 9.5], 'o', alpha=0) pf.plot(coils=pf.coil, label=False, plasma=False, current=False) rb.firstwall(calc=False, plot=True, debug=False) rb.vessel() tf = TF(nTF=16, shape={ 'vessel': rb.loop, 'pf': pf,
Fbody = np.cross(J, b) # body force return Fbody if __name__ is '__main__': # test functions from nova.config import Setup from nova.streamfunction import SF from nova.elliptic import EQ from nova.coils import PF from nova.radial_build import RB setup = Setup('SN_3PF_18TF') sf = SF(setup.filename) pf = PF(sf.eqdsk) rb = RB(setup, sf) eq = EQ(sf, pf, dCoil=0.25, sigma=0, boundary=rb.get_fw(expand=0.25), n=1e3) eq.get_plasma_coil() #eq.gen_opp() ff = force_feild(pf.index, pf.coil, eq.coil, eq.plasma_coil) Fcoil = ff.get_force() ff.plot() pf.plot(coils=pf.coil, label=True, plasma=False, current=True) pf.plot(coils=eq.coil, label=False, plasma=True, current=False)
font_scale=7 / 8, rc=rc) nPF, nTF = 3, 18 config = {'TF': 'SN_dtt', 'eq': 'SN_{:d}PF_{:d}TF'.format(nPF, nTF)} config = {'TF': 'SN_dtt', 'eq': 'DEMO_SNb'} setup = Setup(config['eq']) sf = SF(setup.filename) pf = PF(sf.eqdsk) pf.plot(coils=pf.coil, label=True, plasma=False, current=True) levels = sf.contour() rb = RB(setup, sf) rb.firstwall(plot=False, debug=False) profile = Profile(config['TF'], family='S', part='TF', nTF=18, obj='L', load=True) shp = Shape(profile, obj='L', eqconf=config['eq'], load=True) # ,nTF=18 rvv, zvv = geom.rzSLine(rb.segment['vessel']['r'], rb.segment['vessel']['z'], 31) rvv, zvv = geom.offset(rvv, zvv, 0.2) rmin = np.min(rvv)
'lines.linewidth': 0.75 } sns.set(context='paper', style='white', font='sans-serif', palette='Set2', font_scale=7 / 8, rc=rc) Color = cycle(sns.color_palette('Set2')) #base = {'TF':'dtt','eq':'SN'} base = {'TF': 'dtt', 'eq': 'SN2014_EOF'} #config,setup = select(base={'TF':'dtt','eq':'SN2014_EOF'},nTF=18) config, setup = select(base=base, update=False, nTF=18, nPF=5, nCS=3) sf = SF(setup.filename) rb = RB(setup, sf) pf = PF(sf.eqdsk) 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),
else: raise ValueError('list machine type') mc = main_chamber(machine,date=date) mc.generate(eq_names,psi_n=1.07,flux_fit=True,plot=False,symetric=False) mc.load_data(plot=False) # load from file mc.shp.plot_bounds() config = {'TF':machine,'eq':eq_names[0]} config,setup = select(config,nTF=nTF,update=False) sf = SF(setup.filename) sf.contour() rb = RB(sf,setup) rb.generate(mc,plot=True,DN=False,debug=False) rb.get_sol(plot=True) #pl.plot(rb.segment['divertor']['r'],rb.segment['divertor']['z']) profile = Profile(config['TF'],family='S',part='TF',nTF=nTF,obj='L') shp = Shape(profile,eqconf=config['eq'],ny=3) shp.add_vessel(rb.segment['vessel_outer']) #shp.minimise(ripple=ripple,verbose=True) shp.tf.fill() ''' rb.write_json(tf=shp.tf)
'savefig.jpeg_quality':100,'savefig.pad_inches':0.1, 'lines.linewidth':0.75} sns.set(context='paper',style='white',font='sans-serif',palette='Set2', font_scale=7/8,rc=rc) nTF = 16 config = {'TF':'SN','eq':'DEMO_SNb'} profile = Profile(config['TF'],family='S',load=True,part='TF', nTF=nTF,obj='L',npoints=250) setup = Setup(config['eq']) sf = SF(setup.filename) tf = TF(profile,sf=sf) pf = PF(sf.eqdsk) rb = RB(setup,sf) cage = coil_cage(nTF=nTF,rc=tf.rc,plasma={'config':config['eq']},coil=tf.x['cl']) demo = DEMO() demo.fill_part('Vessel') demo.fill_part('Blanket') demo.fill_part('TF_Coil') demo.plot_ports() demo.plot_limiter() sf.contour(Nlevel=51,plot_vac=False,lw=0.5) pl.plot(sf.rbdry,sf.zbdry,color=0.75*np.ones(3),lw=1) r,z = demo.parts['Plasma']['out']['r'],demo.parts['Plasma']['out']['z'] rb.Rb,rb.Zb = geom.rzInterp(r,z)
'lines.linewidth': 1.5 } sns.set(context='talk', style='white', font='sans-serif', palette='Set2', font_scale=7 / 8, rc=rc) color = sns.color_palette('Set2', 5) config, setup = select(base={'TF': 'dtt', 'eq': 'DEMO_FW_SOF'}, nTF=18) sf = SF(setup.filename) pf = PF(sf.eqdsk) pf.plot(coils=pf.coil, label=True, plasma=False, current=True) levels = sf.contour(plot_vac=False) rb = RB(setup, sf) rb.firstwall(plot=True, debug=False, color=color[1]) rb.trim_sol() filename = trim_dir('../../Data/') + 'CATIA_FW.xlsx' wb = load_workbook(filename=filename, read_only=True, data_only=True) ws = wb[wb.get_sheet_names()[0]] FW = {} for col, var in zip([5, 6], ['r', 'z']): row = ws.columns[col] FW[var] = np.zeros(len(row) - 1) for i, r in enumerate(row[1:]): try: FW[var][i] = 1e-3 * float(r.value) # m except:
config,setup = select(base={'TF':'dtt','eq':'SFp'},nTF=18) sf = SF(setup.filename) pf = PF(sf.eqdsk) ''' eq = EQ(sf,pf,dCoil=1.5,sigma=0,boundary=sf.get_sep(expand=1.05), zmin=-8,rmin=5.5,n=1e4) eq.gen_opp() ''' #pf.plot(coils=pf.coil,label=True,plasma=False,current=True) sf.contour() rb = RB(setup,sf) rb.firstwall(symetric=False,DN=False,plot=True,debug=False) rb.trim_sol() pl.axis('equal') pl.axis([sf.Xpoint[0]-2,sf.Xpoint[0]+5.5,sf.Xpoint[1]-4,8]) #pl.axis([sf.Xpoint[0]-2.5,sf.Xpoint[0]+2.5,sf.Xpoint[1]-3,sf.Xpoint[1]+0.75]) #sf.get_Xpsi(select='upper') # upper X-point #rb.trim_sol() ''' nTF = config['nTF'] profile = Profile(config['TF'],family='S',part='TF', nTF=nTF,obj='L',load=False,symetric=True) shp = Shape(profile,nTF=nTF,obj='L',eqconf=config['eq'],ny=1)
font_scale=7 / 8, rc=rc) config = 'DEMO_SN' setup = Setup(config) sf = SF(setup.filename) sf.get_boundary(plot=True) config = 'DEMO_SNb' setup = Setup(config) sf = SF(setup.filename) sf.get_boundary(plot=True) pf = PF(sf.eqdsk) eq = EQ(sf, pf, limit=[4.5, 14.5, -8, 8], n=1e4) rb = RB(setup, sf) #sf.contour(plot_vac=True) #sf.get_legs(debug=True) rb.set_firstwall(sf.eqdsk['xlim'], sf.eqdsk['ylim']) pl.plot(rb.Rb, rb.Zb) sf.sol(dr=3e-3) rb.get_sol(plot=True) pl.plot(sf.eqdsk['xlim'], sf.eqdsk['ylim']) r = demo.parts['Vessel']['r'] # set vessel boundary z = demo.parts['Vessel']['z']