scimba_torch.physical_models.temporal_pde.heat_equation

Heat equation in strong form.

Functions

zeros_bc_rhs(w, t, x, n, mu[, nb_func])

Function returning a zero right-hand side for the boundary conditions.

zeros_rhs(w, t, x, mu[, nb_func])

Function returning a zero right-hand side.

Classes

HeatEquation1DDirichletStrongForm(space, init)

Implementation of a 1D heat equation with Dirichlet BCs in strong form.

HeatEquation1DStrongForm(space, init[, f, g])

Implementation of a 1D heat equation with Neumann BCs in strong form.

HeatEquation2DStrongForm(space, init[, f, g])

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

HeatEquation2DStrongFormImplicit(space, init)

2D heat equation for implicit discrete_pinns.

zeros_rhs(w, t, x, mu, nb_func=1)[source]

Function returning a zero right-hand side.

Parameters:
Return type:

Tensor

Returns:

A tensor of zeros with shape (number of points, nb_func).

zeros_bc_rhs(w, t, x, n, mu, nb_func=1)[source]

Function returning a zero right-hand side for the boundary conditions.

Parameters:
Return type:

Tensor

Returns:

A tensor of zeros with shape (number of points, nb_func).

class HeatEquation1DStrongForm(space, init, f=<function zeros_rhs>, g=<function zeros_bc_rhs>, **kwargs)[source]

Bases: FirstOrderTemporalPDE

Implementation of a 1D heat equation with Neumann BCs in strong form.

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

  • init (Callable) – Callable for the initial condition

  • f (Callable) – Source term function (default is zero)

  • g (Callable) – Neumann boundary condition function (default is zero)

  • **kwargs – Additional keyword arguments

space_operator(w, t, x, mu)[source]

Apply the spatial operator.

Parameters:
Return type:

Tensor | tuple[Tensor, ...]

Returns:

Spatial operator tensor

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

Apply the boundary condition operator.

Parameters:
Return type:

Tensor

Returns:

Boundary condition operator tensor

rhs(w, t, x, mu)[source]

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

Parameters:
Return type:

Tensor

Returns:

RHS tensor

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

Compute the boundary condition RHS.

Parameters:
Return type:

Tensor

Returns:

Boundary condition RHS tensor

initial_condition(x, mu)[source]

Compute the initial condition.

Parameters:
Return type:

Tensor

Returns:

Initial condition tensor

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

Compute the functional operator.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • t (Tensor) – Temporal coordinate tensor

  • x (Tensor) – Spatial coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor

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

Compute the functional operator for boundary conditions.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • t (Tensor) – Temporal coordinate tensor

  • x (Tensor) – Spatial coordinate tensor

  • n (Tensor) – Normal vector tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for boundary conditions

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

Compute the functional operator for initial conditions.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • x (Tensor) – Spatial coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for initial conditions

class HeatEquation1DDirichletStrongForm(space, init, f=<function zeros_rhs>, g=<function zeros_bc_rhs>, **kwargs)[source]

Bases: FirstOrderTemporalPDE

Implementation of a 1D heat equation with Dirichlet BCs in strong form.

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

  • init (Callable) – Callable for the initial condition

  • f (Callable) – Source term function (default is zero)

  • g (Callable) – Dirichlet boundary condition function (default is zero)

  • **kwargs – Additional keyword arguments

space_operator(w, t, x, mu)[source]

Apply the spatial operator.

Parameters:
Return type:

Tensor

Returns:

Spatial operator tensor

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

Apply the boundary condition operator.

Parameters:
Return type:

Tensor

Returns:

Boundary condition operator tensor

rhs(w, t, x, mu)[source]

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

Parameters:
Return type:

Tensor

Returns:

RHS tensor

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

Compute the boundary condition RHS.

Parameters:
Return type:

Tensor

Returns:

Boundary condition RHS tensor

initial_condition(x, mu)[source]

Compute the initial condition.

Parameters:
Return type:

Tensor

Returns:

Initial condition tensor

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

Compute the functional operator.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • t (Tensor) – Temporal coordinate tensor

  • x (Tensor) – Spatial coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor

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

Compute the functional operator for boundary conditions.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • t (Tensor) – Temporal coordinate tensor

  • x (Tensor) – Spatial coordinate tensor

  • n (Tensor) – Normal vector tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for boundary conditions

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

Compute the functional operator for initial conditions.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • x (Tensor) – Spatial coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for initial conditions

class HeatEquation2DStrongForm(space, init, f=<function zeros_rhs>, g=<function zeros_bc_rhs>, **kwargs)[source]

Bases: FirstOrderTemporalPDE

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

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

  • init (Callable) – Callable for the initial condition

  • f (Callable) – Source term function (default is zero)

  • g (Callable) – Dirichlet boundary condition function (default is zero)

  • **kwargs – Additional keyword arguments

space_operator(w, t, x, mu)[source]

Apply the spatial operator.

Parameters:
Return type:

Tensor

Returns:

Spatial operator tensor

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

Apply the boundary condition operator.

Parameters:
Return type:

Tensor

Returns:

Boundary condition operator tensor

rhs(w, t, x, mu)[source]

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

Parameters:
Return type:

Tensor

Returns:

RHS tensor

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

Compute the boundary condition RHS.

Parameters:
Return type:

Tensor

Returns:

Boundary condition RHS tensor

initial_condition(x, mu)[source]

Compute the initial condition.

Parameters:
Return type:

Tensor

Returns:

Initial condition tensor

class HeatEquation2DStrongFormImplicit(space, init, f=<function zeros_rhs>, g=<function zeros_bc_rhs>, **kwargs)[source]

Bases: FirstOrderTemporalPDE

2D heat equation for implicit discrete_pinns.

Parameters:
  • space (AbstractApproxSpace) – the approx. space.

  • init (Callable) – the rhs of the initial condition.

  • f (Callable) – the rhs of the residual (default is zero).

  • g (Callable) – the rhs of the boundary condition (default is zero).

  • **kwargs – Additional keyword arguments.

space_operator(w, t, x, mu)[source]

Apply the spatial operator.

Parameters:
Return type:

Tensor

Returns:

Spatial operator tensor

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

Apply the boundary condition operator.

Parameters:
Return type:

Tensor

Returns:

Boundary condition operator tensor

rhs(w, t, x, mu)[source]

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

Parameters:
Return type:

Tensor

Returns:

RHS tensor

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

Compute the boundary condition RHS.

Parameters:
Return type:

Tensor

Returns:

Boundary condition RHS tensor

initial_condition(x, mu)[source]

Compute the initial condition.

Parameters:
Return type:

Tensor

Returns:

Initial condition tensor

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

Compute the functional operator.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • x (Tensor) – Spatial coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor

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

Compute the functional operator for boundary conditions.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • t (LabelTensor) – Temporal coordinate tensor

  • x (Tensor) – Spatial coordinate tensor

  • n (Tensor) – Normal vector tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for boundary conditions

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

Compute the functional operator for initial conditions.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • x (Tensor) – Spatial coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for initial conditions