from itertools import cycle import numpy as np from nova.radial_build import RB from nova.shelf import PKL from nova.coils import PF, TF from nova import loops from nova.loops import Profile from nova.inverse import SWING from nova.firstwall import main_chamber from nova.shape import Shape import seaborn as sns sns.set(context='talk', style='white', font='sans-serif', font_scale=7 / 8) Color = cycle(sns.color_palette('Set2')) pkl = PKL('SXdev', directory='../../Movies/') name = 'SX' nTF, ripple = 18, True base = {'TF': 'dtt', 'eq': 'DTT_SN', 'name': name} config, setup = select(base, nTF=nTF, update=False) sf = SF(setup.filename) pf = PF(sf.eqdsk) for coil in pf.index['CS']['name']: pf.coil[coil]['r'] = 2.7 pf.coil[coil]['dr'] = 0.8 profile = Profile(config['TF'], family='S', part='TF', nTF=nTF, obj='L')
font_scale=1,rc=rc) color = sns.color_palette('Set2') from amigo.addtext import linelabel from itertools import cycle Color = cycle(sns.color_palette('Set2')) from nova.radial_build import RB #tf = TF('DEMO_SN',coil_type='S',nTF=16,objective='L') #from eqConfig import Config #conf = Config('SXex') #pkl = PKL('DEMO_SN54') #sf,eq,inv = pkl.fetch(['sf','eq','inv']) config = 'SXdtt_18TF_5PF_3CS' pkl = PKL(config,directory='../../Movies/') sf,eq,inv = pkl.fetch(['sf','eq','inv']) #sf.conf = conf #conf.TF(sf) fig,ax = pl.subplots(figsize=(10,5)) ax1 = pl.subplot2grid((2,4),(0,0),rowspan=2,colspan=2) ax2 = pl.subplot2grid((2,4),(0,2),colspan=3) ax3 = pl.subplot2grid((2,4),(1,2),colspan=3) #cont = ax.contour(sf.r,sf.z,sf.psi.T,25) #pl.sca(ax2)
import nova.cross_coil as cc from nova.coils import PF,TF from time import time from nova import loops from DEMOxlsx import DEMO from nova.loops import Profile import seaborn as sns rc = {'figure.figsize':[7*10/16,7],'savefig.dpi':150, #*12/16 '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) Color = cycle(sns.color_palette('Set2')) pkl = PKL('DEMO_SN54') nTF = 16 config = {'TF':'SN','eq':'DEMO_SN'} setup = Setup(config['eq']) 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)) eq = EQ(sf,pf,dCoil=2.0,sigma=0,boundary=sf.get_sep(expand=1.5),n=1e4) eq.gen_opp() inv = INV(sf,eq,tf)
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
ar = 0.75 # figure aspect rc = { 'figure.figsize': [8 / ar, 8], 'savefig.dpi': 150, #*12/16 'savefig.jpeg_quality': 100, 'savefig.pad_inches': 0.1, 'lines.linewidth': 1 } sns.set(context='paper', style='white', font='sans-serif', palette='Set2', font_scale=1.5, rc=rc) config = 'SFm' pkl = PKL(config) sf, eq, inv = pkl.fetch(['sf', 'eq', 'inv']) inv.set_swing(array=np.linspace(-0.5, 0.5, 10)) inv.swing_flux() inv.solve_slsqp() pl.plot(2 * np.pi * inv.swing['flux'], 1e3 * inv.swing['rms']) pl.figure() config = 'SFm' setup = Setup(config) rb = RB(setup, sf) rb.firstwall(calc=False, plot=True, debug=False) profile = Profile(config, family='S', part='TF', nTF=18, objective='L') tf = TF(profile)