예제 #1
0
    def __init__(self, pixel_side, pixel_number):

        self.INTEG_STEP = 0.0005
        super().__init__(integrator=NumericalIntegrator(step=self.INTEG_STEP,
                                                        min_samples=1))

        self.pixel_number = pixel_number
        self.pixel_side = pixel_side

        self.pixel_size = 0.2 / self.pixel_side
        # print(floor(self.pixel_number/self.pixel_side))
        # print()
        self.pos_x = -(self.pixel_number %
                       self.pixel_side) * self.pixel_size + 0.1
        self.pos_y = -floor(
            self.pixel_number / self.pixel_side) * self.pixel_size + 0.1
예제 #2
0
    def __init__(self, pixel_side, pixel_id, print=True):

        self.INTEG_STEP = 0.0005
        super().__init__(integrator=NumericalIntegrator(step=self.INTEG_STEP,
                                                        min_samples=1))

        self.pixel_id = pixel_id
        self.pixel_side = pixel_side

        self.pixel_size = 0.2 / self.pixel_side
        self.pos_x = -(self.pixel_id % self.pixel_side) * self.pixel_size + 0.1
        self.pos_y = -floor(
            self.pixel_id / self.pixel_side) * self.pixel_size + 0.1

        if print:
            self.plot_pixel()
예제 #3
0
    def __init__(self, contour_type, stacking_type, grid_side):

        self.INTEG_STEP = 0.005
        self.CONTOUR_NUM = 50
        self.Z_NUM = 30

        super().__init__(integrator=NumericalIntegrator(step=self.INTEG_STEP, min_samples=1))
        # super().__init__(integrator=MyTestNumIntegrator(step=self.INTEG_STEP, min_samples=2))

        self.contour_type = contour_type
        self.stacking = stacking_type
        self.grid_side = grid_side

        self.make_profile()
        self.create_KDTree()
        self.create_grid()
예제 #4
0
    def __init__(self, shape, center, width, count, power_gain):
        super().__init__(integrator=NumericalIntegrator(step=0.001, min_samples=5))
        self.count = count
        self.center = center
        self.width = width
        self.power_gain = power_gain

        if shape == "gaussian":
            self.plaama_shape = self.gaussian
        elif shape == "lorentzian":
            self.plasma_shape = self.lorentzian
        elif shape == "quadratic":
            self.plasma_shape = self.quadratic
        elif shape == "flat_top":
            self.plasma_shape = self.flat_top
        elif shape == "beta":
            self.plasma_shape = self.beta_dist
        else:
            print("Plasma shape must be gaussian, lorentzian, quadratic, flat_top or beta.")
            sys.exit()
예제 #5
0
    def __init__(self,
                 shape='gaussian',
                 integ_step=0.01,
                 emissiv_gain=1.0,
                 mean=None,
                 cov=None):

        super().__init__(
            integrator=NumericalIntegrator(step=integ_step, min_samples=1))
        self.divertor_pos_seq = np.load('resources/divertorpos.npy')
        self.x_nl = np.array(
            [[2.4048, 5.5201, 8.6537, 11.7915, 14.9309, 18.07106, 21.2116],
             [3.8317, 7.0156, 10.1735, 13.3237, 16.4706, 19.6159, 22.7601],
             [5.1356, 8.4172, 11.6198, 14.796, 17.9598, 21.1170, 24.2701],
             [6.3802, 9.761, 13.0152, 16.2235, 19.4094, 22.5827, 25.7482],
             [7.5883, 11.0647, 14.3725, 17.616, 20.8269, 24.0190, 27.1991],
             [8.7715, 12.3386, 15.7002, 18.9801, 22.2178, 25.4303, 28.6266],
             [9.9361, 13.5893, 17.0038, 20.3208, 23.5861, 26.8202, 30.0337]])

        self.emissiv_gain = emissiv_gain
        self.x_centroid = random.uniform(-0.06, 0.06)
        self.y_centroid = random.uniform(-0.06, 0.06)

        if shape == 'gaussian':
            self.plasma_shape = self.plasma_gaussian
            if mean == None or cov == None:
                cov_value = random.uniform(0.0005, 0.005)
                self.gaussian_func = multivariate_normal(
                    [self.x_centroid, self.y_centroid],
                    [[cov_value, 0.0], [0.0, cov_value]])
            else:
                self.gaussian_func = multivariate_normal(mean, cov)

        elif shape == 'bessel':
            self.plasma_shape = self.plasma_bessel
            self.n_count = 5
            self.l_count = 5
            self.k1 = np.random.rand(self.n_count * self.l_count) * 2.0 - 1.0
            self.k2 = np.random.rand(self.n_count * self.l_count) * 2.0 - 1.0

        self.plot_profile()
