Ejemplo n.º 1
0
def load_emission(config, plasma):

    models = []

    plasma.atomic_data = OpenADAS(permit_extrapolation=True)
    if config["plasma"]["installADF15"]:
        for adf15 in config["plasma"]["adf15"]:
            try:
                species = _SPECIES_LOOKUP[adf15["species"]]
            except KeyError:
                raise ValueError("The species emission specification for this config file is invalid.")                                   
            charge     = adf15["ionisation"]
            file_path  = adf15["file_path"]
            adas_path  = adf15["adas_path"]
            install_adf15(species,charge,file_path,adas_path=adas_path)
            
    if config["plasma"]["bremsstrahlung"]:
        models.append(Bremsstrahlung())

    for emission_instruction in config["plasma"]["emission_instructions"]:
       
        try:
            species = _SPECIES_LOOKUP[emission_instruction["species"]]
        except KeyError:
            raise ValueError("The species emission specification for this config file is invalid.")                                   
        ionisation = emission_instruction["ionisation"]
        upper      = emission_instruction["upper"]
        lower      = emission_instruction["lower"]
        transition =(upper,lower)
        wavelength = emission_instruction["wavelength"]
        if not wavelength == 0: 
            add_wavelength(species,ionisation,transition,wavelength)

        # Do a test call to see if the species exists on this plasma.
        _ = plasma.composition.get(species, ionisation)

        line = Line(species, ionisation, (upper, lower))
        if emission_instruction["multiplet"]:
            multipletWvlngths = emission_instruction["multipletWvlngths"]
            multipletRatios = emission_instruction["multipletRatios"]
            multiplet = [multipletWvlngths,multipletRatios]    
            models.append(_EMISSION_TYPE_LOOKUP[emission_instruction["type"]](line,lineshape=MultipletLineShape,lineshape_args=[multiplet]))
        elif emission_instruction['stark']:
            models.append(_EMISSION_TYPE_LOOKUP[emission_instruction["type"]](line,lineshape=StarkBroadenedLine))
        else:
            models.append(_EMISSION_TYPE_LOOKUP[emission_instruction["type"]](line))
    plasma.models = models
Ejemplo n.º 2
0
plt.title("Ion temperature profile in y-z plane")

plt.figure()
h0_dens = h0.distribution.density
r, _, z, t_samples = sample3d(h0_dens, (-1, 2, 200), (0, 0, 1), (-1, 1, 200))
plt.imshow(np.transpose(np.squeeze(t_samples)), extent=[-1, 2, -1, 1])
plt.colorbar()
plt.axis('equal')
plt.xlabel('x axis')
plt.ylabel('z axis')
plt.title("Neutral Density profile in x-z plane")

###########################
# Inject beam into plasma #

cVI_8_7 = Line(carbon, 5, (8, 7))
cVI_10_8 = Line(carbon, 5, (10, 8))

integration_step = 0.0025
beam_transform = translate(-0.5, 0.0, 0) * rotate_basis(
    Vector3D(1, 0, 0), Vector3D(0, 0, 1))
beam_energy = 50000  # keV

beam_full = Beam(parent=world, transform=beam_transform)
beam_full.plasma = plasma
beam_full.atomic_data = adas
beam_full.energy = beam_energy
beam_full.power = 3e6
beam_full.element = deuterium
beam_full.sigma = 0.05
beam_full.divergence_x = 0.5
Ejemplo n.º 3
0
mds_server = 'solps-mdsplus.aug.ipp.mpg.de:8001'
ref_number = 69636  #69637
sim = load_solps_from_mdsplus(mds_server, ref_number)
plasma = sim.create_plasma(parent=world)
plasma.atomic_data = OpenADAS(permit_extrapolation=True)
mesh = sim.mesh
vessel = mesh.vessel

# Pick emission models
# d_alpha = Line(deuterium, 0, (3, 2))
# plasma.models = [ExcitationLine(d_alpha), RecombinationLine(d_alpha)]

# d_gamma = Line(deuterium, 0, (5, 2))
# plasma.models = [ExcitationLine(d_gamma), RecombinationLine(d_gamma)]

ciii_465 = Line(carbon, 2, ('2s1 3p1 3P4.0', '2s1 3s1 3S1.0'))
plasma.models = [ExcitationLine(ciii_465)]

# Select from available Cameras
# camera_config = load_calcam_calibration('/home/mcarr/mastu/cameras/mug_bulletb_midplane.nc')
# camera_config = load_calcam_calibration('/home/mcarr/mastu/cameras/mug_divcam_isp.nc')
camera_config = load_calcam_calibration(
    '/home/mcarr/mastu/cameras/mug_divcam_sxd.nc')

# RGB pipeline for visualisation
rgb = RGBPipeline2D(display_unsaturated_fraction=0.96, name="sRGB")

# Get the power and raw spectral data for scientific use.
power_unfiltered = PowerPipeline2D(display_unsaturated_fraction=0.96,
                                   name="Unfiltered Power (W)")
power_unfiltered.display_update_time = 15
Ejemplo n.º 4
0
from cherab.jet.cameras.kl1 import load_kl1_camera


world = World()
import_jet_mesh(world)


# run1706184 jsimpson/edge2d/jet/85274/aug0717/seq#23  /home/jsimpson/cmg/catalog/edge2d/jet/85274/aug0717/seq#23
# run1706188 jsimpson/edge2d/jet/85274/aug0717/seq#27

edge2d_sim = load_edge2d_from_eproc('/home/jsimpson/cmg/catalog/edge2d/jet/85274/aug0717/seq#23/tran')
plasma = edge2d_sim.create_plasma(parent=world)
plasma.atomic_data = OpenADAS(permit_extrapolation=True)

# Pick emission models
d_alpha = Line(deuterium, 0, (3, 2))
plasma.models = [ExcitationLine(d_alpha), RecombinationLine(d_alpha)]

# plt.ion()
# Setup camera for interactive use...
power_unfiltered = PowerPipeline2D(display_unsaturated_fraction=0.96, name="Unfiltered Power (W)", display_progress=False)
power_unfiltered.display_update_time = 15

camera = load_kl1_camera(parent=world, pipelines=[power_unfiltered])
camera.pixel_samples = 150
camera.ray_max_depth = 3
camera.observe()

np.save('KL1_run1706184_reflecting_150', power_unfiltered.frame.mean)
power_unfiltered.save('KL1_run1706184_reflecting_150.png')
Ejemplo n.º 5
0
###############
# Make Plasma #

world = World()

plasma = build_slab_plasma(width=1.0,
                           height=3.0,
                           peak_density=1e18,
                           impurities=[(carbon, 6, 0.005)],
                           parent=world)
plasma.b_field = ConstantVector3D(Vector3D(0, 1.5, 0))
plasma.atomic_data = OpenADAS(permit_extrapolation=True)

# add background emission
d_alpha = Line(hydrogen, 0, (3, 2))
plasma.models = [ExcitationLine(d_alpha), RecombinationLine(d_alpha)]

####################
# Visualise Plasma #

h0 = plasma.composition.get(hydrogen, 0)
h1 = plasma.composition.get(hydrogen, 1)
c6 = plasma.composition.get(carbon, 6)

# Run some plots to check the distribution functions and emission profile are as expected
ti = h1.distribution.effective_temperature
r, _, z, t_samples = sample3d(ti, (-1, 2, 200), (0, 0, 1), (-1, 1, 200))
plt.imshow(np.transpose(np.squeeze(t_samples)), extent=[-1, 2, -1, 1])
plt.colorbar()
plt.axis('equal')
Ejemplo n.º 6
0
from cherab.tools.plasmas.slab import build_slab_plasma

from renate.cherab_models import RenateBeamEmissionLine, RenateBeam


world = World()


# PLASMA ----------------------------------------------------------------------
plasma = build_slab_plasma(peak_density=5e19, world=world)


# BEAM SETUP ------------------------------------------------------------------
integration_step = 0.0025
beam_transform = translate(-0.5, 0.0, 0) * rotate_basis(Vector3D(1, 0, 0), Vector3D(0, 0, 1))
line = Line(sodium, 0, ('3p', '3s'))

beam = RenateBeam(parent=world, transform=beam_transform)
beam.plasma = plasma
beam.energy = 60000
beam.power = 1e5
beam.element = sodium
beam.temperature = 30
beam.sigma = 0.03
beam.divergence_x = 0.5
beam.divergence_y = 0.5
beam.length = 3.0
beam.models = [RenateBeamEmissionLine(line)]
beam.integrator.step = integration_step
beam.integrator.min_samples = 10
Ejemplo n.º 7
0
    Vector3D(1, 0, 0), Vector3D(0, 0, 1))

