DistributedGeneratedMesh

Create a line, square, or cube mesh with uniformly spaced or biased elements.

Description

Similar to GeneratedMesh - builds lines, rectangles and rectangular prisms. It differs though in the way the mesh is constructed in parallel. While GeneratedMesh creates a full copy of the mesh on every processor - DistributedGeneratedMesh only creates the elements / nodes each processor is assigned. This makes it _much_ faster in parallel and much leaner in memory.

note

Be aware: DistributedGeneratedMesh turns on parallel_type = distributed. So make sure that everything you're using in your problem works with that before using this!

More Information

DistributedGeneratedMesh works by first creating a "dual graph" of the element connectivity - before ever building an elements. It then uses METIS to partition that graph - assigning elements to processors. Then, each processor can read the partition map and build only the elements that need to be on that processor. Final steps include adding in "ghosted" elements and making sure that boundary conditions are right.

Developer Information

If you're going to enhance DistributedGeneratedMesh the structure is based off of template specialization. To make it build new element types you need to specialize a number of templated methods. These can be found in DistributedGeneratedMesh.C:


dof_id_type
elem_id(const dof_id_type /*nx*/,
        const dof_id_type /*ny*/,
        const dof_id_type /*i*/,
        const dof_id_type /*j*/,
        const dof_id_type /*k*/);

dof_id_type
num_neighbors(const dof_id_type /*nx*/,
              const dof_id_type /*ny*/,
              const dof_id_type /*nz*/,
              const dof_id_type /*i*/,
              const dof_id_type /*j*/,
              const dof_id_type /*k*/);

void
get_neighbors(const dof_id_type /*nx*/,
              const dof_id_type /*ny*/,
              const dof_id_type /*nz*/,
              const dof_id_type /*i*/,
              const dof_id_type /*j*/,
              const dof_id_type /*k*/,
              std::vector<dof_id_type> & /*neighbors*/);

inline dof_id_type
node_id(const ElemType /*type*/,
        const dof_id_type /*nx*/,
        const dof_id_type /*ny*/,
        const dof_id_type /*i*/,
        const dof_id_type /*j*/,
        const dof_id_type /*k*/);

Node *
add_point(const dof_id_type /*nx*/,
          const dof_id_type /*ny*/,
          const dof_id_type /*nz*/,
          const dof_id_type /*i*/,
          const dof_id_type /*j*/,
          const dof_id_type /*k*/,
          const ElemType /*type*/,
          MeshBase & /*mesh*/);

void
add_element(const dof_id_type /*nx*/,
            const dof_id_type /*ny*/,
            const dof_id_type /*nz*/,
            const dof_id_type /*i*/,
            const dof_id_type /*j*/,
            const dof_id_type /*k*/,
            const dof_id_type /*elem_id*/,
            const processor_id_type /*pid*/,
            const ElemType /*type*/,
            MeshBase & /*mesh*/,
            bool /*verbose*/);

void
get_indices(const dof_id_type /*nx*/,
            const dof_id_type /*ny*/,
            const dof_id_type /*elem_id*/,
            dof_id_type & /*i*/,
            dof_id_type & /*j*/,
            dof_id_type & /*k*/);

void
get_ghost_neighbors(const dof_id_type /*nx*/,
                    const dof_id_type /*ny*/,
                    const dof_id_type /*nz*/,
                    const MeshBase & /*mesh*/,
                    std::set<dof_id_type> & /*ghost_elems*/);

void
set_boundary_names(BoundaryInfo & /*boundary_info*/);

Example Syntax

[Mesh]
  type = ImageMesh
  dim = 3
  file_base = stack/test
  file_suffix = png
[]
(../moose/test/tests/functions/image_function/image_mesh_3d.i)

