Exemple #1
0
 def inductance(self, dCoil=0.5, Iscale=1):
     pf = deepcopy(self)
     inv = INV(pf, Iscale=Iscale, dCoil=dCoil)
     Nf = np.array([
         1 / inv.coil['active'][coil]['Nf'] for coil in inv.coil['active']
     ])
     for i, coil in enumerate(inv.adjust_coils):
         r, z = inv.pf.coil[coil]['r'], inv.pf.coil[coil]['z']
         inv.add_psi(1, point=(r, z))
     inv.set_foreground()
     fillaments = np.dot(np.ones((len(Nf), 1)), Nf.reshape(1, -1))
     self.M = 2 * np.pi * inv.G * fillaments  # PF/CS inductance matrix
Exemple #2
0
rb = RB(setup, sf)
pf = PF(sf.eqdsk)

profile = Profile(config['TF'],
                  family='S',
                  part='TF',
                  nTF=nTF,
                  obj='L',
                  load=True)

tf = TF(profile, sf=sf)
eq = EQ(sf, pf, dCoil=2.0, limit=[5.2, 13, -6.5, 6], n=5e3)  #
eq.get_plasma_coil()
eq.run(update=False)

inv = INV(sf, eq, tf)
Lpf = inv.grid_PF(nPF=nPF)
Lcs = inv.grid_CS(nCS=nCS, Zbound=[-12, 8], gap=0.1)
Lo = np.append(Lpf, Lcs)
inv.update_coils()
inv.fit_PF(offset=0.3)
'''
inv.fix_boundary_psi(N=31,alpha=1-1e-4,factor=1)  # add boundary points
inv.fix_boundary_feild(N=31,alpha=1-1e-4,factor=1)  # add boundary points
inv.add_null(factor=3,point=sf.Xpoint)
Rex,arg = 1.5,40
R = sf.Xpoint[0]*(Rex-1)/np.sin(arg*np.pi/180)
target = (R,arg)
inv.add_alpha(1,factor=1,polar=target)  # 20
inv.add_B(0,[-15],factor=1,polar=target)  # -30
'''
Exemple #3
0
rb = RB(setup, sf)
pf = PF(sf.eqdsk)
tf = TF(
    Profile(config['TF'], family='S', part='TF', nTF=nTF, obj='L', load=True))
rb.firstwall(symetric=True, DN=True, plot=True)
#pf.plot(coils=pf.coil,label=False,plasma=False,current=True)
tf.fill()

#sf.cpasma *= 1.1
eq = EQ(sf, pf, dCoil=1.5, sigma=0, boundary=sf.get_sep(expand=1.1), n=3e3)
eq.gen_bal()
#eq.gen_opp()

sf.contour()

inv = INV(sf, eq, tf)
L = inv.grid_coils(offset=0.3)
#pf.plot(coils=pf.coil,label=False,plasma=False,current=True)

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.add_null(factor=1, point=sf.Xpoint_array[:, 0])
inv.add_null(factor=1, point=sf.Xpoint_array[:, 1])

inv.set_swing()
inv.update_limits(LCS=[-9.5, 9.5])

inv.initialize_log()
Exemple #4
0
    pf.coil[coil]['dr'] = 0.8

profile = Profile(config['TF'], family='S', part='TF', nTF=nTF, obj='L')
tf = TF(profile=profile, sf=sf)
#tf.adjust_xo('dz',value=-2)
#tf.fill()

eq = EQ(sf,
        pf,
        dCoil=2.0,
        sigma=0,
        boundary=sf.get_sep(expand=1.0),
        zmin=-10,
        n=2e3)

inv = INV(pf, tf, dCoil=0.25)
inv.load_equlibrium(sf)

inv.fix_boundary()
inv.fix_target()
inv.plot_fix(tails=True)

inv.add_plasma()
Lnorm = inv.snap_coils()
'''
Lpf = inv.grid_PF(nPF=4)
Lcs = inv.grid_CS(nCS=5,Zbound=[-10,8],gap=0.1,Ro=2.7,dr=0.8)
L = np.append(Lpf,Lcs)
inv.set_Lo(L)  # set position bounds
Lnorm = loops.normalize_variables(inv.Lo)
'''
Exemple #5
0
            family='S',
            part='TF',
            nTF=config['nTF'],
            obj='L',
            load=True))
tf.fill()
eq = EQ(sf,
        pf,
        dCoil=1.0,
        sigma=0,
        n=1e4,
        boundary=sf.get_sep(expand=1.1),
        zmin=sf.Xpoint[1] - 2)
eq.gen_opp()

