torch_fem.operator

Condenser

class Condenser(dirichlet_mask: Tensor, dirichlet_value: Tensor = None)[source]

Bases: object

Static Condensing Operator for Dirichlet Boundary Condition

\[K_{inner} u_{inner} = f_{inner} - K_{ou2in} u_{ou2in}\]
Parameters:
  • dirichlet_mask (torch.Tensor) – 1D tensor of shape \([n_{\text{dof}}]\) the mask of the dirichlet boundary condition

  • dirichlet_value (torch.Tensor) – 1D tensor of shape \([n_{\text{dof}}]\) or \([n_{\text{outer_dof}}]\) the value of the dirichlet boundary condition

dirichlet_mask

the mask of the dirichlet boundary condition

Type:

torch.Tensor of shape \([n_{\text{dof}}]\)

dirichlet_value

the value of the dirichlet boundary condition

Type:

torch.Tensor of shape \([n_{\text{outer_dof}}]\)

condense_rhs(rhs)[source]

only condense the right hand side

\[f_{inner} - K_{ou2in} u_{ou2in}\]
Parameters:

rhs (torch.Tensor) – 1D tensor of shape \([n_{\text{dof}}]\) the right hand side of the linear system

Returns:

1D tensor of shape \([n_{\text{inner_dof}}]\) the condensed right hand side

Return type:

torch.Tensor

recover(u: Tensor)[source]

recovert the solution

Parameters:

u (torch.Tensor) – 1D tensor of shape \([n_{\text{inner_dof}}]\) the solution of the condensed linear system

Returns:

1D tensor of shape \([n_{\text{dof}}]\) the recovered solution of the linear system

Return type:

torch.Tensor