def plot_curvature(self): pl.figure(figsize=([4, 3 * 12 / 16])) text = linelabel(value='', postfix='', Ndiv=5) part = self.part # ['loop','nose'] # for i, (part, c) in enumerate(zip(part, color)): pl.plot(self.part[part]['l'], self.part[part]['d2u'][:, 2], '--', color=c) pl.plot(self.part[part]['l'], self.part[part]['d2u'][:, 1], color=c) text.add(part) text.plot() sns.despine() pl.xlabel('part length') pl.ylabel('part curvature')
Fcs = np.zeros((nSwing,2)) for j,swing in enumerate(Swing): inv.swing_fix(swing) inv.solve_slsqp() print(inv.Fsep*1e-6) for i,name in enumerate(inv.PF_coils): F[i,j,0] = inv.coil['active'][name]['Fr_sum'] F[i,j,1] = inv.coil['active'][name]['Fz_sum'] I[i,j] = inv.coil['active'][name]['I_sum'] Fcs[j,0] = inv.Fsep Fcs[j,1] = inv.FzCS pl.sca(ax[0]) text = linelabel(Ndiv=12,value='',postfix='') for i,name in enumerate(inv.PF_coils): pl.plot(-2*np.pi*(Swing-Swing[0]),abs(F[i,:,1])*1e-6) text.add(name) #pl.plot(-2*np.pi*(swing*np.ones(2)-Swing[0]),[0,450],'k--',alpha=0.25) Fcs[:,0][Fcs[:,0]<0] = 0 # no limit on compression load pl.plot(-2*np.pi*(Swing-Swing[0]),Fcs[:,0]*1e-6) text.add('Fsep') pl.plot(-2*np.pi*(Swing-Swing[0]),abs(Fcs[:,1])*1e-6) text.add('FzCS') pl.ylabel(r'$|Fz|$ MN') pl.xlabel(r'Swing Wb') pl.ylim([0,450]) pl.tight_layout() #pl.xlabel(r'Swing Wb') sns.despine()
import numpy as np import pylab as pl import scipy.optimize as op from amigo.surface import bernstein from amigo.addtext import linelabel from amigo import geom from nova.beam import Dcoil from nova.beam.finite_element import FE text = linelabel(value='', postfix='', Ndiv=10) import seaborn as sns rc = { 'figure.figsize': [8, 8 * 10 / 16], 'savefig.dpi': 160, # 'savefig.jpeg_quality': 100, 'savefig.pad_inches': 0.1, 'lines.linewidth': 2 } sns.set(context='talk', style='white', font='sans-serif', palette='Set2', font_scale=7 / 8, rc=rc) def Dshape(x, r1=4.486, r2=15.708, npoints=120): #zscale = x[0] b = x[1:] b = np.append(np.append(0, b), 0) # zero offset #b = np.append(np.append(0,b),0) # zero gradient rd, zd = Dcoil.pD(r1, r2, npoints=npoints) # referance D-coil
from nova.loops import Profile from nova.shape import Shape from amigo.addtext import linelabel import pylab as pl from nova.TF.DEMOxlsx import DEMO from nova.streamfunction import SF from nova.config import Setup import seaborn as sns rc = {'figure.figsize':[10*1.1,10],'savefig.dpi':100, #*12/16 'savefig.jpeg_quality':100,'savefig.pad_inches':0, 'lines.linewidth':0.75} sns.set(context='talk',style='white',font='sans-serif',palette='Set2', font_scale=1.5,rc=rc) text = linelabel(Ndiv=30,value='',loc='end') demo = DEMO() demo.fill_part('Blanket') demo.fill_part('Vessel') config = {'TF':'dtt','eq':'SN'} setup = Setup(config['eq']) sf = SF(setup.filename) #sf.contour(plot_vac=False) pl.plot(np.append(sf.rbdry,sf.rbdry[0]), np.append(sf.zbdry,sf.zbdry[0]), color=0.75*np.ones(3),lw=2) NTF = np.arange(13,19)[::-1] #13, pl.plot([3,23],[-10,9],'ko',alpha=1)
def animate(swing): #,data,ax Color = cycle(sns.color_palette('Set2')) pl.sca(ax1) ax1.cla() #ax1.set_axis_off() ax.set_ylim([3,14]) #pl.axis('equal') inv.fix_flux(swing) inv.solve_slsqp() print(inv.I[-3]) pl.plot(sf.rbdry,sf.zbdry) #tf.fill() #print(swing,sf.Xpsi,sf.Mpoint[1],inv.rms) #B = eq.Bfeild([inv.fix['r'][-1],inv.fix['z'][-1]]) #arg = 180*np.arctan2(B[1],B[0])/np.pi #print('swing {:1.0f} arg {:1.2f} rms {:1.3f}'.format(swing,arg,inv.rms)) eq.run(update=False) #sf.sol(plot=True) #inv.eq.pf.plot(coils=inv.eq.pf.coil,label=False,plasma=False,current=False) #inv.plot_force() #eq.plasma(sep=False) #eq.plotb() sf.contour(levels=np.linspace(-150,150,60),Xnorm=False) #rb.divertor_outline(False,plot=True,debug=False) ''' with open('./plot_data/'+rb.conf.config+'_FW.pkl', 'rb') as input: rb.targets = pickle.load(input) rb.Rb = pickle.load(input) rb.Zb = pickle.load(input) rb.Rb,rb.Zb = rb.midplane_loop(rb.Rb,rb.Zb) # clockwise LFS pl.plot(rb.Rb,rb.Zb,'-',color='k',alpha=0.75,linewidth=1.25) rb.FWfill(dt=conf.tfw,loop=True,alpha=0.7,color=next(Color),s=2e-3) rb.fill(dt=conf.BB[::-1],alpha=0.7,ref_o=0.3,dref=0.2, referance='length',color=next(Color)) rb.fill(dt=conf.tBBsupport,alpha=0.7,color=next(Color)) rb.BBsheild_fill(dt=conf.sheild,ref_o=0.35*np.pi,dref=0.2*np.pi,offset=1/10*np.pi, alpha=0.7,color=next(Color)) rb.VVfill(dt=conf.VV,ref_o=0.25*np.pi,dref=0.25*np.pi,offset=0.5/10*np.pi, alpha=0.7,loop=True,color=next(Color)) # ref_o=0.385 rb.TFopp(False,objF=conf.TFopp) # L==length, V==volume rb.TFfill() ''' #pl.tight_layout() pl.sca(ax2) ax2.cla() text = linelabel(Ndiv=10,value='',postfix='') for i,name in enumerate(inv.PF_coils): pl.plot(-2*np.pi*(Swing-Swing[0]),abs(F[i,:,1])) text.add(name) pl.plot(-2*np.pi*(swing*np.ones(2)-Swing[0]),[0,450],'k--',alpha=0.25) pl.plot(-2*np.pi*(Swing-Swing[0]),Fcs[:,0]) text.add('Fsep') pl.plot(-2*np.pi*(Swing-Swing[0]),abs(Fcs[:,1])) text.add('FzCS') pl.ylabel(r'$|Fz|$ MN') pl.ylim([0,450]) pl.tight_layout() #pl.xlabel(r'Swing Wb') sns.despine() text.plot() #pl.tight_layout() pl.sca(ax3) ax3.cla() text = linelabel(Ndiv=10,value='',postfix='') for i,name in enumerate(inv.PF_coils): pl.plot(-2*np.pi*(Swing-Swing[0]),abs(I[i,:])*1e-6) text.add(name) pl.plot(-2*np.pi*(swing*np.ones(2)-Swing[0]),[0,22],'k--',alpha=0.25) pl.ylabel(r'$|I|$ MA') pl.xlabel(r'Swing Wb') pl.tight_layout() sns.despine() text.plot()
import seaborn as sns rc = { 'figure.figsize': [7 * 10 / 16, 7], 'savefig.dpi': 250, #*12/16 'savefig.jpeg_quality': 100, 'savefig.pad_inches': 0.1, 'lines.linewidth': 1 } sns.set(context='poster', style='white', font='sans-serif', palette='Set2', font_scale=0.75, rc=rc) Color = cycle(sns.color_palette('Set2')) text = linelabel(Ndiv=20, value='') nTF = 18 for eq in ['DEMO_SN_SOF', 'DEMO_SN_EOF']: config = {'TF': 'demo', 'eq': eq} config, setup = select(config, nTF=nTF, update=False) sf = SF(setup.filename) sf.get_boundary(plot=True, alpha=1 - 1e-5) text.add(eq) sf.sol(plot=True) text.plot() pl.axis('equal') pl.axis('off')