AnisotropicGBEnergy

Evaluates anisotropic grain-boundary energy from a TorchScript model.

AnisotropicGBEnergy evaluates a TorchScript model on grain-boundary normal vectors and stores both the resulting scalar grain-boundary energy and its derivative with respect to the incoming normal tensor in output buffers.

Overview

The object expects gb_gradient_buffer, a vector-valued tensor buffer with trailing component dimension 3, typically generated by GradientVector. The input is flattened to (N, 3), normalized row-wise,

and passed to the TorchScript module to obtain the grain-boundary energy , written to the buffer output. Autograd is used to additionally compute , written to the dsigma_dn output buffer with the same shape as gb_gradient_buffer.

Only points where clears a gradient-magnitude threshold are passed to the model. For a interface profile of width interface_width (), the threshold is

which is negligible one interface width from the boundary. Outside this masked region, dsigma_dn is zero (there is no boundary to differentiate), while the energy buffer is filled with the largest energy value measured anywhere in the domain (or 1.0 if no interface point was found anywhere), to avoid introducing an artificial low-energy region in the bulk.

In two dimensions, GradientVector zero-pads the third (z) component of the gradient, so the model receives normals of the form and must be trained (or otherwise tolerant of) this convention.

Example Input File Syntax

[TensorComputes<<<{"href": "../../syntax/TensorComputes/index.html"}>>>]
  [Solve<<<{"href": "../../syntax/TensorComputes/Solve/index.html"}>>>]
    [gb_energy]
      type = AnisotropicGBEnergy<<<{"description": "Evaluates anisotropic grain-boundary energy from a TorchScript model.", "href": "AnisotropicGBEnergy.html"}>>>
      buffer<<<{"description": "The buffer this compute is writing to"}>>> = gb_energy
      gb_gradient_buffer<<<{"description": "Input tensor buffer containing grain-boundary gradient vectors."}>>> = grad_eta
      dsigma_dn<<<{"description": "Output tensor buffer for the derivative of GB energy with respect to the normal tensor."}>>> = dsigma_dn
      libtorch_model_file<<<{"description": "Path to the TorchScript file containing the GB energy model."}>>> = 'marlin:anisotropic_gb_energy/analytic_sigma.pt'
      interface_width<<<{"description": "Coarsest interface width in model."}>>> = ${interface_width}
      chunk_size<<<{"description": "Maximum number of spatial points processed at once. Smaller values reduce peak GPU memory usage at the cost of additional TorchScript launches."}>>> = 256
    []
  []
[]
(test/tests/anisotropic_grain_growth/analytic_hull.i)

Input Parameters

  • bufferThe buffer this compute is writing to

    C++ Type:std::string

    Controllable:No

    Description:The buffer this compute is writing to

  • dsigma_dnOutput tensor buffer for the derivative of GB energy with respect to the normal tensor.

    C++ Type:std::string

    Controllable:No

    Description:Output tensor buffer for the derivative of GB energy with respect to the normal tensor.

  • gb_gradient_bufferInput tensor buffer containing grain-boundary gradient vectors.

    C++ Type:std::string

    Controllable:No

    Description:Input tensor buffer containing grain-boundary gradient vectors.

  • interface_widthCoarsest interface width in model.

    C++ Type:Real

    Unit:(no unit assumed)

    Range:interface_width > 0

    Controllable:No

    Description:Coarsest interface width in model.

  • libtorch_model_filePath to the TorchScript file containing the GB energy model.

    C++ Type:DataFileName

    Controllable:No

    Description:Path to the TorchScript file containing the GB energy model.

Required Parameters

  • chunk_size65536Maximum number of spatial points processed at once. Smaller values reduce peak GPU memory usage at the cost of additional TorchScript launches.

    Default:65536

    C++ Type:unsigned int

    Range:chunk_size > 0

    Controllable:No

    Description:Maximum number of spatial points processed at once. Smaller values reduce peak GPU memory usage at the cost of additional TorchScript launches.

Optional Parameters

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

    C++ Type:std::vector<std::string>

    Controllable:No

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

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters

Input Files