phlower.nn.Slip

class phlower.nn.Slip(activation, normal_name, flag_name, nodes=None)[source]

Bases: IGenericPhlowerCoreModule[IPhlowerLayerParameters, PhlowerTensor], Module

Slip is a neural network module that applies the slip boundary condition u <- u - (u . n) n on the slip boundary nodes.

The three inputs are identified by name: the surface normal (N, d, 1) and the flag (N, 1), the remaining input being the value (N, d, F), a rank-1 tensor. Each input may have a time-series axis (first axis).

Parameters:
  • activation (str) – Name of the activation function to apply to the output.

  • normal_name (str) – Name of the surface normal field. NaN is treated as zero.

  • flag_name (str) – Name of the flag field, which is one on slip boundary nodes and NaN or zero elsewhere.

  • nodes (list[int] | None (optional)) – List of feature dimension sizes (The last value of tensor shape). Defaults to None.

Examples

>>> slip = Slip(
...     activation="identity",
...     normal_name="normal",
...     flag_name="slip_flag",
... )
>>> slip(data)

Methods

forward(data, *[, field_data])

forward function which overloads torch.nn.Module

from_setting(setting)

Create Slip from setting object

get_nn_name()

Return name of Slip

Attributes

T_destination

call_super_init

dump_patches

training

forward(data, *, field_data=None, **kwards)[source]

forward function which overloads torch.nn.Module

Parameters:
  • data (IPhlowerTensorCollections) – IPhlowerTensorCollections data which receives from predecessors

  • field_data (ISimulationField | None) – ISimulationField | None Constant information through training or prediction

Returns:

Tensor object

Return type:

PhlowerTensor

classmethod from_setting(setting)[source]

Create Slip from setting object

Parameters:

setting (SlipSetting) – setting object

Returns:

Slip

Return type:

Self

classmethod get_nn_name()[source]

Return name of Slip

Returns:

name

Return type:

str