예제 #6
0
# 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)
nitrogen_mass = nitrogen.atomic_weight * atomic_mass
n_distribution = Maxwellian(n_density, temperature, bulk_velocity,
                            nitrogen_mass)
e_distribution = Maxwellian(e_density, temperature, bulk_velocity,
예제 #7
0
    def __init__(self, shape, center, width, power_gain=1.0, flatlen=None):
        super().__init__(integrator=NumericalIntegrator(step=0.005, min_samples=1))
        # super().__init__(integrator=MyTestNumIntegrator(step=0.001, min_samples=5))
        self.center = np.array(center[0])
        self.width = np.array(width[0])*2.0
        self.power_gain = power_gain
        self.wid_x = None
        self.wid_y = None

        if shape == "gaussian":
            self.plasma_shape = self.gaussian
            self.wid_x_up = self.width[0][0] / 2.3548
            self.wid_x_dn = self.width[0][1] / 2.3548
            self.wid_y_up = self.width[1][1] / 2.3548
            self.wid_y_dn = self.width[1][0] / 2.3548
            self.mu_x = self.center[0]
            self.mu_y = self.center[1]
        elif shape == "lorentzian":
            self.plasma_shape = self.lorentzian
            self.wid_x_up = 2.0/self.width[0][0]
            self.wid_x_dn = 2.0/self.width[0][1]
            self.wid_y_up = 2.0/self.width[1][1]
            self.wid_y_dn = 2.0/self.width[1][0]
            self.mu_x = self.center[0]
            self.mu_y = self.center[1]
        elif shape == "quadratic":
            self.plasma_shape = self.quadratic
            self.wid_x_up = 2.0 / (self.width[0][0] * self.width[0][0])
            self.wid_x_dn = 2.0 / (self.width[0][1] * self.width[0][1])
            self.wid_y_up = 2.0 / (self.width[1][1] * self.width[1][1])
            self.wid_y_dn = 2.0 / (self.width[1][0] * self.width[1][0])
            self.mu_x = self.center[0]
            self.mu_y = self.center[1]
        elif shape == "flat_top":
            self.plasma_shape = self.flat_top
            self.wid_x_up = self.width[0][0] / 1.8248
            self.wid_x_dn = self.width[0][1] / 1.8248
            self.wid_y_up = self.width[1][1] / 1.8248
            self.wid_y_dn = self.width[1][0] / 1.8248
            self.mu_x = self.center[0]
            self.mu_y = self.center[1]
        # elif shape == "beta":
        #     self.plasma_shape = self.beta
        #     self.scaling = 5.0
        #     self.wid_x_up = -1.0 / (log(1.0 - 100.0*self.width[0][0] * self.width[0][0], 2))
        #     self.wid_x_dn = -1.0 / (log(1.0 - 100.0*self.width[0][1] * self.width[0][1], 2))
        #     self.wid_y_up = -1.0 / (log(1.0 - 100.0*self.width[1][0] * self.width[1][0], 2))
        #     self.wid_y_dn = -1.0 / (log(1.0 - 100.0*self.width[1][1] * self.width[1][1], 2))
        #     self.mu_x = 0.5 - self.center[0] * self.scaling
        #     self.mu_y = 0.5 - self.center[1] * self.scaling
        elif shape == "bell":
            self.plasma_shape = self.bell
            self.wid_x_up = self.width[0][0]/2.0
            self.wid_x_dn = self.width[0][1]/2.0
            self.wid_y_up = self.width[1][1]/2.0
            self.wid_y_dn = self.width[1][0]/2.0
            self.mu_x = self.center[0]
            self.mu_y = self.center[1]
            self.flat = flatlen
        else:
            print("Plasma shape must be gaussian, lorentzian, quadratic, flat_top or beta (nope).")
            sys.exit()