scimba_torch.physical_models.elliptic_pde.laplacians¶
Laplacian operators in 1D and 2D.
Functions
Classes
|
Implementation of a 1D Laplacian problem with Dirichlet BCs in strong form. |
|
Implementation of a 1D Laplacian problem with Neumann BCs in strong form. |
|
Implementation of a 2D Laplacian problem with Dirichlet BCs in Ritz form. |
|
Implementation of a 2D Laplacian problem with Dirichlet BCs in strong form. |
- zeros(x, mu, nb_func=1)[source]¶
Function returning zeros.
- Parameters:
x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.nb_func (
int) – Number of functions to return (default is 1).
- Return type:
Tensor- Returns:
A tensor of zeros with shape (number of points, nb_func).
- ones(x, mu, nb_func=1)[source]¶
Function returning ones.
- Parameters:
x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.nb_func (
int) – Number of functions to return (default is 1).
- Return type:
Tensor- Returns:
A tensor of ones with shape (number of points, nb_func).
- class Laplacian1DNeumannStrongForm(space, f=<function ones>, g=<function zeros>, **kwargs)[source]¶
Bases:
StrongFormEllipticPDEImplementation of a 1D Laplacian problem with Neumann BCs in strong form.
- Parameters:
space (
AbstractApproxSpace) – The approximation space for the problem.f (
Callable) – Callable, represents the source term f(x, μ) (default: f=1).g (
Callable) – Callable, represents the Neumann boundary condition g(x, μ) (default: g=0).**kwargs – Additional keyword arguments.
- rhs(w, x, mu)[source]¶
Compute the right-hand side (RHS) of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The source term ( f(x, mu) ).
- operator(w, x, mu)[source]¶
Compute the differential operator of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- 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:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- 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:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The boundary operator applied to the state.
- class Laplacian1DDirichletStrongForm(space, f=<function ones>, g=<function zeros>, **kwargs)[source]¶
Bases:
StrongFormEllipticPDEImplementation of a 1D Laplacian problem with Dirichlet BCs in strong form.
- Parameters:
space (
AbstractApproxSpace) – The approximation space for the problem.f (
Callable) – Callable, represents the source term f(x, μ) (default: f=1).g (
Callable) – Callable, represents the Dirichlet boundary condition g(x, μ) (default: g=0).**kwargs – Additional keyword arguments.
- rhs(w, x, mu)[source]¶
Compute the right-hand side (RHS) of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The source term f(x, μ).
- operator(w, x, mu)[source]¶
Compute the differential operator of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- 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:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The boundary condition g(x, μ).
- bc_operator(w, x, n, mu)[source]¶
Compute the operator for the boundary conditions.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The boundary operator applied to the state.
- class Laplacian2DDirichletStrongForm(space, f=<function ones>, g=<function zeros>, **kwargs)[source]¶
Bases:
StrongFormEllipticPDEImplementation of a 2D Laplacian problem with Dirichlet BCs in strong form.
- Parameters:
space (
AbstractApproxSpace) – The approximation space for the problem.f (
Callable) – Callable, represents the source term f(x, μ) (default: f=1).g (
Callable) – Callable, represents the Dirichlet boundary condition g(x, μ) (default: g=0).**kwargs – Additional keyword arguments.
- rhs(w, x, mu)[source]¶
Compute the right-hand side (RHS) of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The source term f(x, μ).
- operator(w, x, mu)[source]¶
Compute the differential operator of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- 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:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The boundary condition g(x, μ).
- bc_operator(w, x, n, mu)[source]¶
Compute the operator for the boundary conditions.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- 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=<function ones>, g=<function zeros>, **kwargs)[source]¶
Bases:
RitzFormEllipticPDEImplementation of a 2D Laplacian problem with Dirichlet BCs in Ritz form.
- Parameters:
space (
AbstractApproxSpace) – The approximation space for the problem.f (
Callable) – Callable, represents the source term f(x, μ) (default: f=1).g (
Callable) – Callable, represents the Dirichlet boundary condition g(x, μ) (default: g=0).**kwargs – Additional keyword arguments.
- linearform(w, x, mu)[source]¶
Compute the linear form of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The linear form result.
- quadraticform(w, x, mu)[source]¶
Compute the quadratic form of the PDE.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Spatial coordinates tensor.mu (
LabelTensor) – Parameter tensor.
- 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:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- Return type:
Tensor- Returns:
The boundary condition g(x, μ).
- bc_operator(w, x, n, mu)[source]¶
Compute the operator for the boundary conditions.
- Parameters:
w (
MultiLabelTensor) – State tensor.x (
LabelTensor) – Boundary coordinates tensor.n (
LabelTensor) – Normal vector tensor.mu (
LabelTensor) – Parameter tensor.
- 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.