Input Parameters

  • file_suffixSuffix of the file to open, e.g. 'png'

    C++ Type:std::string

    Description:Suffix of the file to open, e.g. 'png'

  • zmax1Upper Z Coordinate of the generated mesh

    Default:1

    C++ Type:double

    Description:Upper Z Coordinate of the generated mesh

  • zmin0Lower Z Coordinate of the generated mesh

    Default:0

    C++ Type:double

    Description:Lower Z Coordinate of the generated mesh

  • parallel_typeDEFAULTDISTRIBUTED: Always use libMesh::DistributedMesh REPLICATED: Always use libMesh::ReplicatedMesh DEFAULT: Use libMesh::ReplicatedMesh unless --distributed-mesh is specified on the command line

    Default:DEFAULT

    C++ Type:MooseEnum

    Description:DISTRIBUTED: Always use libMesh::DistributedMesh REPLICATED: Always use libMesh::ReplicatedMesh DEFAULT: Use libMesh::ReplicatedMesh unless --distributed-mesh is specified on the command line

  • fileName of single image file to extract mesh parameters from. If provided, a 2D mesh is created.

    C++ Type:FileName

    Description:Name of single image file to extract mesh parameters from. If provided, a 2D mesh is created.

  • allow_renumberingTrueIf allow_renumbering=false, node and element numbers are kept fixed until deletion

    Default:True

    C++ Type:bool

    Description:If allow_renumbering=false, node and element numbers are kept fixed until deletion

  • xmin0Lower X Coordinate of the generated mesh

    Default:0

    C++ Type:double

    Description:Lower X Coordinate of the generated mesh

  • ymin0Lower Y Coordinate of the generated mesh

    Default:0

    C++ Type:double

    Description:Lower Y Coordinate of the generated mesh

  • ymax1Upper Y Coordinate of the generated mesh

    Default:1

    C++ Type:double

    Description:Upper Y Coordinate of the generated mesh

  • bias_z1The amount by which to grow (or shrink) the cells in the z-direction.

    Default:1

    C++ Type:double

    Description:The amount by which to grow (or shrink) the cells in the z-direction.

  • nx1Number of elements in the X direction

    Default:1

    C++ Type:unsigned int

    Description:Number of elements in the X direction

  • ny1Number of elements in the Y direction

    Default:1

    C++ Type:unsigned int

    Description:Number of elements in the Y direction

  • nz1Number of elements in the Z direction

    Default:1

    C++ Type:unsigned int

    Description:Number of elements in the Z direction

  • ghosting_patch_sizeThe number of nearest neighbors considered for ghosting purposes when 'iteration' patch update strategy is used. Default is 5 * patch_size.

    C++ Type:unsigned int

    Description:The number of nearest neighbors considered for ghosting purposes when 'iteration' patch update strategy is used. Default is 5 * patch_size.

  • max_leaf_size10The maximum number of points in each leaf of the KDTree used in the nearest neighbor search. As the leaf size becomes larger,KDTree construction becomes faster but the nearest neighbor searchbecomes slower.

    Default:10

    C++ Type:unsigned int

    Description:The maximum number of points in each leaf of the KDTree used in the nearest neighbor search. As the leaf size becomes larger,KDTree construction becomes faster but the nearest neighbor searchbecomes slower.

  • elem_typeThe type of element from libMesh to generate (default: linear element for requested dimension)

    C++ Type:MooseEnum

    Description:The type of element from libMesh to generate (default: linear element for requested dimension)

  • file_baseImage file base to open, use this option when a stack of images must be read (ignored if 'file' is given)

    C++ Type:FileNameNoExtension

    Description:Image file base to open, use this option when a stack of images must be read (ignored if 'file' is given)

  • cells_per_pixel1The number of mesh cells per pixel, must be <=1

    Default:1

    C++ Type:double

    Description:The number of mesh cells per pixel, must be <=1

  • file_rangeRange of images to analyze, used with 'file_base' (ignored if 'file' is given)

    C++ Type:std::vector

    Description:Range of images to analyze, used with 'file_base' (ignored if 'file' is given)

  • scale_to_oneTrueWhether or not to scale the image so its max dimension is 1

    Default:True

    C++ Type:bool

    Description:Whether or not to scale the image so its max dimension is 1

  • bias_x1The amount by which to grow (or shrink) the cells in the x-direction.

    Default:1

    C++ Type:double

    Description:The amount by which to grow (or shrink) the cells in the x-direction.

  • bias_y1The amount by which to grow (or shrink) the cells in the y-direction.

    Default:1

    C++ Type:double

    Description:The amount by which to grow (or shrink) the cells in the y-direction.

  • gauss_lobatto_gridFalseGrade mesh into boundaries according to Gauss-Lobatto quadrature spacing.

    Default:False

    C++ Type:bool

    Description:Grade mesh into boundaries according to Gauss-Lobatto quadrature spacing.

  • xmax1Upper X Coordinate of the generated mesh

    Default:1

    C++ Type:double

    Description:Upper X Coordinate of the generated mesh

Optional Parameters

  • partitionerdefaultSpecifies a mesh partitioner to use when splitting the mesh for a parallel computation.

    Default:default

    C++ Type:MooseEnum

    Description:Specifies a mesh partitioner to use when splitting the mesh for a parallel computation.

  • centroid_partitioner_directionSpecifies the sort direction if using the centroid partitioner. Available options: x, y, z, radial

    C++ Type:MooseEnum

    Description:Specifies the sort direction if using the centroid partitioner. Available options: x, y, z, radial

Partitioning Parameters

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Description:Set the enabled status of the MooseObject.

  • patch_update_strategyneverHow often to update the geometric search 'patch'. The default is to never update it (which is the most efficient but could be a problem with lots of relative motion). 'always' will update the patch for all slave nodes at the beginning of every timestep which might be time consuming. 'auto' will attempt to determine at the start of which timesteps the patch for all slave nodes needs to be updated automatically.'iteration' updates the patch at every nonlinear iteration for a subset of slave nodes for which penetration is not detected. If there can be substantial relative motion between the master and slave surfaces during the nonlinear iterations within a timestep, it is advisable to use 'iteration' option to ensure accurate contact detection.

    Default:never

    C++ Type:MooseEnum

    Description:How often to update the geometric search 'patch'. The default is to never update it (which is the most efficient but could be a problem with lots of relative motion). 'always' will update the patch for all slave nodes at the beginning of every timestep which might be time consuming. 'auto' will attempt to determine at the start of which timesteps the patch for all slave nodes needs to be updated automatically.'iteration' updates the patch at every nonlinear iteration for a subset of slave nodes for which penetration is not detected. If there can be substantial relative motion between the master and slave surfaces during the nonlinear iterations within a timestep, it is advisable to use 'iteration' option to ensure accurate contact detection.

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • nemesisFalseIf nemesis=true and file=foo.e, actually reads foo.e.N.0, foo.e.N.1, ... foo.e.N.N-1, where N = # CPUs, with NemesisIO.

    Default:False

    C++ Type:bool

    Description:If nemesis=true and file=foo.e, actually reads foo.e.N.0, foo.e.N.1, ... foo.e.N.N-1, where N = # CPUs, with NemesisIO.

  • construct_node_list_from_side_listTrueWhether or not to generate nodesets from the sidesets (usually a good idea).

    Default:True

    C++ Type:bool

    Description:Whether or not to generate nodesets from the sidesets (usually a good idea).

  • patch_size40The number of nodes to consider in the NearestNode neighborhood.

    Default:40

    C++ Type:unsigned int

    Description:The number of nodes to consider in the NearestNode neighborhood.

Advanced Parameters

  • dimThe dimension of the mesh to be generated

    C++ Type:MooseEnum

    Description:The dimension of the mesh to be generated

Main Parameters