Modulus Inferencers

Pointwise Inferencer

class modulus.domain.inferencer.pointwise.PointwiseInferencer(nodes: List[Node], invar: Dict[str, array], output_names: List[str], batch_size: int = 1024, plotter: Optional[InferencerPlotter] = None, requires_grad: bool = False, model=None)[source]

Bases: Inferencer

Pointwise Inferencer that allows inferencing on pointwise data

Parameters
  • nodes (List[Node]) – List of Modulus Nodes to unroll graph with.

  • invar (Dict[str, np.ndarray (N, 1)]) – Dictionary of numpy arrays as input.

  • output_names (List[str]) – List of desired outputs.

  • batch_size (int, optional) – Batch size used when running validation, by default 1024

  • plotter (InferencerPlotter) – Modulus plotter for showing results in tensorboard.

  • requires_grad (bool = False) – If automatic differentiation is needed for computing results.

Voxel Inferencer

class modulus.domain.inferencer.voxel.VoxelInferencer(bounds: List[List[int]], npoints: List[int], nodes: List[Node], output_names: List[str], export_map: Union[None, Dict[str, List[str]]] = None, invar: Dict[str, array] = {}, batch_size: int = 1024, mask_fn: Optional[Callable] = None, mask_value: float = nan, plotter=None, requires_grad: bool = False, log_iter: bool = False, model=None)[source]

Bases: PointVTKInferencer

Inferencer for creating volex representations. This inferencer works bu creating a uniform mesh of voxels and masking out the ones defined by a callable function. The result is a voxel based representation of any complex geometery at any resolution.

Parameters
  • bounds (List[List[int]]) – List of domain bounds to form uniform rectangular domain

  • npoints (List[int]) – Resolution of voxels in each domain

  • nodes (List[Node]) – List of Modulus Nodes to unroll graph with.

  • output_names (List[str]) – List of desired outputs.

  • export_map (Dict[str, List[str]], optional) – Export map dictionary with keys that are VTK variables names and values that are lists of output variables. Will use 1:1 mapping if none is provided, by default None

  • invar (Dict[str, np.array], optional) – Dictionary of additional numpy arrays as input, by default {}

  • mask_fn (Union[Callable, None], optional) – Masking function to remove points from inferencing, by default None

  • mask_value (float, optional) – Value to assign masked points, by default Nan

  • plotter (Plotter, optional) – Modulus Plotter for showing results in tensorboard., by default None

  • requires_grad (bool, optional) – If automatic differentiation is needed for computing results., by default True

  • log_iter (bool, optional) – Save results to different file each call, by default False

Point VTK Inferencer

class modulus.domain.inferencer.vtkpointwise.PointVTKInferencer(vtk_obj: VTKBase, nodes: List[Node], input_vtk_map: Dict[str, List[str]], output_names: List[str], invar: Dict[str, array] = {}, batch_size: int = 1024, mask_fn: Optional[Callable] = None, mask_value: float = nan, plotter=None, requires_grad: bool = False, log_iter: bool = False, model=None)[source]

Bases: PointwiseInferencer

Pointwise inferencer using mesh points of VTK object

Parameters
  • vtk_obj (VTKBase) – Modulus VTK object to use point locations from

  • nodes (List[Node]) – List of Modulus Nodes to unroll graph with.

  • input_vtk_map (Dict[str, List[str]]) – Dictionary mapping from Modulus input variables to VTK variable names {“modulus name”: [“vtk name”]}. Use colons to denote components of multi-dimensional VTK arrays (“name”:# )

  • output_names (List[str]) – List of desired outputs.

  • invar (Dict[str, np.array], optional) – Dictionary of additional numpy arrays as input, by default {}

  • batch_size (int) – Batch size used when running inference

  • mask_fn (Union[Callable, None], optional) – Masking function to remove points from inferencing, by default None

  • mask_value (float, optional) – Value to assign masked points, by default Nan

  • plotter (Plotter, optional) – Modulus Plotter for showing results in tensorboard., by default None

  • requires_grad (bool, optional) – If automatic differentiation is needed for computing results., by default True

  • log_iter (bool, optional) – Save results to different file each call, by default False

Inferencer Base

class modulus.domain.inferencer.inferencer.Inferencer[source]

Bases: object

Inferencer base class