예제 #1
0
 def get_seperatrix(self, nplasma=80, alpha=1 - 1e-4, plot=False, **kwargs):
     self.nplasma = nplasma
     self.plasma_loop = np.zeros((self.nplasma, 3))  # initalise loop array
     if 'sf' in kwargs or 'setup' in kwargs or 'config' in kwargs:
         if 'sf' in kwargs:  # seperatrix directly from sf object
             sf = kwargs['sf']
         elif 'setup' in kwargs:
             setup = kwargs.get('setup')
             sf = SF(setup.filename)
         elif 'config' in kwargs:
             setup = Setup(kwargs.get('config'))
             sf = SF(setup.filename)
         r, z = sf.get_boundary(alpha=alpha)
         self.eqdsk = sf.eqdsk
         self.LFP = np.array([sf.LFPr, sf.LFPz])
     else:
         if 'eqdsk' in kwargs:  # seperatrix from eqdsk
             self.eqdsk = geqdsk.read(kwargs.get('eqdsk'))
             r, z = self.eqdsk['rbdry'], self.eqdsk['zbdry']
         elif 'r' in kwargs and 'z' in kwargs:  # separatrix from input
             r, z = kwargs.get('r'), kwargs.get('z')
             self.eqdsk = {
                 'rcentr': 9.0735,
                 'zmagx': 0.15295,
                 'bcentr': -5.6211
             }
         LFindex = np.argmax(r)
         self.LFP = np.array([r[LFindex], z[LFindex]])
     if not hasattr(self, 'eqdsk'):
         errtxt = '\n'
         errtxt += 'Require plasma={} input of following types:\n'
         errtxt += '1) configuration flag, {\'config\':\'SN\'} \n'
         errtxt += '2) eqdsk file, {\'eqdsk\':\'\'} \n'
         errtxt += '3) seperatrix profile, {\'r\':[],\'z\':[]}'
         raise ValueError(errtxt)
     r, z = geom.clock(r, z)
     (self.plasma_loop[:,0],self.plasma_loop[:,2]) = \
     geom.rzSLine(r,z,npoints=self.nplasma)
     self.plasma_length = geom.length(self.plasma_loop[:, 0],
                                      self.plasma_loop[:, 2])
     rfun, zfun = geom.rzfun(r, z)
     self.plasma_interp = {'r': rfun, 'z': zfun}
     if plot:
         pl.plot(self.plasma_loop[:, 0], self.plasma_loop[:, 2])
예제 #2
0
파일: ripple.py 프로젝트: tokasamwin/Nova
 def get_boundary(filename, alpha=1e-3):
     sf = SF(filename)
     r, z = sf.get_boundary(alpha=alpha)
     return r, z
예제 #3
0
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')
예제 #4
0
        'savefig.dpi': 120,  # 
        '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)

    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)