Skip to content

Part scale

openwaam.partscale.ThermalConfig dataclass

Grid, boundary conditions, heat source and output settings of the part-scale thermal model. SI units.

Source code in openwaam/partscale/thermal.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@dataclass
class ThermalConfig:
    """Grid, boundary conditions, heat source and output settings of the part-scale thermal model. SI units."""
    voxel: float = 1.0e-3                 # in-plane voxel size
    voxel_z: float | None = None          # default: layer height / round(layer height / voxel)
    substrate_thickness: float = 10e-3
    substrate_margin: float = 20e-3       # plate extends this far beyond the part in x and y
    substrate_size: tuple | None = None   # (lx, ly) overrides the margin
    T_ambient: float = 300.0
    T_substrate: float = 300.0            # preheat
    h_conv: float = 15.0                  # W/m2/K on free surfaces
    h_base: float = 200.0                 # W/m2/K under the plate (fixture contact)
    deposit: bool = True                  # False: heat source only, no material added
    deposit_superheat: float = 100.0      # new metal arrives at liquidus + this
    # Goldak double ellipsoid; None -> derived from the bead size
    goldak_a: float | None = None         # half width
    goldak_b: float | None = None         # depth
    goldak_cf: float | None = None        # front length
    goldak_cr: float | None = None        # rear length
    goldak_ff: float = 0.6
    dt_safety: float = 0.9
    monitor_dt: float = 0.25              # interval for probes and melt-pool size
    cooling_window: tuple = (1073.15, 773.15)   # t8/5 by default
    final_cooling: float = 60.0           # extra simulated time after the last move
    pool_conductivity_factor: float = 1.0  # multiplies the liquid conductivity: stands in for convection in the
                                          # pool, which this model does not resolve. 2-4 is common practice; the
                                          # time step shrinks by about the same factor
    T_critical: float | None = None       # solid-state temperature of concern (K) for the time-above map; default 0.67 T_solidus
    solidification_window: float = 150.0  # K below the solidus over which the solidification cooling rate is measured
    interpass_temperature: float | None = None   # hold before each layer until the start point is below this, K
    interpass_max_wait: float = 3600.0    # give up waiting after this long, s
    probes: dict = field(default_factory=dict)  # name -> (x, y, z) in part coordinates

openwaam.partscale.ThermalModel

Transient temperature field of a build on a voxel grid.

The torch follows a Trajectory. Call run(), then read summary(), history, probe_T and interpass, or write the fields with to_vtk(path).

bead_direction()

Unit vector (nx, ny, nz, 3) along the bead that laid each voxel; zero in the plate and where nothing was deposited. In the plate under the part it is the direction of the first bead above, which is what the distortion model needs for the plate's plastic strain.

fields()

Thermal-history maps on the voxels of the part (plate excluded), as a dict of arrays.

born, layer, peak_temperature, time_liquid (time at or above the liquidus; thin edges can quench through it within one step and show zero), time_above_critical (since the last melting), reheat_peak (highest temperature after first cooling: tells whether the metal was remelted by its neighbours), solidification_time (time to cool from the solidus to solidus - window), cooling_rate (K/s over that window), landing_temperature (temperature of the metal below at the instant this voxel was deposited; it includes preheating by the approaching arc), t_act (time of deposition).

run(t_end=None, verbose=True, snapshot_times=(), snapshot_cb=None)

Run to t_end (default: end of the trajectory plus final_cooling).

With cfg.interpass_temperature set, the torch waits before every layer until the point where the arc will strike has cooled to that temperature. Waiting stretches the build: t is wall-clock time, t - t_shift is time along the trajectory, waits holds the wait per layer.

stored_energy()

Enthalpy in the active voxels relative to everything at ambient, J.

openwaam.partscale.InherentStrainModel

Layer-wise inherent strain analysis on a structured hex mesh.

Parameters

active : bool array (ex, ey, ez), elements that exist at the end of the build group : int array, activation step of each element (-1 = present from the start) d : element edge lengths inherent_strain : (exx, eyy, ezz) applied to every newly activated element, or None for the default -(1 - nu) * yield / E in-plane (the strain that leaves a fully restrained layer at yield), zero through the thickness. It may also be a field, one strain per element, of shape (ex, ey, ez, 3) or (ex, ey, ez, 6) with engineering shear (xy, yz, zx): this is how a strain along the bead is given when beads run in different directions (see along_direction). substrate_strain : optional array (ex, ey, ez) of in-plane strain, (ex, ey, ez, 3) of (exx, eyy, ezz), or (ex, ey, ez, 6), for elements that exist from the start: the plate under the bead, which also yields. Applied when the first layer is laid. See plastic_strain_from_peak_temperature. yield_cap : if True the von Mises stress is capped at yield (elastic, perfectly plastic), by initial-strain iterations in every step. yield_field : optional array (ex, ey, ez) of yield stress per element (plate and filler often differ); default is the material's.

along_direction(e, direction) staticmethod

Strain e along the unit vectors direction (..., 3) and none across them, as the six components (xx, yy, zz, xy, yz, zx) with engineering shear: e d d^T. e may be an array matching the leading shape. This is the strain of a bead that shrinks along its length, for a bead in any direction.

from_thermal(thermal, material=None, coarsen=(3, 3, 1), layers_per_step=1, inherent_strain=None, setting=None, fractions=None, T_cut=1273.0, plate_yield=None, deposit_yield=None) classmethod

Build the mesh by coarsening a finished ThermalModel.

setting "wall", "block" or "isotropic" (see DISTORTION_SETTINGS), or None for the uniform elastic default of earlier versions. With a setting the deposit gets its thermal shrinkage along and across each bead in the fractions of that setting, taken from the direction the thermal model recorded for every voxel; the plate gets the plastic strain of its peak temperature, distributed the same way; and the stress is capped at yield. fractions (along, across, vertical) overrides the setting's.

plastic_strain_from_peak_temperature(T_peak, material, T_cut=1273.0, T0=300.0, yield_stress=None) staticmethod

Strain left in metal that was heated to T_peak while held by cold metal around it.

Held in its plane, it yields in compression once cte * dT exceeds yield / E and keeps the excess as plastic strain: e = -(cte * dT - yield / E) in the plane, -2 e through the thickness (plastic flow keeps volume). Zero where the plate stayed cool. Returns an array (..., 3); use it as substrate_strain with yield_cap=True, which handles the yielding back in tension on cooling.

run(clamp='bottom', verbose=False, release=True)

clamp: "bottom" fixes every node on the underside of the plate during the build; "corners" fixes only the four bottom corner regions; a boolean array over the nodes (ex + 1, ey + 1, ez + 1) fixes those nodes. release: False keeps the clamp on, for a part measured in its fixture; the released state then equals the clamped one.

thermal_shrinkage(material, T_cut=1273.0, T0=300.0) staticmethod

Inherent strain (exx, eyy, ezz) of deposited metal as plain thermal contraction from the temperature below which it carries stress (T_cut) to T0. It is several times the yield strain, so use it with yield_cap=True: the cap, not the strain, then sets the stress, as in a real bead.

openwaam.partscale.DistortionResult dataclass