コード例 #1
0
ファイル: beam.py プロジェクト: cherab/core
from cherab.core.math import Constant3D, ConstantVector3D
from cherab.core.atomic import elements, Line
from cherab.openadas import OpenADAS
from cherab.core.model import SingleRayAttenuator, BeamCXLine
from cherab.tools.plasmas import GaussianVolume

integration_step = 0.02

# setup scenegraph
world = World()

# create atomic data source
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)
コード例 #2
0
    MultipletLineShape, StarkBroadenedLine
from cherab.openadas import OpenADAS
from cherab.tools.plasmas import GaussianVolume

# tunables
ion_density = 1e20
sigma = 0.25

# setup scenegraph
world = World()

# create atomic data source
adas = OpenADAS(permit_extrapolation=True)

# PLASMA ----------------------------------------------------------------------
plasma = Plasma(parent=world)
plasma.atomic_data = adas
plasma.geometry = Sphere(sigma * 5.0)
plasma.geometry_transform = None
plasma.integrator = NumericalIntegrator(step=sigma / 5.0)

# define basic distributions
d_density = GaussianVolume(0.5 * ion_density, sigma * 10000)
n_density = d_density * 0.01
e_density = GaussianVolume(ion_density, sigma * 10000)
temperature = 1 + GaussianVolume(79, sigma)
bulk_velocity = ConstantVector3D(Vector3D(-1e6, 0, 0))

deuterium_mass = deuterium.atomic_weight * atomic_mass
d_distribution = Maxwellian(d_density, temperature, bulk_velocity,
                            deuterium_mass)
コード例 #3
0
    def create_plasma(self, parent=None, transform=None, name=None):
        """
        Make a CHERAB plasma object from this SOLEGE2D simulation.

        :param Node parent: The plasma's parent node in the scenegraph, e.g. a World object.
        :param AffineMatrix3D transform: Affine matrix describing the location and orientation
        of the plasma in the world.
        :param str name: User friendly name for this plasma (default = "SOLEDGE2D Plasma").
        :rtype: Plasma
        """

        mesh = self.mesh
        name = name or "SOLEDGE2D Plasma"
        plasma = Plasma(parent=parent, transform=transform, name=name)
        radius = mesh.mesh_extent['maxr']
        height = mesh.mesh_extent['maxz'] - mesh.mesh_extent['minz']
        plasma.geometry = Cylinder(radius, height)
        plasma.geometry_transform = translate(0, 0, mesh.mesh_extent['minz'])

        tri_index_lookup = self.mesh.triangle_index_lookup
        tri_to_grid = self.mesh.triangle_to_grid_map

        if isinstance(self._b_field_vectors, np.ndarray):
            plasma.b_field = SOLEDGE2DVectorFunction3D(
                tri_index_lookup, tri_to_grid, self._b_field_vectors_cartesian)
        else:
            print(
                'Warning! No magnetic field data available for this simulation.'
            )

        # Create electron species
        triangle_data = _map_data_onto_triangles(self._electron_temperature)
        electron_te_interp = Discrete2DMesh(mesh.vertex_coords,
                                            mesh.triangles,
                                            triangle_data,
                                            limit=False)
        electron_temp = AxisymmetricMapper(electron_te_interp)
        triangle_data = _map_data_onto_triangles(self._electron_density)
        electron_ne_interp = Discrete2DMesh.instance(electron_te_interp,
                                                     triangle_data)
        electron_dens = AxisymmetricMapper(electron_ne_interp)
        electron_velocity = lambda x, y, z: Vector3D(0, 0, 0)
        plasma.electron_distribution = Maxwellian(electron_dens, electron_temp,
                                                  electron_velocity,
                                                  electron_mass)

        if not isinstance(self.velocities_cartesian, np.ndarray):
            print(
                'Warning! No velocity field data available for this simulation.'
            )

        b2_neutral_i = 0  # counter for B2 neutrals
        for k, sp in enumerate(self.species_list):

            # Identify the species based on its symbol
            symbol, charge = re.match(_SPECIES_REGEX, sp).groups()
            charge = int(charge)
            species_type = _species_symbol_map[symbol]

            # If neutral and B" atomic density available,  use B2 density, otherwise use fluid species density.
            if isinstance(self.b2_neutral_densities,
                          np.ndarray) and charge == 0:
                species_dens_data = self.b2_neutral_densities[:, :,
                                                              b2_neutral_i]
                b2_neutral_i += 1
            else:
                species_dens_data = self.species_density[:, :, k]

            triangle_data = _map_data_onto_triangles(species_dens_data)
            dens = AxisymmetricMapper(
                Discrete2DMesh.instance(electron_te_interp, triangle_data))
            # dens = SOLPSFunction3D(tri_index_lookup, tri_to_grid, species_dens_data)

            # Create the velocity vector lookup function
            if isinstance(self.velocities_cartesian, np.ndarray):
                velocity = SOLEDGE2DVectorFunction3D(
                    tri_index_lookup, tri_to_grid,
                    self.velocities_cartesian[:, :, k, :])
            else:
                velocity = lambda x, y, z: Vector3D(0, 0, 0)

            distribution = Maxwellian(dens, electron_temp, velocity,
                                      species_type.atomic_weight * atomic_mass)
            plasma.composition.add(Species(species_type, charge, distribution))

        return plasma
