Beispiel #1
0
Acoil = Icoil / Jmax
dRcoil = np.sqrt(Acoil)
dRsteel = 0.15 * dRcoil

graze = 1.5 * np.pi / 180  # toroidal grazing angle
dPlate = 1.2  # target plate lenght
dCap = 0.1

flip = 1

with open('./plot_data/' + config + '_sol.pkl', 'rb') as input:
    sf = pickle.load(input)
    plot = pickle.load(input)
    geom = pickle.load(input)

rb = RB(geom, sf, config, Np=400, flip=flip)
plot.set_keys(['P6', 'P5', 'PS2', 'P6B', 'P5B', 'PS2',
               'PS5'])  # internal coils
plot.flip = flip

pl.figure(figsize=(14, 10))
pl.axis('equal')
pl.xlim([-15.5, 15.5]), pl.ylim([-15, 9])
#pl.xlim([6,9]),pl.ylim([-5,-3])
#pl.xlim([6,14]),pl.ylim([-10,-6])
#pl.xlim([2,17.5]),pl.ylim([-11,5])

rb.fill(dR=gap, dt=tfw, alpha=0.7, color='r', label='first wall')
rb.fill(dt=BB, alpha=0.7, color='b', label='blanket')
rb.fill(dt=tBBsupport, alpha=0.4, color='g', label='blanket support')
Beispiel #2
0
from radial_build import RB
from feild_calc import solCalc
import matplotlib
font = {'family': 'serif', 'serif': 'Arial', 'weight': 'normal', 'size': 16}
matplotlib.rc('font', **font)
fig_path = '../Figs/'

config = 'DD3'  # DD1/DD3

with open('./plot_data/' + config + '_sol.pkl', 'rb') as input:
    sf = pickle.load(input)
    plot = pickle.load(input)
    geom = pickle.load(input)

sol = solCalc(sf, geom, config)
rb = RB(geom, sf, config, Np=400)
divertor_coils = ['P6', 'P5', 'PS2', 'P6B', 'P5B', 'PS2', 'PS5']

for name in divertor_coils:
    geom.coil[name]['Fr'], geom.coil[name]['Fz'] = Fcoil(geom.coil, name)

fig = pl.figure(figsize=(10, 6))
plot = layout(geom)
plot.coil_keys = divertor_coils

#plot.sol()  # scrape-off layer
#plot.plates()  # divertor plates
#plot.TF()  # TF coil
#plot.FW()
#plot.plasma()
plot.coil_fill()
Beispiel #3
0
sns.set(context='talk',style='white',font='sans-serif',palette='Set2',
        font_scale=7/8,rc=rc)
color = sns.color_palette('Set2')
Color = cycle(color)

config = 'SX8'  # SN,X,SX,SX8,SFm,SX2

pl.figure(figsize=(10*14/16,10))
pl.axis('equal')
pl.axis('off')
#pl.ylim([-12.5,11])
#pl.xlim([7,8])

setup = Setup('SN')
sf = SF(setup.filename,sample=4,Nova=False)
rb = RB(setup,sf,Np=250)


#conf = Config(config)
#sf = SF(conf,sample=4,Nova=False)
sf.contour()
#eq = EQ(sf,sigma=0,limit=[5.5,12,-8,5],n=5e4)  # resample
#eq.plotj()

#
#conf.TF(sf)
#rb = RB(conf,sf,Np=250)

rb.firstwall(calc=True,plot=True,debug=False)
rb.trim_sol(plot=True)
Beispiel #4
0
Color = cycle(sns.color_palette('Set2', 3))

figheight = 8.0
mpl.rcParams['figure.figsize'] = [figheight, figheight * 5 / 9]
xlim, ylim = [8, 12], [-8, -7]

pl.figure()
pl.axis('equal')
pl.axis('off')
pl.xlim(xlim)
pl.ylim(ylim)

conf = Config('SX7')
sf = SF(conf, sample=1)
conf.TF(sf)
rb = RB(conf, sf, Np=1e3)
rb.divertor_outline(True, color=next(Color))
Rt, Zt = rb.targets['outer']['R'], rb.targets['outer']['Z']
Ro, Zo = rb.targets['outer']['Rsol'][-1], rb.targets['outer']['Zsol'][-1]
index = np.argmin((Rt - Ro)**2 + (Zt - Zo)**2)
R, Z = Rt[:index + 1], Zt[:index + 1]
graze = sf.get_graze([Ro, Zo], [R[-2] - R[-1], Z[-2] - Z[-1]])
print(graze * 180 / np.pi, rb.targets['outer']['theta'] * 180 / np.pi)

