DIII-D / GITRmProject

Apache License 2.0
0 stars 0 forks source link

GITRmProject - gmsh_automated_scripts

Hi User! As part of the effort to automate the workflow of DiMES local impurity transport simulations at DIII-D using the GITRm transport code, we propose a tool that generates meshes for simple DiMES geometries using the gmsh Python API. This user-friendly tool allows anyone to easily simulate their preferred DiMES setup without the need to manually draw and mesh the geometry each time.

Dependecies

This package was tested using pyhton version >= 3.10, gmsh version 4.13.1 and requires the math package

Build

This package was built using poetry , if you don't know what poetry is please check out: https://python-poetry.org/. Also, a short tutorial on how to use poetry with conda or mamba is provided in the wiki: https://github.com/DIII-D/GITRmProject/wiki/Use-gmsh-scripts--with-poetry

Documentation

The package consists of two files encoding all functions needed to run generate_dimes_mesh(input_dict,**kwargs)

generate_dimes_mesh(input_dict,**kwargs) automatically generates the DiMES mesh for a given input.

PARAMETERS: (KEYWORDS DESCRIPTION IS AFTER kwargs)

GEOMETRY KEYWORDS:

The DiMES geometry can take one of the following shapes:

On top of the DiMES head different coatings can be added as discussed later.

The DiMES geometry is defined by its center and radius:

Right now only the following 4 directions are allowed:

ax = ± 1, ay = 0, az = 0
ax = 0, ay = ± 1, az = 0

Plasma Volume:

The DiMES geometry is enclosed within a volume known as plasma_volume, representing the plasma background. This volume is a symmetrical box extending in three directions:

The plasma volume extends symmetrically in these directions:

Dots (Material Coatings):

On the DiMES top surface, dots represent the material coatings. Two geometries are currently supported:

Each dot's position and dimensions are specified within an input_dict dictionary. The user must manually create this dictionary, where each dot is defined by a unique label followed by values that describe its geometry, shape, and position.

Each dot can be tilted around the same rotation axis as DiMES, identified by its components (ax, ay, az) and the angle theta_dot (deg).

theta_dot can be set in the input_dict, as shown later.

NOTE: tilting both DiMES head and dots can result in wrong geometry and mesh generation! Try to avoid it.

Right now only the following 4 directions are allowed:

ax = ± 1, ay = 0, az = 0
ax = 0, ay = ± 1, az = 0

Example Input Dictionary:

This example illustrates the structure for two dots: one circle and one rectangle.


Names = ["Dot_1", "Dot_2"]

input_dict = {
    Names[0]: {
        "shape": "circle",
        "x": 0,
        "y": 0.75,
        "radius": 0.05  # Radius for the circle
        "theta_dot": 10
    },
    Names[1]: {
        "shape": "rectangle",
        "x": -0.5,
        "y": -0.25,
        "width": 1,    # Width of the rectangle
        "height": 0.5  # Height of the rectangle
        "theta_dot": 5
    }
    # Additional dots can be added as needed
}

Each dot has the following properties:

For "Dot_1" (shape: "circle"), the x and y coordinates represent the center of the circle, and the radius defines its size.

For "Dot_2" (shape: "rectangle"), the x and y coordinates denote the lower-left corner of the rectangle, while the following values define its size:

Rotation:

The entire DiMES top surface and dots can be rotated by an angle theta_dimes (in degrees) relative to a direction defined by the unit vector components:

Right now only the following 4 directions are allowed:

ax = ± 1, ay = 0, az = 0
ax = 0, ay = ± 1, az = 0

if you pick other directions the code will produce an error. If requested, the feature of rotating around any direction will be added in future releases.

To make a DiMES head with no coatings you can simply set the no_dots flag:

MESH KEYWORDS:

Before generating the mesh, users can configure several options: