Skip to content

Voronoi-based polycrystal generator #8

Description

@petlenz

Opens the metals / alloys market — the largest computational-mechanics
community. Direct competition with Neper (the gold standard, free,
mature, dominant). Per ROADMAP.md this is a Horizon 3 expansion item;
not the headline feature, but it dramatically increases addressable
users.

Proposed fix

template <typename T = double>
class polycrystal_generator final : public rve_generator_base<T> {
public:
  // Schema fields:
  //   target_grain_count: number of grains in the unit cell
  //   grain_size_distribution: name of a distribution (lognormal)
  //   tessellation: "voronoi" | "laguerre" (radius-weighted)
  //   periodic: bool (use periodic Voronoi)

  shape_vector compute(input_vector& inputs,
                       termination_base<T> const& term,
                       std::array<value_type, 3> const& domain_box,
                       progress_options const& opts = {}) override {
    // 1. Sample seed points (count from termination's target).
    // 2. Compute periodic Voronoi (or Laguerre) tessellation.
    // 3. Convert each cell to a `polyhedron_cell<T>` shape.
    // 4. Assign per-grain orientation (uniform random or A2-driven).
    // 5. Return shape vector.
  }
};

Required dependencies

  • Voro++ or CGAL for the tessellation. CGAL is heavier but
    produces topologically clean cells with periodic support; Voro++
    is lighter but the periodic implementation is less robust.
  • A new polyhedron_cell<T> shape: stores its vertex list and face
    topology, implements is_inside via half-space tests.

Two key challenges

1. Cell-cell collision — for polycrystal generation, cells fully
fill the domain (no inter-cell gaps). The collision check is
unnecessary if generation is via tessellation directly. Implement as
a collision_details overload that returns false when the cells share
a face (which they always do in tessellation output).

2. Periodic boundary handling — for FFT homogenization, the
tessellation must be periodic. Both CGAL and Voro++ have periodic
modes; Neper uses a custom routine.

Output extensions

  • gmsh emits Volume(...) per cell with Physical Volume("grain_N")
    per-grain tags.
  • DAMASK material.config integration: per-grain orientation +
    material — natural fit for crystal plasticity FFT homogenization.

Acceptance

  • polycrystal_generator registered for "type": "voronoi".
  • Periodic tessellation correctness: opposite faces match.
  • Grain-size statistics control: target lognormal distribution
    with mean and std-dev parameters.
  • Test: generate 100 grains in a unit cube with target grain
    size distribution; assert empirical histogram matches the
    input within tolerance.
  • DAMASK material.config emission for crystal plasticity.

Out of scope for this PR

  • Texture (orientation distribution) — depends on #112 FOD support
    landing.
  • Grain growth simulation, recrystallization — material-history
    modelling, not generation.
  • Mesh-conformal grain boundaries — use the standard gmsh meshing
    on the tessellation output.

Branch with full draft + design notes: feature/voronoi-polycrystals (docs/issues/114-*.md).

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