conf = Config('SX8')
sf = SF(conf, sample=1)
conf.TF(sf)
rb = RB(conf, sf, Np=1e3)
rb.divertor_outline(True, color=next(Color))
Rt, Zt = rb.targets['outer']['R'], rb.targets['outer']['Z']
Ro, Zo = rb.targets['outer']['Rsol'][-1], rb.targets['outer']['Zsol'][-1]
Beispiel #5
0
Acoil = Icoil / Jmax
dRcoil = np.sqrt(Acoil)
dRsteel = 0.15 * dRcoil

graze = 1.5 * np.pi / 180  # toroidal grazing angle
dPlate = 1.2  # target plate lenght
dCap = 0.1

flip = 1

with open('./plot_data/' + config + '_sol.pkl', 'rb') as input:
    sf = pickle.load(input)
    plot = pickle.load(input)
    geom = pickle.load(input)

rb = RB(geom, sf, config, Np=400, flip=flip)
plot.set_keys(['P6', 'P5', 'PS2', 'P6B', 'P5B', 'PS2',
               'PS5'])  # internal coils
plot.flip = flip

pl.figure(figsize=(10, 14))
pl.axis('equal')
#pl.xlim([-15.5,15.5]),pl.ylim([-15,9])
#pl.xlim([6,9]),pl.ylim([-5,-3])
#pl.xlim([6,14]),pl.ylim([-10,-6])
pl.xlim([2, 17.5]), pl.ylim([-11, 5])

