Skip to content

Issue with specifying meshing algorithm #91

@abdulrahim-ss

Description

@abdulrahim-ss

Hi!
There is a bug in the current way of handling choosing the meshing algorithm in GmshMeshGenerator. If the user is using the GMSH module, then the current implementation has several issues.
First, it is only setting a value in the options without specifying which key, which should be either Mesh.Algorithm or Mesh.Algorithm3d.
Second, as per the GSMH documentation, Mesh.Algorithm and Mesh.Algorithm3d take integer values, not strings.

As such, I think a better implementation in calfem/mesh.py, replacing lines [431-433], would be

            if self.meshing_algorithm is not None:
                algos2d = {
                    "auto": 2,
                    "meshadapt": 1,
                    "del2d": 5,
                    "front2d": 6,
                    "delquad": 8,
                    "quadqs": 11,
                    "initial2d": 3
                }
                algos3d = {
                    "del3d": 1,
                    "front3d": 4,
                    "mmg3d": 7,
                    "hxt": 10,
                    "initial3d": 3,
                }
                if self.meshing_algorithm in algos3d.keys():
                    gmsh.option.setNumber("Mesh.Algorithm3d", algos3d[self.meshing_algorithm])
                else:
                    gmsh.option.setNumber("Mesh.Algorithm", algos2d[self.meshing_algorithm])

Note that GMSH themselves only allow for these keys in the commandline arg -alog for some reason, as such, I chose to only include those to avoid conflict with the case when use_gmsh_module = False

As a side note, I do not want to open a separate issue for this, but please expose the parameter cmap (for color maps) in draw_nodal_values_shaded and similar functions. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions