GMSH

Bcube._c2n_gmsh2cgnsMethod

Convert a cell->node connectivity with gmsh numbering convention to a cell->node connectivity with CGNs numbering convention.

Bcube._compute_space_dimMethod

Deduce the number of space dimensions from the mesh : if one (or more) dimension of the bounding box is way lower than the other dimensions, the number of space dimension is decreased.

Currently, having for instance (x,z) is not supported. Only (x), or (x,y), or (x,y,z).

Bcube._gen_2cubes_meshMethod
_gen_2cubes_mesh(output)

Only for testing purpose.

D–––E–––F | | | | | | A–––B–––C

Bcube._gen_cube_pileMethod
_gen_cube_pile(output)

Only for testing purpose.

   G------H
   |      |
   |      |

D–––E–––F | | | | | | A–––B–––C

Bcube._read_mshMethod
_read_msh(spaceDim::Int, verbose::Bool)

To use this function, the gmsh file must have been opened already (see read_msh(path::String) for instance).

The number of topological dimensions is given by the highest dimension found in the file. The number of space dimensions is deduced from the axis dimensions if spaceDim = 0. If spaceDim is set to a positive number, this number is used as the number of space dimensions.

Implementation

Global use of gmsh module. Do not try to improve this function by passing an argument such as gmsh or gmsh.model : it leads to problems.

Bcube.gen_cylinder_meshMethod
gen_cylinder_mesh(
    output,
    Lz,
    nz;
    radius = 1.0,
    lc = 1e-1,
    order = 1,
    n_partitions = 0,
    kwargs...
)

Generate a 3D mesh of a cylindrical domain and length L and write the mesh to output.

For kwargs, see gen_line_mesh.

Bcube.gen_cylinder_shell_meshMethod
gen_cylinder_shell_mesh(
    output,
    nθ,
    nz;
    radius = 1.0,
    lz = 1.0,
    lc = 1e-1,
    order = 1,
    n_partitions = 0,
    recombine = false,
    transfinite = false,
    kwargs...,
)

Implementation

Extrusion is not used to enable "random" tri filling (whereas with extrusion we can at worse obtain regular rectangle triangle)

Bcube.gen_disk_meshMethod
gen_disk_mesh(
    output;
    radius = 1.0,
    lc = 1e-1,
    order = 1,
    n_partitions = 0,
    kwargs...
)

Generate a 2D mesh of a disk domain and write the mesh to output.

For kwargs, see gen_line_mesh.

Bcube.gen_hexa_meshMethod
gen_hexa_mesh(
    output,
    type;
    recombine = false,
    n = [2, 2, 2],
    l = [1.0, 1.0, 1.0],
    center = [0.0, 0.0, 0.0],
    order = 1,
    kwargs...
)

Generate a 3D mesh of a hexahedral domain and write the mesh to output. Use type to specify the element types: :tetra or :hexa.

For kwargs, see gen_line_mesh.

Implementation

Notations from https://cgns.github.io/CGNSdocscurrent/sids/conv.html We could also use extrusion.

Bcube.gen_line_meshMethod
gen_line_mesh(
    output;
    nx = 2,
    lx = 1.0,
    xc = 0.0,
    order = 1,
    bnd_names = ("LEFT", "RIGHT"),
    n_partitions = 0,
    kwargs...
)

Generate a 1D mesh of a segment and write to "output".

Available kwargs are

  • verbose : true or false to enable gmsh verbose
  • msh_format : floating number indicating the output msh format (for instance : 2.2)
  • split_files : if true, create one file by partition
  • create_ghosts : if true, add a layer of ghost cells at every partition boundary
Bcube.gen_mesh_around_diskMethod
gen_mesh_around_disk(
    output;
    r_in = 1.0,
    r_ext = 10.0,
    nθ = 360,
    nr = 100,
    nr_prog = 1.05,
    order = 1,
    recombine = true,
    bnd_names = ("Farfield", "Wall"),
    n_partitions = 0,
    kwargs...
)

Mesh the 2D domain around a disk.

For kwargs, see gen_line_mesh.

Bcube.gen_rectangle_meshMethod
gen_rectangle_mesh(
    output,
    type;
    transfinite = false,
    nx = 2,
    ny = 2,
    lx = 1.0,
    ly = 1.0,
    xc = -1.0,
    yc = -1.0,
    order = 1,
    bnd_names = ("North", "South", "East", "West"),
    n_partitions = 0,
    write_geo = false,
    transfinite_lines = true,
    lc = 1e-1,
    kwargs...
)

Generate a 2D mesh of a rectangle domain and write the mesh to output. Use type to specify the element types: :tri or :quad.

For kwargs, see gen_line_mesh.

Bcube.gen_rectangle_mesh_with_tri_and_quadMethod
gen_rectangle_mesh_with_tri_and_quad(
    output;
    nx = 2,
    ny = 2,
    lx = 1.0,
    ly = 1.0,
    xc = -1.0,
    yc = -1.0,
    order = 1,
    n_partitions = 0,
    kwargs...
)

Generate a 2D mesh of a rectangle domain and write the mesh to output. The domain is split vertically in two parts: the upper part is composed of 'quad' cells and the lower part with 'tri'. North D –––- C | :quad | West M₁|––––-|M₂ East | :tri | A –––- B South

For kwargs, see gen_line_mesh.

Bcube.gen_sphere_meshMethod
gen_sphere_mesh(
    output;
    radius = 1.0,
    lc = 1e-1,
    order = 1,
    n_partitions = 0,
    kwargs...,
)

Generate the mesh of a sphere (surface of topological dimension 2, spatial dimension 3).

Bcube.gen_star_disk_meshMethod
gen_star_disk_mesh(
    output,
    ε,
    m;
    nθ = 360,
    radius = 1.0,
    lc = 1e-1,
    order = 1,
    n_partitions = 0,
    kwargs...,
)

Generate a 2D mesh of a star domain and write the mesh to output. The "star" wall is defined by $r_{wall} = R \left( 1 + \varepsilon \cos(m \theta) \right)$.

For kwargs, see gen_line_mesh.

Bcube.gen_torus_shell_meshMethod
gen_torus_shell_mesh(output, rint, rext; order = 1, lc = 0.1, write_geo = false, kwargs...)

Generate the mesh of the shell of a torus, defined by its inner radius rint and exterior radius rext.

The torus revolution axis is the z-axis.

Bcube.nodes_gmsh2cgnsMethod
nodes_gmsh2cgns(entity::AbstractEntityType, nodes::AbstractArray)

Reorder nodes of a given entity from the Gmsh format to CGNS format.

See https://gmsh.info/doc/texinfo/gmsh.html#Node-ordering

Bcube.read_mshFunction
read_msh(path::String, spaceDim::Int = 0; verbose::Bool = false)

Read a .msh file designated by its path.

See read_msh() for more details.

Bcube.read_msh_with_cell_namesFunction
read_msh_with_cell_names(path::String, spaceDim = 0; verbose = false)

Read a .msh file designated by its path and also return names and tags