beam_energy = 50000  # keV

beam_full = Beam(parent=world, transform=beam_transform)
beam_full.plasma = plasma
beam_full.atomic_data = adas
beam_full.energy = beam_energy
beam_full.power = 3e6
beam_full.element = deuterium
beam_full.sigma = 0.05
beam_full.divergence_x = 0.5
beam_full.divergence_y = 0.5
beam_full.length = 3.0
beam_full.attenuator = SingleRayAttenuator(clamp_to_zero=True)
beam_full.models = [BeamCXLine(Line(carbon, 5, (8, 7)))]
beam_full.integrator.step = integration_step
beam_full.integrator.min_samples = 10

beam_half = Beam(parent=world, transform=beam_transform)
beam_half.plasma = plasma
beam_half.atomic_data = adas
beam_half.energy = beam_energy / 2
beam_half.power = 3e6
beam_half.element = deuterium
beam_half.sigma = 0.05
beam_half.divergence_x = 0.5
beam_half.divergence_y = 0.5
beam_half.length = 3.0
beam_half.attenuator = SingleRayAttenuator(clamp_to_zero=True)
beam_half.models = [BeamCXLine(Line(carbon, 5, (8, 7)))]
Ejemplo n.º 8
0
    print("importing {} ...".format(filename))
    Mesh.from_file(cad_file,
                   parent=world,
                   material=AbsorbingSurface(),
                   name=name)

# Load plasma from SOLPS model
mds_server = 'solps-mdsplus.aug.ipp.mpg.de:8001'
ref_number = 69636
sim = SOLPSSimulation.load_from_mdsplus(mds_server, ref_number)
plasma = sim.plasma
mesh = sim.mesh
vessel = mesh.vessel

# Setup deuterium lines
d_alpha = Line(deuterium, 0, (3, 2), wavelength=656.19)
d_beta = Line(deuterium, 0, (4, 2), wavelength=486.1)
d_gamma = Line(deuterium, 0, (5, 2), wavelength=433.99)
d_delta = Line(deuterium, 0, (6, 2), wavelength=410.2)
d_epsilon = Line(deuterium, 0, (7, 2), wavelength=397)

d_ion_species = plasma.get_species(deuterium, 1)
d_atom_species = plasma.get_species(deuterium, 0)

d_alpha_excit = ExcitationLine(d_alpha,
                               plasma.electron_distribution,
                               d_atom_species,
                               inside_outside=plasma.inside_outside)
