scimba_torch.physical_models.elliptic_pde.laplacians

Laplacian operators in 1D and 2D.

Classes

Laplacian1DDirichletStrongForm(space, f, g, ...)

Implementation of a 1D Laplacian problem with Dirichlet BCs in strong form.

Laplacian1DNeumannStrongForm(space, f, g, ...)

Implementation of a 1D Laplacian problem with Neumann BCs in strong form.

Laplacian2DDirichletRitzForm(space, f, g, ...)

Implementation of a 2D Laplacian problem with Dirichlet BCs in Ritz form.

Laplacian2DDirichletStrongForm(space, f, g, ...)

Implementation of a 2D Laplacian problem with Dirichlet BCs in strong form.

class Laplacian1DNeumannStrongForm(space, f, g, **kwargs)[source]

Bases: StrongFormEllipticPDE

Implementation of a 1D Laplacian problem with Neumann BCs in strong form.

Parameters:
  • space (AbstractApproxSpace) – The approximation space for the problem.

  • f (Callable) – Callable representing the source term f(x, μ).

  • g (Callable) – Callable representing the Neumann boundary condition g(x, μ).

  • **kwargs – Additional keyword arguments.

rhs(w, x, mu)[source]

Compute the right-hand side (RHS) of the PDE.

Parameters:
Return type:

Tensor

Returns:

The source term ( f(x, mu) ).

operator(w, x, mu)[source]

Compute the differential operator of the PDE.

Parameters:
Return type:

Tensor

Returns:

The result of applying the operator to the state.

bc_rhs(w, x, n, mu)[source]

Compute the RHS for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary condition ( g(x, mu) ).

bc_operator(w, x, n, mu)[source]

Compute the operator for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary operator applied to the state.

class Laplacian1DDirichletStrongForm(space, f, g, **kwargs)[source]

Bases: StrongFormEllipticPDE

Implementation of a 1D Laplacian problem with Dirichlet BCs in strong form.

Parameters:
  • space (AbstractApproxSpace) – The approximation space for the problem.

  • f (Callable) – Callable representing the source term f(x, μ).

  • g (Callable) – Callable representing the Dirichlet boundary condition g(x, μ).

  • **kwargs – Additional keyword arguments.

rhs(w, x, mu)[source]

Compute the right-hand side (RHS) of the PDE.

Parameters:
Return type:

Tensor

Returns:

The source term f(x, μ).

operator(w, x, mu)[source]

Compute the differential operator of the PDE.

Parameters:
Return type:

Tensor

Returns:

The result of applying the operator to the state.

bc_rhs(w, x, n, mu)[source]

Compute the RHS for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary condition g(x, μ).

bc_operator(w, x, n, mu)[source]

Compute the operator for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary operator applied to the state.

class Laplacian2DDirichletStrongForm(space, f, g, **kwargs)[source]

Bases: StrongFormEllipticPDE

Implementation of a 2D Laplacian problem with Dirichlet BCs in strong form.

Parameters:
  • space (AbstractApproxSpace) – The approximation space for the problem.

  • f (Callable) – Callable representing the source term f(x, μ).

  • g (Callable) – Callable representing the Dirichlet boundary condition g(x, μ).

  • **kwargs – Additional keyword arguments.

rhs(w, x, mu)[source]

Compute the right-hand side (RHS) of the PDE.

Parameters:
Return type:

Tensor

Returns:

The source term f(x, μ).

operator(w, x, mu)[source]

Compute the differential operator of the PDE.

Parameters:
Return type:

Tensor

Returns:

The result of applying the operator to the state.

bc_rhs(w, x, n, mu)[source]

Compute the RHS for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary condition g(x, μ).

bc_operator(w, x, n, mu)[source]

Compute the operator for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary operator applied to the state.

functional_operator_bc(func, x, n, mu, theta)[source]

Apply the functional operator for boundary conditions.

Parameters:
  • func (VarArgCallable) – The callable function to apply.

  • x (Tensor) – Spatial coordinates tensor.

  • n (Tensor) – Normal vector tensor.

  • mu (Tensor) – Parameter tensor.

  • theta (Tensor) – Theta parameter tensor.

Return type:

Tensor

Returns:

The result of applying the functional operator.

functional_operator(func, x, mu, theta)[source]

Apply the functional operator for the differential equation.

Parameters:
  • func (VarArgCallable) – The callable function to apply.

  • x (Tensor) – Spatial coordinates tensor.

  • mu (Tensor) – Parameter tensor.

  • theta (Tensor) – Theta parameter tensor.

Return type:

Tensor

Returns:

The result of applying the functional operator.

class Laplacian2DDirichletRitzForm(space, f, g, **kwargs)[source]

Bases: RitzFormEllipticPDE

Implementation of a 2D Laplacian problem with Dirichlet BCs in Ritz form.

Parameters:
  • space (AbstractApproxSpace) – The approximation space for the problem.

  • f (Callable) – Callable representing the source term f(x, μ).

  • g (Callable) – Callable representing the Dirichlet boundary condition g(x, μ).

  • **kwargs – Additional keyword arguments.

linearform(w, x, mu)[source]

Compute the linear form of the PDE.

Parameters:
Return type:

Tensor

Returns:

The linear form result.

quadraticform(w, x, mu)[source]

Compute the quadratic form of the PDE.

Parameters:
Return type:

Tensor

Returns:

The quadratic form result.

energy_matrix(vals, x, mu)[source]

Compute the energy matrix for the Ritz formulation.

Parameters:
  • vals (dict) – Dictionary containing precomputed values.

  • x (Tensor) – Spatial coordinates tensor.

  • mu (Tensor) – Parameter tensor.

Return type:

Tensor

Returns:

The energy matrix.

bc_rhs(w, x, n, mu)[source]

Compute the RHS for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary condition g(x, μ).

bc_operator(w, x, n, mu)[source]

Compute the operator for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

The boundary operator applied to the state.

functional_operator_bc(func, x, n, mu, theta)[source]

Apply the functional operator for boundary conditions.

Parameters:
  • func (VarArgCallable) – The callable function to apply.

  • x (Tensor) – Spatial coordinates tensor.

  • n (Tensor) – Normal vector tensor.

  • mu (Tensor) – Parameter tensor.

  • theta (Tensor) – Theta parameter tensor.

Return type:

Tensor

Returns:

The result of applying the functional operator.