コード例 #4
0
import_jet_mesh(world)

# ########################### PLASMA EQUILIBRIUM ############################ #
print('Plasma equilibrium')

equilibrium = JETEquilibrium(PULSE)
equil_time_slice = equilibrium.time(TIME)
psin_2d = equil_time_slice.psi_normalised
psin_3d = AxisymmetricMapper(equil_time_slice.psi_normalised)
inside_lcfs = equil_time_slice.inside_lcfs

# ########################### PLASMA CONFIGURATION ########################## #
print('Plasma configuration')

plasma = Plasma(parent=world)
plasma.atomic_data = adas
plasma.b_field = VectorAxisymmetricMapper(equil_time_slice.b_field)

DATA_PATH = '/pulse/{}/ppf/signal/{}/{}/{}:{}'
user = '******'
sequence = 0

psi_coord = sal.get(
    DATA_PATH.format(PULSE_PLASMA, user, 'PRFL', 'C6',
                     sequence)).dimensions[0].data
mask = psi_coord <= 1.0
psi_coord = psi_coord[mask]

flow_velocity_tor_data = sal.get(
    DATA_PATH.format(PULSE_PLASMA, user, 'PRFL', 'VT', sequence)).data[mask]
コード例 #5
0
###############
# Make Plasma #

width = 1.0
length = 1.0
height = 3.0
peak_density = 5e19
pedestal_top = 1
neutral_temperature = 0.5
peak_temperature = 2500
impurities = [(carbon, 6, 0.005)]

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

plasma = Plasma(parent=world)
plasma.atomic_data = adas
plasma.geometry = Box(Point3D(0, -width / 2, -height / 2),
                      Point3D(length, width / 2, height / 2))

species = []

# make a non-zero velocity profile for the plasma
vy_profile = IonFunction(1E5, 0, pedestal_top=pedestal_top)


def vectorfunction3d(x, y, z):
    vy = vy_profile(x, y, z)
    return Vector3D(0, vy, 0)

コード例 #6
0
ファイル: balmer_series.py プロジェクト: cherab/core
from raysect.primitive import Sphere
from raysect.optical.observer import PinholeCamera
from raysect.optical.material.emitter.inhomogeneous import NumericalIntegrator

# tunables
ion_density = 1e19
sigma = 0.25

# setup scenegraph
world = World()

# create atomic data source
adas = OpenADAS(permit_extrapolation=True)

# PLASMA ----------------------------------------------------------------------
plasma = Plasma(parent=world)
plasma.atomic_data = adas
plasma.geometry = Sphere(sigma * 5.0)
plasma.geometry_transform = None
plasma.integrator = NumericalIntegrator(step=sigma / 5.0)