d_alpha_excit.add_emitter_to_world(world, plasma)
d_alpha_recom = RecombinationLine(d_alpha,
                                  plasma.electron_distribution,
Ejemplo n.º 9
0
plasma.b_field = ConstantVector3D(Vector3D(1.0, 1.0, 1.0))
plasma.electron_distribution = e_distribution
plasma.composition = [d_species, he2_species, c6_species, ne10_species]

print("plasma.z_effective(): ", plasma.z_effective(0, 0, 0))

from cherab.core.model import ExcitationLine, RecombinationLine

plasma.geometry = Sphere(sigma * 5.0)
plasma.geometry_transform = None
plasma.integrator.step = integration_step
plasma.integrator.min_samples = 1000
plasma.atomic_data = adas

# Setup elements.deuterium lines
d_alpha = Line(elements.deuterium, 0, (3, 2))
d_beta = Line(elements.deuterium, 0, (4, 2))
d_gamma = Line(elements.deuterium, 0, (5, 2))
d_delta = Line(elements.deuterium, 0, (6, 2))
d_epsilon = Line(elements.deuterium, 0, (7, 2))

plasma.models = [
    # Bremsstrahlung(),
    RecombinationLine(d_alpha),
    RecombinationLine(d_beta),
    RecombinationLine(d_gamma),
    RecombinationLine(d_delta),
    RecombinationLine(d_epsilon)
]

# BEAM ------------------------------------------------------------------------
Ejemplo n.º 10
0
from cherab.core.atomic import lithium, Line
from cherab.tools.plasmas.slab import build_slab_plasma

from renate.cherab_models import RenateBeamEmissionLine, RenateBeam

world = World()

# PLASMA ----------------------------------------------------------------------
plasma = build_slab_plasma(peak_density=5e19, world=world)

# BEAM SETUP ------------------------------------------------------------------
integration_step = 0.0025
beam_transform = translate(-0.5, 0.0, 0) * rotate_basis(
    Vector3D(1, 0, 0), Vector3D(0, 0, 1))
line = Line(lithium, 0, ('2p', '2s'))

beam = RenateBeam(parent=world, transform=beam_transform)
beam.plasma = plasma
beam.energy = 60000
beam.power = 1e5
beam.element = lithium
beam.temperature = 30
beam.sigma = 0.03
beam.divergence_x = 0.5
beam.divergence_y = 0.5
beam.length = 3.0
beam.models = [RenateBeamEmissionLine(line)]
beam.integrator.step = integration_step
beam.integrator.min_samples = 10
Ejemplo n.º 11
0
import argparse
import numpy as np
import matplotlib.pyplot as plt
from raysect.core import Point3D, Vector3D
from raysect.core.math.function.function3d import PythonFunction3D
from raysect.optical import Spectrum

from cherab.core.atomic import deuterium, helium, carbon, Line
from cherab.core.model import ExcitationLine, RecombinationLine
from cherab.openadas import OpenADAS
from cherab.edge2d import load_edge2d_from_eproc
from cherab.jet.cameras.kl11 import load_kl11_voxel_grid, load_kl11_sensitivity_matrix, load_kl11_camera


available_lines = {
    'd-alpha': Line(deuterium, 0, (3, 2)),
    'd_beta': Line(deuterium, 0, (4, 2)),
    'd-gamma': Line(deuterium, 0, (5, 2)),
    'd_delta': Line(deuterium, 0, (6, 2)),
    'd_epsilon': Line(deuterium, 0, (7, 2)),
    'heliumii_468': Line(helium, 1, (4, 3)),
    'carbonii_515': Line(carbon, 1, ("2s1 2p1 3d1 2D4.5", "2s2 4d1 2D4.5")),
    'ciii_465': Line(carbon, 2, ('2s1 3p1 3P4.0', '2s1 3s1 3S1.0'))
}

parser = argparse.ArgumentParser()
parser.add_argument('sim_path', help='The path to the edge2D simulation tran folder.')
parser.add_argument('-c', '--camera', help='The camera id which will be simulated must be one of'
                    '[a, b, c, d].', default='c')
parser.add_argument('-l', '--line', help='The emission line that will be simulated.',
                    choices=list(available_lines.keys()), default='d-alpha')
    def __init__(self, solps_ref_no, view, line, camera, optics='MAST_CI_mod', cherab_down_sample=50, verbose=True,
                 display=False, overwrite=False):
        """
        :param solps_ref_no: int
        :param view: str
        :param line: str
        :param camera: str
        :param optics: str
        :param cherab_down_sample: int downsample the image by ths factor in both dimensions, for speed / testing.
        :param verbose: bool
        :param display: bool
        :param overwrite: bool
        """

        self.world = World()
        self.solps_ref_no = solps_ref_no
        self.line = line
        self.view = view
        self.camera = camera
        self.optics = optics
        self.cherab_down_sample = cherab_down_sample
        self.verbose = verbose
        self.display = display
        self.overwrite = overwrite

        self.radiance = NotImplemented
        self.spectral_radiance = NotImplemented

        self.pupil_point = settings.view[self.view]['pupil_point']
        self.view_vector = settings.view[self.view]['view_vector']
        self.sensor_format = settings.camera[self.camera]['sensor_format']
        for s in self.sensor_format:
            assert s % cherab_down_sample == 0
        self.sensor_format_ds = tuple((np.array(self.sensor_format) / cherab_down_sample).astype(np.int))
        self.pixel_size = settings.camera[self.camera]['pixel_size']
        self.pixel_size_ds = self.pixel_size * cherab_down_sample

        self.x, self.y, = self.calc_pixel_position(self.pixel_size, self.sensor_format)
        self.x_pixel = self.x.x_pixel
        self.y_pixel = self.y.y_pixel

        self.x_ds = self.x.isel(x=slice(0, self.sensor_format[0], cherab_down_sample, ))
        self.y_ds = self.y.isel(y=slice(0, self.sensor_format[1], cherab_down_sample, ))
        self.x_pixel_ds = self.x_ds.x_pixel
        self.y_pixel_ds = self.y_ds.y_pixel

        self.chunks = {'x': 800, 'y': 800}

        # calculate field of view (FOV) (horizontal) using sensor geometry and lens focal lengths
        f_1, f_2, f_3 = settings.optics[self.optics]
        sensor_dim = self.sensor_format[0] * self.pixel_size
        self.fov = 2 * np.arctan((sensor_dim / 2) * f_2 / (f_3 * f_1)) * 180 / np.pi  # deg
#
        # file and directory paths
        self.dir_name = str(solps_ref_no) + '_' + view + '_' + line + '_' + camera
        self.dir_path = os.path.join(path_saved_data, self.dir_name)
        fname = 'spec_power.nc'
        fname_ds = 'spec_power_ds.nc'
        self.fpath_ds = os.path.join(self.dir_path, fname_ds, )
        self.fpath = os.path.join(self.dir_path, fname, )

        # load SOLPS plasma and set emission line model
        self.sim = load_solps_from_mdsplus(mds_server, self.solps_ref_no)
        self.plasma = self.sim.create_plasma(parent=self.world)
        self.plasma.atomic_data = OpenADAS(permit_extrapolation=True)

        emission_line = settings.line[self.line]
        element, charge, transition = [emission_line[s] for s in ['element', 'charge', 'transition', ]]
        line_obj = Line(element, charge, transition, )
        self._line_excit = ExcitationLine(line_obj, lineshape=StarkBroadenedLine)
        self._line_recom = RecombinationLine(line_obj, lineshape=StarkBroadenedLine)
        self.plasma.models = [Bremsstrahlung(), self._line_excit, self._line_recom]
        wl_0_nm = self._line_excit.atomic_data.wavelength(element, charge, transition, )
        self.wl_0 = wl_0_nm * 1e-9  # [m]
        self.wl_min_nm, self.wl_max_nm = wl_0_nm - 0.2, wl_0_nm + 0.2  # [m]

        # ugly, but I want to convert the density units to 10^{20} m^{-3}
        def get_ne(x, y, z, ):
            return 1e-20 * self.plasma.electron_distribution.density(x, y, z, )

        def get_ni(x, y, z, ):
            return 1e-20 * self.plasma.composition.get(deuterium, 0).distribution.density(x, y, z, )

        def get_b_field_mag(x, y, z, ):
            """
            magnitude of the magnetic field at x, y, z
            :param x:
            :param y:
            :param z:
            :return:
            """
            return self.plasma.b_field(x, y, z, ).length

        def get_emiss_excit(x, y, z, ):
            return self._line_excit.emission(Point3D(x, y, z, ), Vector3D(1, 1, 1), Spectrum(380, 700, 100)).total()

        def get_emiss_recom(x, y, z, ):
            return self._line_recom.emission(Point3D(x, y, z, ), Vector3D(1, 1, 1), Spectrum(380, 700, 100)).total()

        self.valid_param_get_fns = {'ne': get_ne,
                                    'ni': get_ni,
                                    'te': self.plasma.electron_distribution.effective_temperature,
                                    'ti': self.plasma.composition.get(deuterium, 0).distribution.effective_temperature,
                                    'tn': self.plasma.composition.get(deuterium, 1).distribution.effective_temperature,
                                    'b_field_mag': get_b_field_mag,
                                    'emiss_excit': get_emiss_excit,
                                    'emiss_recom': get_emiss_recom,
                                    }
        self.valid_params = list(self.valid_param_get_fns.keys())

        # load / make the cherab image
        if os.path.isdir(self.dir_path) and self.overwrite is False:
            if os.path.isfile(self.fpath) and os.path.isfile(self.fpath_ds):
                pass
        else:
            if not os.path.isdir(self.dir_path):
                os.mkdir(self.dir_path)
                self.make_cherab_image()

        ds, ds_ds = self.load_cherab_image()
        self.spectral_radiance = ds['spectral_radiance']
        self.radiance = self.spectral_radiance.integrate(dim='wavelength')
        self.radiance = xr.where(xr.ufuncs.isnan(self.radiance), 0, self.radiance, )

        self.spectral_radiance_ds = ds_ds['spectral_radiance_ds']
        self.radiance_ds = ds_ds['radiance_ds']
        self.view_vectors = ds_ds['view_vectors_ds']
        self.ray_lengths = ds_ds['ray_lengths_ds']
        ds.close()
Ejemplo n.º 13
0
beam_position = translate(south_pos.x, south_pos.y, south_pos.z)

beam_full = Beam(parent=world, transform=beam_position * beam_rotation)
beam_full.plasma = plasma
beam_full.atomic_data = adas
beam_full.energy = 65000
beam_full.power = 3e6
beam_full.element = elements.deuterium
beam_full.sigma = 0.025
beam_full.divergence_x = 0  #0.5
beam_full.divergence_y = 0  #0.5
beam_full.length = 10.0
beam_full.attenuator = SingleRayAttenuator(clamp_to_zero=True)
beam_full.models = [
    BeamCXLine(Line(elements.carbon, 5, (8, 7))),
]
beam_full.integrator.step = integration_step
beam_full.integrator.min_samples = 10

beam_half = Beam(parent=world, transform=beam_position * beam_rotation)
beam_half.plasma = plasma
beam_half.atomic_data = adas
beam_half.energy = 65000 / 2.
beam_half.power = 3e6
beam_half.element = elements.deuterium
beam_half.sigma = 0.025
beam_half.divergence_x = 0  #0.5
beam_half.divergence_y = 0  #0.5
beam_half.length = 10.0
beam_half.attenuator = SingleRayAttenuator(clamp_to_zero=True)
Ejemplo n.º 14
0
from cherab.core.atomic import Line, carbon
from cherab.core.model import ExcitationLine, RecombinationLine
from cherab.openadas import OpenADAS
from cherab.compass import load_core_plasma_from_files

psirz_file = os.path.join(os.path.dirname(__file__), "data/psi_RZ.txt")
psin_file = os.path.join(os.path.dirname(__file__), "data/psi.txt")
electron_file = os.path.join(os.path.dirname(__file__), "data/electrons.txt")
carbon_file = os.path.join(os.path.dirname(__file__), "data/abunC.txt")

world = World()
adas = OpenADAS(permit_extrapolation=True)
plasma = load_core_plasma_from_files(world, adas, psirz_file, psin_file,
                                     electron_file, carbon_file)

ciii_465 = Line(carbon, 2, (11, 10))  # wavelength=465.01

plasma.models = [ExcitationLine(ciii_465)]

cam = PinholeCamera((512, 512),
                    parent=world,
                    transform=translate(-2, 0, 0) *
                    rotate_basis(Vector3D(1, 0, 0), Vector3D(0, 0, 1)))
cam.pixel_samples = 1
cam.observe()

cam = PinholeCamera((512, 512),
                    parent=world,
                    transform=translate(-1.2, 0.4, 0) *
                    rotate_basis(Vector3D(1, 0, 0), Vector3D(0, 0, 1)))
cam.pixel_samples = 1
Ejemplo n.º 15
0
from raysect.core import Vector3D

# ########################### SCENEGRAPH CREATION ########################### #
print('Scenegraph creation')

atomic_data = ADAS(permit_extrapolation=True)

# C1 = Cylinder(4, 4, transform=translate(0, 0, -2.0)*rotate(0, 0, 0))
# C2 = Cylinder(1.5, 4.2, transform=translate(0, 0, -2.1)*rotate(0, 0, 0))
# Subtract(C1, C2, world, transform=translate(0, 0, 0)*rotate(0, 0, 0),
#          material=DAlphaPlasma(PULSE, time=TIME, power=0.08, sigma=0.1, step=0.1), name="Plasma primitive")

attenuation_instruction = (SingleRayAttenuator, {'step': 0.01})
emission_instructions = [
    (CXSBeamPlasmaIntersection, {
        'line': Line(elements.carbon, 5, (8, 7)),
        'step': 0.01
    }),
    # (CXSBeamPlasmaIntersection, {'line': Line(elements.carbon, 5, (10, 8)), 'step': 0.01})
]

world, plasma, components = build_jet_scenegraph(PULSE, atomic_data,
                                                 attenuation_instruction,
                                                 emission_instructions)

octant8 = components['nib8']
ks5_oct1 = components['ks5_oct1']
ks7_oct8 = components['ks7_oct8']

ks5_oct1.min_wavelength = 526
ks5_oct1.max_wavelength = 532
Ejemplo n.º 16
0
        # Calculate simple gaussian line at each line wavelength in spectrum
        # Add it to the existing spectrum. Don't override previous results!
        weight = self.line.element.atomic_weight
        rest_wavelength = self.line.wavelength
        sigma = sqrt(te * ELEMENTARY_CHARGE / (weight * AMU)) * rest_wavelength / SPEED_OF_LIGHT
        i0 = inty/(sigma * sqrt(2 * PI))
        width = 2*sigma**2
        for i, wvl in enumerate(spectrum.wavelengths):
            spectrum.samples[i] += i0 * exp(-(wvl - rest_wavelength)**2 / width)

        return spectrum


# Setup deuterium line
d_alpha = Line(deuterium, 0, (3, 2), wavelength=656.19)

# Load the deuterium atom species and electron distribution for use in rate calculations.
d_atom_species = plasma.get_species(deuterium, 0)
electrons = plasma.electron_distribution

# Load the Excitation and Recombination lines and add them as emitters to the world.
d_alpha_excit = ExcitationLine(d_alpha, plasma.electron_distribution, d_atom_species)

outer_radius = plasma.misc_properties['maxr'] + 0.001
plasma_height = plasma.misc_properties['maxz'] - plasma.misc_properties['minz']
lower_z = plasma.misc_properties['minz']

main_plasma_cylinder = Cylinder(outer_radius, plasma_height, parent=world,
                                material=d_alpha_excit, transform=translate(0, 0, lower_z))
Ejemplo n.º 17
0
from renate.cherab_models import RenateBeamEmissionLine, RenateBeam


world = World()


# PLASMA ----------------------------------------------------------------------
plasma = build_slab_plasma(peak_density=5e19, world=world)
plasma.b_field = ConstantVector3D(Vector3D(0, 0.6, 0))


# BEAM SETUP ------------------------------------------------------------------
integration_step = 0.0025
beam_transform = translate(-0.5, 0.0, 0) * rotate_basis(Vector3D(1, 0, 0), Vector3D(0, 0, 1))
line = Line(hydrogen, 0, (3, 2))

beam = RenateBeam(parent=world, transform=beam_transform)
beam.plasma = plasma
beam.energy = 100000
beam.power = 3e6
beam.element = hydrogen
beam.temperature = 30
beam.sigma = 0.05
beam.divergence_x = 0.
beam.divergence_y = 0.
beam.length = 3.0
beam.models = [RenateBeamEmissionLine(line)]
beam.integrator.step = integration_step
beam.integrator.min_samples = 10
Ejemplo n.º 18
0
from cherab.core.atomic import ADAS
from cherab.core.atomic import elements, Line
from raysect.core import Vector3D

# ########################### SCENEGRAPH CREATION ########################### #
print('Scenegraph creation')

atomic_data = ADAS(permit_extrapolation=True)

# C1 = Cylinder(4, 4, transform=translate(0, 0, -2.0)*rotate(0, 0, 0))
# C2 = Cylinder(1.5, 4.2, transform=translate(0, 0, -2.1)*rotate(0, 0, 0))
# Subtract(C1, C2, world, transform=translate(0, 0, 0)*rotate(0, 0, 0),
#          material=DAlphaPlasma(PULSE, time=TIME, power=0.08, sigma=0.1, step=0.1), name="Plasma primitive")

attenuation_instruction = (SingleRayAttenuator, {'step': 0.01})
emission_instructions = [(CXSBeamPlasmaIntersection, {'line': Line(elements.carbon, 5, (8, 7)),  'step': 0.01}),
                         # (CXSBeamPlasmaIntersection, {'line': Line(elements.carbon, 5, (10, 8)), 'step': 0.01})
                        ]

world, plasma, components = build_jet_scenegraph(PULSE,
                                             atomic_data,
                                             attenuation_instruction,
                                             emission_instructions)

octant8 = components['nib8']
ks5_oct1 = components['ks5_oct1']
ks7_oct8 = components['ks7_oct8']

ks5_oct1.min_wavelength = 526
ks5_oct1.max_wavelength = 532
Ejemplo n.º 19
0
    print("importing {} ...".format(filename))
    Mesh.from_file(cad_file, parent=world, material=AbsorbingSurface(), name=name)


# Load plasma from SOLPS model
mds_server = 'solps-mdsplus.aug.ipp.mpg.de:8001'
ref_number = 69636
sim = load_solps_from_mdsplus(mds_server, ref_number)
plasma = sim.create_plasma(parent=world)
plasma.atomic_data = OpenADAS(permit_extrapolation=True)
mesh = sim.mesh
vessel = mesh.vessel


# Setup deuterium lines
d_alpha = Line(deuterium, 0, (3, 2))
d_beta = Line(deuterium, 0, (4, 2))
d_gamma = Line(deuterium, 0, (5, 2))
d_delta = Line(deuterium, 0, (6, 2))
d_epsilon = Line(deuterium, 0, (7, 2))

d_alpha_excit = ExcitationLine(d_alpha, lineshape=StarkBroadenedLine)
d_alpha_recom = RecombinationLine(d_alpha, lineshape=StarkBroadenedLine)
d_beta_excit = ExcitationLine(d_beta, lineshape=StarkBroadenedLine)
d_beta_recom = RecombinationLine(d_beta, lineshape=StarkBroadenedLine)
d_gamma_excit = ExcitationLine(d_gamma, lineshape=StarkBroadenedLine)
d_gamma_recom = RecombinationLine(d_gamma, lineshape=StarkBroadenedLine)
d_delta_excit = ExcitationLine(d_delta, lineshape=StarkBroadenedLine)
d_delta_recom = RecombinationLine(d_delta, lineshape=StarkBroadenedLine)
d_epsilon_excit = ExcitationLine(d_epsilon, lineshape=StarkBroadenedLine)
d_epsilon_recom = RecombinationLine(d_epsilon, lineshape=StarkBroadenedLine)
Ejemplo n.º 20
0
Archivo: beam.py Proyecto: cherab/core
plasma.composition = [d_species, he2_species, c6_species, ne10_species]

# BEAM ------------------------------------------------------------------------
beam = Beam(parent=world, transform=translate(1.0, 0.0, 0) * rotate(90, 0, 0))
beam.plasma = plasma
beam.atomic_data = adas
beam.energy = 60000
beam.power = 3e6
beam.element = elements.deuterium
beam.sigma = 0.025
beam.divergence_x = 0.5
beam.divergence_y = 0.5
beam.length = 3.0
beam.attenuator = SingleRayAttenuator(clamp_to_zero=True)
beam.models = [
    BeamCXLine(Line(elements.helium, 1, (4, 3))),
    BeamCXLine(Line(elements.helium, 1, (6, 4))),
    BeamCXLine(Line(elements.carbon, 5, (8, 7))),
    BeamCXLine(Line(elements.carbon, 5, (9, 8))),
    BeamCXLine(Line(elements.carbon, 5, (10, 8))),
    BeamCXLine(Line(elements.neon, 9, (11, 10))),
    BeamCXLine(Line(elements.neon, 9, (12, 11))),
]
beam.integrator.step = integration_step
beam.integrator.min_samples = 10

beam = Beam(parent=world, transform=translate(1.0, 0.0, 0) * rotate(90, 0, 0))
beam.plasma = plasma
beam.atomic_data = adas
beam.energy = 60000 / 2
beam.power = 3e6
Ejemplo n.º 21
0
e_distribution = Maxwellian(electron_density, ion_temperature, flow_velocity,
                            electron_mass)

d_species = Species(deuterium, 1, d_distribution)
c6_species = Species(carbon, 6, c6_distribution)

plasma.electron_distribution = e_distribution
plasma.composition = [d_species, c6_species]

# ########################### NBI CONFIGURATION ############################# #

print('Loading JET PINI configuration...')

attenuation_instructions = (SingleRayAttenuator, {'clamp_to_zero': True})

beam_emission_instructions = [(BeamCXLine, {'line': Line(carbon, 5, (8, 7))})]

pini_8_1 = load_pini_from_ppf(PULSE, '8.1', plasma, adas,
                              attenuation_instructions,
                              beam_emission_instructions, world)
pini_8_2 = load_pini_from_ppf(PULSE, '8.2', plasma, adas,
                              attenuation_instructions,
                              beam_emission_instructions, world)
pini_8_5 = load_pini_from_ppf(PULSE, '8.5', plasma, adas,
                              attenuation_instructions,
                              beam_emission_instructions, world)
pini_8_6 = load_pini_from_ppf(PULSE, '8.6', plasma, adas,
                              attenuation_instructions,
                              beam_emission_instructions, world)

# ############################### OBSERVATION ############################### #