morphogen.laser.run

Configuration files of laser-architectured sheets (morphogen laser).

Example (the reference case of Wang 2022, thesis ch. 5, and its optimization):

laser_sheet:
  material: annealed_ms1500        # aisi430, dp1180, or a mapping (preset + changes)
  treatment: hardening             # carburizing, nitriding, alloying
  configuration: symmetric         # single: the upper face only
  layers: 4                        # through the thickness
  laser:
    beam: {power: 150, speed: 10, radius: 0.5, absorptivity: 0.55}
    bottom: {power: 100, speed: 10, radius: 0.6, absorptivity: 0.55, profile: tophat}
    pause: 30                      # s between tracks
  specimen: {kind: dogbone, length: 30, width: 5, thickness: 1.0}
  element: 0.5                     # mm
  pattern: {kind: corrugated, count: 1, amplitude: 1.0, period: 15}
  loading: {kind: tension}         # or {kind: bending, span: 30, deflection: 1.0}
  directions: [0, 45, 90]          # optional: a specimen per direction (anisotropy)
  compare:                         # reference patterns, evaluated too
    base: {kind: none}
    straight: {kind: straight, count: 1}
optimization:                      # optional
  method: bayesian                 # grid, nelder_mead, differential_evolution, genetic
  evaluations: 30
  objective: strength_ductility    # energy, uniform_elongation, tensile_strength...
  parameters: {pattern.amplitude: [0.0, 2.5], pattern.period: [6.0, 30.0]}
  constraints: {yield_strength: [400, null]}
  check_element: 0.25              # the best design again on a finer mesh
cellular:                          # optional: a cellular design (laser.cells)
  phases: wang                     # ferrite and martensite of Wang et al. 2023
  size: 0.5                        # mm, the cells
  objective: ductility             # energy, tensile_strength, strength_ductility
  constraints: {tensile_strength: [700, null]}
  start: {amplitude: 1.5, period: 10}  # a track drawn by a spot of min_width cells
  method: exchange                 # swap (BESO), hca, topology
  symmetry: [point]
  period: 10                       # mm: the cells change by periods
  min_width: 2                     # cells: the spot
  iterations: 40
  realize: true                    # its tracks treated by the process above
seed: 1
outputs:
  directory: out/laser
  figures: true                    # PNG figures (matplotlib)
  fields: [vti]                    # hardness and peak temperature maps
  gcode: true                      # the laser path of the best design

Results: laser.json (the settings, the measures of each design: the pattern, the references, the optimum and its check), curves.csv (the engineering curves), history.csv (the evaluations of the optimization), path.gcode and path.csv (the tracks), fields.vti (hardness, treated share and peak temperature of the sheet, a pixel per 0.05 mm, a layer per slice) and the figures; with a cellular design, cells.csv (its history), cells_design.csv (the phase of each cell, a row per row of cells), cells_path.gcode (its tracks) and cells.png; the measures of its tracks treated by the process are the design cellular of laser.json.

class morphogen.laser.run.LaserConfig(case: SheetCase, compare: dict, optimization: dict | None, seed: int, cellular: dict | None, directory: Path, figures: bool, fields: list, gcode: bool, resolution: float, source: dict = <factory>)[source]

Bases: object

A validated configuration: the case, the references, the optimization.

morphogen.laser.run.load_laser_config(source, *, base_dir=None) → LaserConfig[source]

Validate a configuration (file path or mapping).

morphogen.laser.run.case_from_config(sec: dict) → SheetCase[source]

A SheetCase of a laser_sheet section.

morphogen.laser.run.cellular_problem(cel: dict, case: SheetCase)[source]

The CellProblem of a cellular section on the specimen of the case.

morphogen.laser.run.run_cellular(cel: dict, case: SheetCase, *, log=None)[source]

Run the cellular design of a cellular section: the start (a track drawn by the spot), the automaton or the densities, and the tracks of the result treated by the process of the case (realize). Returns the optimization, the start and the evaluated case of the tracks (or None).

morphogen.laser.run.run_laser(cfg: LaserConfig, *, callback=None, log=None) → tuple[dict, Path][source]

Evaluate the designs of a configuration, optimize when asked, write the results; returns the summary and the folder.

morphogen.laser.run.write_laser_results(cfg: LaserConfig, designs: dict, opt_out) → dict[source]

Write the files of the results (see the module); returns the summary.

morphogen.laser.run.write_cellular_results(cfg: LaserConfig, cells_out) → dict[source]

Write the files of a cellular design (see the module); returns its summary.

morphogen.laser.run.hardness_map(case: SheetCase, path, resolution: float = 0.05) → dict[source]

The treated parallel part of a case on a grid of pixels (resolution mm): the hardness, treated share and peak temperature of each layer, (nx, ny, layers).