Exemple #1
0
 def read_file(self, field_fname, coils_fname):
     """ 
     coils,f,eqd = read_file()
     """ 
     try:
         self.coils = h5py.File(coils_fname, "r")
     except:
         print('Impossible to read coil geometry')
         self.coils=[]
     self.f=a5.Ascot(field_fname)
     #self.eqd = ReadEQDSK.ReadEQDSK(eqd_fname)
     self.b5 = Ascotpy(field_fname)
     self.b5.init(bfield=self.f.bfield.active.get_qid())
Exemple #2
0
"""

import utils.plot_utils as pu
import a5py.ascot5io.ascot5 as a5
from a5py.ascotpy.ascotpy import Ascotpy
import os
import numpy as np
import matplotlib.pyplot as plt

pu.common_style()
dir = '/home/vallar/'
if os.uname().nodename != 'spcpc182':
    dir = '/home/matval/'
dir += 'WORK/ASCOT/runs/SA_003/ripple'
a = a5.Ascot(f'{dir}/ascot_TFripple.h5')
b5 = Ascotpy(f'{dir}/ascot_TFripple.h5')
b5.init(bfield=a.bfield.active.get_qid())
# preparing Bfield grids
bb = a.bfield.active.read()
bphi = bb['bphi']
_Rmin = np.squeeze(bb['b_rmin'])
_Rmax = np.squeeze(bb['b_rmax'])
_nR = np.squeeze(bb['b_nr'])
R = np.linspace(_Rmin, _Rmax, _nR)
_zmin = np.squeeze(bb['b_zmin'])
_zmax = np.squeeze(bb['b_zmax'])
_nz = np.squeeze(bb['b_nz'])
z = np.linspace(_zmin, _zmax, _nz)
nphi = np.squeeze(bb['b_nphi'])
Rgrid, zgrid, tg = np.meshgrid(R, z, 0, indexing="ij")
Exemple #3
0
file = a5class.Ascot(fname)
#fgo=file.run_1744124558 # collisions
#fgc=file.run_1659479300 # collisions

fgo = file.run_1893662328  # no collisions, correct orbit diagnostics
fgc = file.run_1357839974  # no collisions

#file=a5.Ascot('/home/vallar/WORK/ASCOT/runs/SA_003/pnb_ripple/perp/run_lowres/ascot.h5')
#fcoll=f.run_1717140291 #GO
#fnocoll=f.run_0232038243 #GO
#fcoll=f.run_2054526193 #GC
#fnocoll=f.run_1434905107 #GC
#fcoll=f.run_1699397937 #GC
#fnocoll=file.run_0032578993 #GC

a5 = Ascotpy(fname)
a5.init(bfield=True)
orb_go = fgo.orbit.read()
orb_gc = fgc.orbit.read()
ind_gc = np.where(fgc.endstate['endcond'] == 4)[0]
ind_go = np.where(fgo.endstate['endcond'] == 4)[0]

f = plt.figure(figsize=(15, 8))
ax_go_rhopitch = f.add_subplot(243)
ax_gc_rhopitch = f.add_subplot(247,
                               sharex=ax_go_rhopitch,
                               sharey=ax_go_rhopitch)
ax_go_rz = f.add_subplot(241)
ax_gc_rz = f.add_subplot(245, sharex=ax_go_rz)
axcompare = f.add_subplot(242)
ax_Emu = f.add_subplot(248)
Exemple #4
0
from matplotlib import cm

from a5py.ascot5io.ascot5 import Ascot
from a5py.ascotpy.ascotpy import Ascotpy

from a5py.marker.pploss import plotlossmap
from a5py.marker.phasespace import maprzk2rhoksi, evalPmu, istrapped

import unyt

# File with all runs.
#fn = "/m/phys/project/fusion/sarkimk1/thesis/data/fullruns.h5"
fn = '/home/vallar/WORK/ASCOT/SA_003/ripple/pnb/perp/ascot_pnb_perp_poincare_markers.h5'

h5 = Ascot(fn)
a5 = Ascotpy(fn)
poincare = h5.poincare500kev

fn = '/home/vallar/WORK/ASCOT/SA_003/ripple/pnb/perp/ascot_ripple_pnb_ascot53.h5'
h5 = Ascot(fn)
a5 = Ascotpy(fn)
runA = h5.active

# runB = h5.ECCSD
# runC = h5.MPRSD

#runA = h5.FullfieldSD
#runB = h5.HalffieldSD
#runC = h5.ThirdfieldSD
mass = runA.inistate["mass"][0]
mass = mass.value * unyt.amu
Exemple #5
0

fname='/home/vallar/WORK/ASCOT/runs/SA_003/nnb_ripple/production/ascot.h5'
file=a5.Ascot(fname)
fcoll=file.run_1659479300
fnocoll=file.run_1357839974

#file=a5.Ascot('/home/vallar/WORK/ASCOT/runs/SA_003/pnb_ripple/perp/run_lowres/ascot.h5')
#fcoll=f.run_1717140291 #GO
#fnocoll=f.run_0232038243 #GO
#fcoll=f.run_2054526193 #GC
#fnocoll=f.run_1434905107 #GC
#fcoll=f.run_1699397937 #GC
#fnocoll=file.run_0032578993 #GC

a5 = Ascotpy(fname); a5.init(bfield=True)
orb_coll=fcoll.orbit.read()
orb_nocoll=fnocoll.orbit.read()
ind_nocoll=np.where(fnocoll.endstate['endcond']==4)[0]
ind_coll=np.where(fcoll.endstate['endcond']==4)[0]

f=plt.figure(figsize=(15,8));
ax_coll_rhopitch = f.add_subplot(241)
ax_nocoll_rhopitch = f.add_subplot(245, sharex=ax_coll_rhopitch, sharey=ax_coll_rhopitch)
ax_coll_rz = f.add_subplot(242)
ax_nocoll_rz = f.add_subplot(246, sharex=ax_coll_rz)
axcompare=f.add_subplot(243)
ax_Emu = f.add_subplot(248)
ax_pphimu = f.add_subplot(244)

f4=plt.figure();