rb.fill(dR=gap, dt=tfw, alpha=0.7, color='r', label='first wall')
rb.fill(dt=BB, alpha=0.7, color='b', label='blanket')
rb.fill(dt=tBBsupport, alpha=0.4, color='g', label='blanket support')
'''
Beispiel #6
0
    ax = pl.Subplot(fig, gd[i])
    fig.add_subplot(ax)
    fig.sca(ax)
    pl.axis('equal')
    pl.axis('off')
    pl.tight_layout()
    #pl.xlim([4,14]),pl.ylim([-13,8])
    pl.xlim([3, 17]), pl.ylim([-12, 10])

    conf = Config(config, inside=False)
    sf = SF(conf)
    sf.contour()
    sf.plot_coils(Color)
    conf.TF(sf)
    rb = RB(conf, sf, Np=200)
    rb.divertor_outline(True)
    rb.fill(dt=conf.tfw, alpha=0.7, color=next(Color))
    rb.fill(dt=conf.BB, alpha=0.7, color=next(Color))
    rb.fill(dt=conf.tBBsupport, alpha=0.7, color=next(Color))
    rb.BBsheild_fill(dt=conf.sheild,
                     ref_o=2 / 8 * np.pi,
                     alpha=0.7,
                     color=next(Color))
    rb.fill(dt=conf.VV, alpha=0.7, color=next(Color), loop=True)
    rb.set_TFbound()  # TF boundary conditions
    #rb.TFbound['ro_min'] -= 0.25
    #rb.plot_TFbounds()
    rb.TFopp(False, objF='L')  # L==length, V==volume
    rb.TFfill()
Beispiel #7
0
pl.figure()
pl.axis('equal')
pl.axis('off')

pkl = PKL('moveSX')
sf, eq, inv = pkl.fetch(['sf', 'eq', 'inv'])
sf.config = 'SXex'

inv.swing_fix(np.mean(inv.Swing))
inv.solve_slsqp()
eq.run(update=False)

conf = Config('SXex')
conf.TF(sf)
sf.conf = conf
rb = RB(conf, sf, Np=500)
rb.divertor_outline(False, plot=True, debug=False)
eq.grid(boundary={'R': rb.Rb, 'Z': rb.Zb}, n=5e3)
eq.set_sf_psi()  # set psi
eq.run()
sf.set_plasma({'r': eq.r, 'z': eq.z, 'psi': eq.psi}, contour=True)

inv.plot_fix()

sf.eqwrite()

sf = SF(conf, sample=1, Nova=True)
sf.contour(lw=0.5)

sf.plot_coils(next(Color),
              coils=sf.coil,
Beispiel #8
0
import seaborn as sns
rc = {'figure.figsize':[3.14*12/16,3.14],'savefig.dpi':400, #*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'))


pl.figure()
pl.axis('equal')
pl.axis('off')

conf = Config('X')
sf = SF(conf)
rb = RB(conf,sf,Np=150)
eq = EQ([4,12.5],[-9.5,6.5],5e4,sf)
sf.plasma_coils(N=11,dL=0.25)
eq.coils(delta=0.25)  # multi-filiment coils 

r,z = sf.get_boundary(alpha=0.95)
L = sf.length(r,z)
Lc = np.linspace(0,1,21)[:-1]

fix = {}
fix['r'],fix['z'] = interp1(L,r)(Lc),interp1(L,z)(Lc)
fix['value'] = eq.Pcoil(fix['r'],fix['z'])
fix['BC'] = np.array(['psi']*len(fix['r'])) 

rx,zx = 8.9,-8
Beispiel #9
0
    dR = np.diff(R)
    dZ = np.diff(Z)
    V = 0
    for r, dr, dz in zip(R[:-1], dR, dZ):
        V += (r + dr / 2)**2 * dz
    V *= np.pi
    return V


with open('./plot_data/' + config + '_sol.pkl', 'rb') as input:
    sf = pickle.load(input)
    plot = pickle.load(input)
    geom = pickle.load(input)

sol = solCalc(sf, geom, config)
rb = RB(geom, sf, config, Np=400)
#rb.internal_coils(['P6','P5','PS2','P6B','P5B','PS2','PS5'])

rb.TFopp(TFopp)
Rtf, Ztf, L = rb.drawTF(rb.xCoil, Nspace=300)
Rtf, Ztf = Rtf[::-1], Ztf[::-1]

imax = np.argmax(Ztf)
imin = np.argmin(Ztf)
Htf = np.max(Ztf) - np.min(Ztf)

pl.figure(figsize=(14, 10))

R, Z = Rtf[:imax + 1], Ztf[:imax + 1]
Vin = 2 * vol_calc(R, Z)
pl.plot(R, Z, 'k-')
Beispiel #10
0
}
sns.set(context='poster',
        style='white',
        font='sans-serif',
        palette='Set2',
        font_scale=1,
        rc=rc)
color = sns.color_palette('Set2')
from addtext import linelabel

from itertools import cycle
Color = cycle(sns.color_palette('Set2'))
from radial_build import RB
from eqConfig import Config
conf = Config('SXex')

pkl = PKL('moveSX')
sf, eq, inv = pkl.fetch(['sf', 'eq', 'inv'])
conf.TF(sf)
rb = RB(conf, sf, Np=500)

swing = 90
inv.swing_fix(swing)
inv.solve_slsqp()

#eq.grid(boundary={'R':rb.Rb,'Z':rb.Zb},n=5e3)
eq.set_sf_psi()  # set psi
eq.run(update=False)

print(np.sqrt(np.mean(dr_bndry**2)))
Beispiel #11
0
pl.ylim(zt + delta * np.array([-1, 1]))

pkl = PKL('moveSX')
sf, eq, inv = pkl.fetch(['sf', 'eq', 'inv'])
sf.config = 'SXex'

conf = Config('SXex')
sf.conf = conf
conf.TF(sf)

inv.swing_fix(-38)
inv.solve_slsqp()
eq.run(update=False)

sf.contour(lw=1)

#inv.rb.sol.plot()
#sf.sol()
#Rsol,Zsol = inv.rb.sol.legs('outer')

from eqConfig import Config
conf = Config('SXex')

conf.TF(sf)
sf.conf = conf

rb = RB(conf, sf, Np=100)
rb.divertor_outline(False, plot=True, debug=False)
rb.trim_sol(plot=True)

pl.savefig('../Figs/divertor_rad.png', dpi=300)
Beispiel #12
0
        rc=rc)
color = sns.color_palette('Set2', 8)
from addtext import linelabel
from elliptic import EQ
from itertools import cycle
Color = cycle(sns.color_palette('Set2', 8))
from radial_build import RB
from eqConfig import Config
conf = Config('SXex')

pkl = PKL('moveSX')
sf, eq, inv = pkl.fetch(['sf', 'eq', 'inv'])

sf.conf = conf
conf.TF(sf)
rb = RB(conf, sf, Np=100)
rb.divertor_outline(False, plot=False, debug=False)
eq.grid(boundary={'R': rb.Rb, 'Z': rb.Zb}, n=5e3)
eq.set_sf_psi()  # set psi
eq.gen()

fig, ax = pl.subplots()
nr, nz = 1, 3
N = nr * nz
pl.subplots_adjust(wspace=0, hspace=0)

Swing = np.linspace(np.max(inv.Swing), np.min(inv.Swing), N)  #-10
Swing_label = ['SOF', 'MOF', 'EOF']
for i, swing in enumerate(Swing):
    Color = cycle(sns.color_palette('Set2'))
    pl.tight_layout()
Beispiel #13
0
sns.set(context='paper',
        style='white',
        font='serif',
        palette='Set2',
        font_scale=7 / 8,
        rc=rc)

pl.figure()
pl.axis('equal')

config = 'SN'  # SN,X,SX,SF,SX2

conf = Config(config, inside=False)
sf = SF(conf, sample=2)
sf.contour()
rb = RB(conf, sf, Np=90)
rb.sf.sol(plot=False)

radius, theta = np.array([]), np.array([])
for N in range(rb.sf.Nsol):
    #pl.plot(rb.sf.Rsol[N],rb.sf.Zsol[N])
    pl.plot(sf.Xpoint[0], sf.Xpoint[1], 'o', markersize=1)

c = sns.color_palette('Set2', 4)
if rb.sf.nleg == 6:  # snow flake
    leglist = ['inner1', 'inner2', 'outer1', 'outer2']
else:
    leglist = ['inner', 'outer']
for N in range(rb.sf.Nsol):
    for i, leg in enumerate(leglist):
        pl.plot(rb.sf.legs[leg]['R'][N], rb.sf.legs[leg]['Z'][N], color=c[i])
Beispiel #14
0
sf = SF(conf)
'''
zcs_space = np.linspace(6,-8,13)
rcs_space = 2.9*np.ones(len(zcs_space))
pl.plot(rcs_space,zcs_space,'-o',markersize=1.5)

