def __init__(self,profile,eqconf='unset',sep='unset',**kwargs): self.ny = kwargs.get('ny',3) # TF filament number (y-dir) self.alpha = kwargs.get('alpha',1-1e-4) self.color = cycle(sns.color_palette('Set2',10)) self.profile = profile self.loop = self.profile.loop self.bound = {} # initalise bounds self.bindex = {'internal':[0],'interior':[0],'external':[0]} # index for side in ['internal','interior','external']: self.bound[side] = {'r':[],'z':[]} if side in kwargs: self.add_bound(kwargs[side],side) if self.profile.nTF is not 'unset' and \ (eqconf is not 'unset' or sep is not 'unset'): if eqconf is not 'unset': plasma = {'config':eqconf} sf = SF(Setup(eqconf).filename) self.tf = TF(profile=self.profile,sf=sf) else: plasma = {'r':sep['r'],'z':sep['z']} self.tf = TF(profile=self.profile) self.cage = coil_cage(nTF=self.profile.nTF,rc=self.tf.rc, plasma=plasma,ny=self.ny,alpha=self.alpha) x = self.tf.get_loops(self.loop.draw()) self.cage.set_TFcoil(x['cl'],smooth=False) else: if self.profile.obj is 'E': errtxt = 'nTF and SFconfig keywords not set\n' errtxt += 'unable to calculate stored energy\n' errtxt += 'initalise with \'nTF\' keyword' raise ValueError(errtxt)
def __init__(self, config, family='S', nTF=16, obj='L'): self.nTF = nTF self.config = config datadir = trim_dir('../../Data') file = 'salome_input' # config # +'_{}{}{}'.format(family,nTF,obj) self.filename = datadir + '/' + file + '.json' self.profile = Profile(config['TF'], family=family, load=True, part='TF', nTF=nTF, obj=obj, npoints=250) setup = Setup(config['eq']) self.sf = SF(setup.filename) self.tf = TF(self.profile, sf=self.sf) self.pf = PF(self.sf.eqdsk) self.PF_support() # calculate PF support seats self.CS_support() # calculate CS support seats self.Gravity_support() self.cage = coil_cage(nTF=nTF, rc=self.tf.rc, ny=3, plasma={'config': config['eq']}, coil=self.tf.x['cl']) self.eq = EQ(self.sf, self.pf, dCoil=0.5, sigma=0, boundary=self.sf.get_sep(expand=0.5), n=1e3) self.eq.plasma() self.ff = force_feild(self.pf.index, self.pf.coil, self.eq.coil, self.eq.plasma_coil)
def add_tf_load(self, config, ff, tf, Bpoint, parts=['loop', 'nose'], method='function'): cage = coil_cage(nTF=tf.profile.nTF, rc=tf.rc, plasma={'config': config}, coil=tf.x['cl']) self.update_rotation() # check / update rotation matrix for part in parts: for el in self.part[part]['el']: n = self.el['n'][el] # node index pair point = np.mean(self.X[n, :], axis=0) # load at element mid-point w = ff.topple(point, self.el['dx'][el], cage, Bpoint, method=method)[0] # body force self.add_load(el=el, W=w) # bursting/toppling load
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) rb.trim_sol()