inv = INV(sf, eq, tf)
#L = inv.grid_coils()
Lpf = inv.grid_PF(nPF=config['nPF'])
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])
Exemple #6
0
                  values, (eq.r2d, eq.z2d),
                  method='cubic',
                  fill_value=0)
eq.set_eq_psi()
eq.plasma()  # update core-b and plasma coils

#eq.plotb()
'''
sf.contour(boundary=False)
pl.plot(sf.xo[0],sf.xo[1],'o')
pl.plot(sf.Xpoint[0],sf.Xpoint[1],'d')
inv.plot_fix(tails=True)
'''
#pf.plot(coils=pf.coil,label=True,plasma=True,current=True)

inv = INV(sf, eq, tf)
Lpf = inv.grid_PF(nPF=nPF)
Lcs = inv.grid_CS(nCS=nCS, Zbound=[-10.5, 7], gap=0.1)
L = np.append(Lpf, Lcs)
inv.update_coils()
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.add_alpha(1, factor=1, point=sf.Xpoint, label='psi_x')
'''
#sf.get_Xpsi(xo=sf.Xpoint+dXpoint)
target = (0.75,30)
inv.add_null(factor=1,polar=target)
Exemple #7
0
#pf.plot(coils=pf.coil,label=False,plasma=False,current=True)

demo = DEMO()
demo.fill_part('Vessel')
demo.fill_part('Blanket')
#demo.fill_part('TF_Coil')
demo.plot_ports()
demo.plot_limiter()

pl.axis('off')
#tf.fill()

eq = EQ(sf, pf, dCoil=1.5, sigma=0, boundary=sf.get_sep(expand=1.2), n=1e3)
eq.gen_opp()

inv = INV(sf, eq, tf)
inv.fix_boundary_psi(N=25, alpha=1 - 1e-4, factor=1)  # add boundary points
#inv.fix['r'] -= 0.01

inv.initialize_log()

#inv.get_weight()

eq.fit(inv, N=3)
'''
for _ in range(3):
    inv.update_coils()
    inv.set_background()
    #inv.ff.set_force_feild(state='both')  
    inv.set_foreground()
    
Exemple #8
0
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)
Lpf = inv.grid_PF(nPF=4)
Lcs = inv.grid_CS(nCS=3,Zbound=[-8.2,11],gap=0.1)
Lo = np.append(Lpf,Lcs)
inv.update_coils()

inv.fit_PF(offset=0.3)  # fit PF coils to TF
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=[-9.5,9.5])

Lo = inv.optimize(Lo)
Exemple #9
0
base = {'TF':'dtt','eq':'SN','label':'SX'}
config,setup = select(base=base,update=False,nTF=18,nPF=5,nCS=3)

sf = SF(setup.filename)
pf = PF(sf.eqdsk)
tf = TF(Profile(config['TF'],family='S',part='TF',
                nTF=config['nTF'],obj='L',load=True))
tf.fill()


eq = EQ(sf,pf,dCoil=1.0,sigma=0,n=2e4,
        boundary=sf.get_sep(expand=1.1),zmin=sf.Xpoint[1]-6) 
eq.gen_opp()

inv = INV(sf,eq,tf)
Lpf = inv.grid_PF(nPF=config['nPF'])
Lcs = inv.grid_CS(nCS=config['nCS'],Zbound=[-8,8],gap=0.1,fdr=1)
L = np.append(Lpf,Lcs)
inv.update_coils()
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)

Rex,arg = 1.5,40
R = sf.Xpoint[0]*(Rex-1)/np.sin(arg*np.pi/180)
inv.add_alpha(1,factor=1,polar=(R,arg))  # X-point psi
inv.add_B(0,[-15],factor=1,polar=(R,arg))  # X-point feild
Exemple #10
0
config = 'SN'
setup = Setup(config)

sf = SF(setup.filename)
rb = RB(setup, sf)
pf = PF(sf.eqdsk)

profile = Profile(config, family='S', part='TF', nTF=18, objective='L')
tf = TF(profile)

eq = EQ(sf, pf, dCoil=2.5, sigma=0, boundary=sf.get_sep(expand=0.5), n=5e2)
eq.get_plasma_coil()
eq.run(update=False)

inv = INV(sf, eq, tf)
inv.initialize_log()

Lpf = inv.grid_PF(nPF=5)
Lcs = inv.grid_CS(nCS=5)
Lo = np.append(Lpf, Lcs)
inv.update_coils()

inv.fit_PF(offset=0.3)

inv.fix_boundary_psi(N=31, alpha=1 - 1e-4, factor=1)  # add boundary points
#inv.fix_boundary_feild(N=11,alpha=1-1e-4,factor=1)  # add boundary points
inv.add_null(factor=1, point=sf.Xpoint)

inv.set_background()
inv.get_weight()