for i in range(5):
    del sf.coil['Coil{:1.0f}'.format(i)]    
   
for i in range(len(zcs_space)):
    name = 'Coilcs{:1.0f}'.format(i)
    sf.coil[name] = {'r':rcs_space[i],'z':zcs_space[i],'dr':1,
                     'dz':abs(np.diff(zcs_space))[0],'I':1}
'''    
   
rb = RB(conf,sf,Np=150)
eq = EQ([4,15.5],[-12,6.5],5e4,sf)
eq.get_plasma_coil()
#sf.plasma_coils(N=11,dL=0.25)
eq.coils(delta=0.25)  # multi-filiment coils 

r,z = sf.get_boundary(alpha=0.99)
L = sf.length(r,z)
Lc = np.linspace(0,1,1)[:-1]

fix = {}
fix['r'],fix['z'] = interp1(L,r)(Lc),interp1(L,z)(Lc)
fix['value'] = eq.psi_coil(fix['r'],fix['z'])
fix['BC'] = np.array(['psi']*len(fix['r'])) 
'''
r,z = sf.get_boundary(alpha=0.45)
Beispiel #15
0
sns.set(context='talk',
        style='white',
        font='sans-serif',
        palette='Set2',
        font_scale=7 / 8,
        rc=rc)

pl.figure()
text = linelabel(Ndiv=42, value=' 1.0f', postfix='m', loc='end')

for config in ['SN', 'SFp', 'SFm']:  #,'SFm','SFp','X','SX8','SXex']: #
    color = next(Color)
    conf = Config(config)
    sf = SF(conf, sample=1)

    rb = RB(conf, sf, Np=250)
    rb.divertor_outline(False, plot=False, debug=False)
    '''
    sf.eq['ncoil'] = 0
    eq = EQ(sf,boundary={'R':rb.Rb,'Z':rb.Zb,'expand':0.5},n=1e4)  #'expand':0.5,'zmax':sf.Xpoint[1]+sf.rcirc+sf.drcirc}
   
    if 'ex' not in config: 
        eq.run()
    eq.set_eq_psi() 
    '''
    sf.sol(Nsol=21, update=True, plot=False)
    rb.trim_sol(plot=False)  # trim legs to targets
    sf.add_core()  # referance low field midplane
    '''
    for i in range(sf.Nsol):
        pl.plot(sf.legs['outer1']['R'][i],sf.legs['outer1']['Z'][i],'k--',alpha=0.15)
Beispiel #16
0
}
sns.set(context='paper',
        style='white',
        font='sans-serif',
        palette='Set2',
        font_scale=7 / 8,
        rc=rc)
Color = cycle(sns.color_palette('Set2'))
pl.figure()
pl.axis('equal')
pl.axis('off')

conf = Config('SN')
sf = SF(conf)
conf.TF(sf)
rb = RB(conf, sf, Np=500)

a = (sf.LFPr - sf.HFPr) / 2
R = (sf.LFPr + sf.HFPr) / 2
AR = R / a
r95, z95 = sf.get_boundary(alpha=0.95)

ru = r95[np.argmax(z95)]  # triangularity
rl = r95[np.argmin(z95)]
del_u = (R - ru) / a
del_l = (R - rl) / a
kappa = (np.max(z95) - np.min(z95)) / (2 * a)

pl.plot(sf.Mpoint[0], sf.Mpoint[1], 'o')
pl.plot(sf.LFPr, sf.LFPz, 'o')
pl.plot(sf.HFPr, sf.HFPz, 'o')
Beispiel #17
0
inv.plot_fix()



#inv.rb.sol.plot()
#sf.sol()
#Rsol,Zsol = inv.rb.sol.legs('outer')

from eqConfig import Config
conf = Config('SXex')

conf.TF(sf)
sf.conf = conf


rb = RB(conf,sf,Np=100)
'''
rb.divertor_outline(False,plot=True,debug=False)
#rb.trim_sol(plot=True)

#R,Z = rb.inloop(rb.Rb[::-1],rb.Zb[::-1],
#                sf.legs['outer']['R'][0],sf.legs['outer']['Z'][0])                                 
#print('Rex',sf.legs['outer']['R'][0][-1]/sf.Xpoint[0])

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,