Esempio n. 1
0
File: beam.py Progetto: cherab/core
e_distribution = Maxwellian(e_density, temperature, bulk_velocity, electron_mass)

d_species = Species(elements.deuterium, 1, d_distribution)
he2_species = Species(elements.helium, 2, he2_distribution)
c6_species = Species(elements.carbon, 6, c6_distribution)
ne10_species = Species(elements.neon, 10, ne10_distribution)

# define species
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]

# 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))),
# create atomic data source
adas = OpenADAS(permit_extrapolation=True)

world = World()

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

integration_step = 0.0025
beam_transform = translate(-0.000001, 0.0, 0) * rotate_basis(
    Vector3D(1, 0, 0), Vector3D(0, 0, 1))

beam_full = Beam(parent=world, transform=beam_transform)
beam_full.plasma = plasma
beam_full.atomic_data = adas
beam_full.energy = 100000
beam_full.power = 3e6
beam_full.element = hydrogen
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.integrator.step = integration_step
beam_full.integrator.min_samples = 10

############################
# Try converting to Renate #

import pandas as pd
Esempio n. 3
0
plt.title("Neutral Density profile in x-z plane")

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

adas = OpenADAS(permit_extrapolation=True, missing_rates_return_null=True)

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
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
Esempio n. 4
0
    def __init__(self,
                 pini_geometry,
                 pini_parameters,
                 plasma,
                 atomic_data,
                 attenuation_instructions,
                 emission_instructions,
                 integration_step=0.02,
                 parent=None,
                 name=""):

        source, direction, divergence, initial_width, length = pini_geometry
        energy, power_fractions, self._turned_on_func, element = pini_parameters

        self._components = []
        self._length = length
        self._parent_reminder = parent

        # Rotation between 'direction' and the z unit vector
        # This is important because the beam primitives are defined along the z axis.
        self._origin = source
        self._direction = direction
        direction.normalise()
        rotation = rotate_basis(direction, Vector3D(0., 0., 1.))
        transform_pini = translate(*source) * rotation

        Node.__init__(self, parent=parent, transform=transform_pini, name=name)

        attenuation_model_class, attenuation_model_arg = attenuation_instructions

        # the 3 energy components are different beams
        for comp_nb in [1, 2, 3]:

            # creation of the attenuation model
            # Note that each beamlet needs its own attenuation class instance.
            attenuation_model = attenuation_model_class(
                **attenuation_model_arg)

            # creation of the emission models
            emission_models = []
            for (emission_model_class,
                 argument_dictionary) in emission_instructions:
                emission_models.append(
                    emission_model_class(**argument_dictionary))

            beam = Beam(parent=self,
                        transform=translate(0., 0., 0.),
                        name="Beam component {}".format(comp_nb))
            beam.plasma = plasma
            beam.atomic_data = atomic_data
            beam.energy = energy / comp_nb
            beam.power = power_fractions[comp_nb - 1]
            beam.element = element
            beam.sigma = initial_width
            beam.divergence_x = divergence[0]
            beam.divergence_y = divergence[1]
            beam.length = length
            beam.attenuator = attenuation_model
            beam.models = emission_models
            beam.integrator.step = integration_step
            beam.integrator.min_samples = 10

            self._components.append(beam)