# define basic distributions
d_density = GaussianVolume(0.5 * ion_density, sigma * 10000)
e_density = GaussianVolume(ion_density, sigma * 10000)
temperature = 1 + GaussianVolume(79, sigma)
bulk_velocity = ConstantVector3D(Vector3D(-1e5, 0, 0))

d_mass = elements.deuterium.atomic_weight * atomic_mass
d_distribution = Maxwellian(d_density, temperature, bulk_velocity, d_mass)
e_distribution = Maxwellian(e_density, temperature, bulk_velocity,
                            electron_mass)
コード例 #7
0
from cherab.core.math import Constant3D, ConstantVector3D
from cherab.core.atomic import elements, Line
from cherab.openadas import OpenADAS
from cherab.core.model import SingleRayAttenuator, BeamCXLine
from gaussian_volume import GaussianVolume

integration_step = 0.02

# setup scenegraph
world = World()

# create atomic data source
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 = 10 + GaussianVolume(240, sigma)
# temperature = 1000 + GaussianVolume(4000, sigma)
bulk_velocity = ConstantVector3D(Vector3D(200e3, 0, 0))
コード例 #8
0
ファイル: camera_mse.py プロジェクト: sgibson-mse/MSE
#import_jet_mesh(world)

# ########################### PLASMA EQUILIBRIUM ############################ #
print('Plasma equilibrium')

equilibrium = MASTUEquilibrium(PULSE)
equil_time_slice = equilibrium.time(TIME)
psin_2d = equil_time_slice.psi_normalised
psin_3d = AxisymmetricMapper(equil_time_slice.psi_normalised)
inside_lcfs = equil_time_slice.inside_lcfs

# ########################### PLASMA CONFIGURATION ########################## #
print('Plasma configuration')

plasma = Plasma(parent=world)
plasma.atomic_data = adas
plasma.b_field = VectorAxisymmetricMapper(equil_time_slice.b_field)

DATA_PATH = '/pulse/{}/ppf/signal/{}/{}/{}:{}'
user = '******'
sequence = 0

psi_coord = equilibrium.f_profile_psin
mask = np.argwhere(psi_coord <= 1.0)[:, 0]

# Ignore flow velocity, set to zero vector.
flow_velocity = lambda x, y, z: Vector3D(0, 0, 0)

# Set Ti = Te
# swap this to load the thomson data
コード例 #9
0
ファイル: camera_mse.py プロジェクト: sgibson-mse/mastu
adas = OpenADAS(permit_extrapolation=True)  # create atomic data source

# ########################### PLASMA EQUILIBRIUM ############################ #
print('Plasma equilibrium')

equilibrium = MASTUEquilibrium(PULSE)
equil_time_slice = equilibrium.time(TIME)
psin_2d = equil_time_slice.psi_normalised
psin_3d = AxisymmetricMapper(equil_time_slice.psi_normalised)
inside_lcfs = equil_time_slice.inside_lcfs

# ########################### PLASMA CONFIGURATION ########################## #
print('Plasma configuration')

plasma = Plasma(parent=world)
plasma.atomic_data = adas
plasma.b_field = VectorAxisymmetricMapper(equil_time_slice.b_field)
plasma_index = equilibrium._find_nearest(equilibrium.plasma_times.data, TIME)

r = equilibrium.r.data[0, :]  #R,Z co-ordinates defined in EFIT
z = equilibrium.z.data[0, :]

#Find Psi(R,Z=0)
psi2d = np.zeros((len(r), len(z)))

for i in range(len(r)):
    for j in range(len(z)):
        psi2d[j, i] = psin_2d(r[i], z[j])

psi_z0 = psi2d[:, 32]
コード例 #10
0
ファイル: analytic_plasma.py プロジェクト: simbouwmans/core

# tunables
peak_density = 1e19
peak_temperature = 2500
magnetic_axis = (2.5, 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