예제 #1
0
import numpy as np
import matplotlib.pyplot as plt
from mayavi import mlab
from raysect.core import World, Point3D, Vector3D
from cherab.core.math import ConstantVector3D

from vita.modules.cherab import FieldlineTracer, Euler

# the world scene-graph
world = World()

b_field = ConstantVector3D(Vector3D(0, 1.5, 0))

field_tracer = FieldlineTracer(b_field, method=Euler(step_size=0.001))

start_point = Point3D(0, 0, 0)
end_point, trajectory = field_tracer.trace(world,
                                           start_point,
                                           save_trajectory=True,
                                           max_steps=1000)

num_segments = len(trajectory)
x = np.zeros(num_segments)
y = np.zeros(num_segments)
z = np.zeros(num_segments)
for ith_position, position in enumerate(trajectory):
    x[ith_position] = position.x
    y[ith_position] = position.y
    z[ith_position] = position.z

mlab.plot3d(x, y, z, tube_radius=0.0005, color=(1, 0, 0))
예제 #2
0
        imp_temperature = IonFunction(peak_temperature,
                                      0,
                                      pedestal_top=pedestal_top)
        imp_distribution = Maxwellian(imp_density, imp_temperature,
                                      velocity_profile,
                                      impurity.atomic_weight * atomic_mass)
        species.append(Species(impurity, ionisation, imp_distribution))

# define the electron distribution
e_density = IonFunction(peak_density, 0, pedestal_top=pedestal_top)
e_temperature = IonFunction(peak_temperature, 0, pedestal_top=pedestal_top)
e_distribution = Maxwellian(e_density, e_temperature, velocity_profile,
                            electron_mass)

# define species
plasma.b_field = ConstantVector3D(Vector3D(0, 0, 0))
plasma.electron_distribution = e_distribution
plasma.composition = species

####################
# 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
h1_temp = h1.distribution.effective_temperature
r, _, z, t_samples = sample3d(h1_temp, (-1, 2, 200), (0, 0, 1), (-1, 1, 200))
plt.imshow(np.transpose(np.squeeze(t_samples)), extent=[-1, 2, -1, 1])
plt.colorbar()
예제 #3
0
파일: beam.py 프로젝트: cherab/core
adas = OpenADAS(permit_extrapolation=True)

# PLASMA ----------------------------------------------------------------------
plasma = Plasma(parent=world)

# define basic distributions
ion_density = 9e19
sigma = 0.25

d_density = GaussianVolume(0.94 * ion_density, sigma)
he2_density = GaussianVolume(0.04 * ion_density, sigma)
c6_density = GaussianVolume(0.01 * ion_density, sigma)
ne10_density = GaussianVolume(0.01 * ion_density, sigma)
e_density = GaussianVolume((0.94 + 0.04*2 + 0.01*6 + 0.01*10) * ion_density, sigma)
temperature = 1000 + GaussianVolume(4000, sigma)
bulk_velocity = ConstantVector3D(Vector3D(200e3, 0, 0))

d_distribution = Maxwellian(d_density, temperature, bulk_velocity, elements.deuterium.atomic_weight * atomic_mass)
he2_distribution = Maxwellian(he2_density, temperature, bulk_velocity, elements.helium.atomic_weight * atomic_mass)
c6_distribution = Maxwellian(c6_density, temperature, bulk_velocity, elements.carbon.atomic_weight * atomic_mass)
ne10_distribution = Maxwellian(ne10_density, temperature, bulk_velocity, elements.neon.atomic_weight * atomic_mass)
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
예제 #4
0

# setup scenegraph
world = World()


###################
# plasma creation #

plasma = Plasma(parent=world)
plasma.atomic_data = OpenADAS(permit_extrapolation=True)
plasma.geometry = Cylinder(3.5, 2.2, transform=translate(0, 0, -1.1))
plasma.geometry_transform = translate(0, 0, -1.1)

# No net velocity for any species
zero_velocity = ConstantVector3D(Vector3D(0, 0, 0))

# define neutral species distribution
d0_density = NeutralFunction(peak_density, 0.1, magnetic_axis)
d0_temperature = Constant3D(0.5)  # constant 0.5eV temperature for all neutrals
d0_distribution = Maxwellian(d0_density, d0_temperature, zero_velocity,
                             deuterium.atomic_weight * atomic_mass)
d0_species = Species(deuterium, 0, d0_distribution)

# define deuterium ion species distribution
d1_density = IonFunction(peak_density, 0, magnetic_axis)
d1_temperature = IonFunction(peak_temperature, 0, magnetic_axis)
d1_distribution = Maxwellian(d1_density, d1_temperature, zero_velocity,
                             deuterium.atomic_weight * atomic_mass)
d1_species = Species(deuterium, 1, d1_distribution)