topoptlab.fem_solvers.heat_conduction module

class topoptlab.fem_solvers.heat_conduction.HeatConduction(nelx: int, nely: int, bc: Callable, nelz: int | None = None, kmax: float = 1.0, kmin: float = 1e-09, penal: float = 3.0, l: float | ndarray = 1.0, lin_solver: str = 'cvxopt-cholmod', preconditioner: str | None = None, assembly_mode: str = 'lower', **kwargs: Any)[source]

Bases: FEM_Phys

Stationary heat conduction solver.

Solves the Poisson problem

-div( k(x) grad T ) = f in Omega

T = 0 on Gamma_D

Parameters:
  • nelx (int) – number of elements in x direction.

  • nely (int) – number of elements in y direction.

  • nelz (int or None) – number of elements in z direction. 2D problem if None.

  • bc (callable) – function that returns (T, f, fixed, free, springs) given (nelx, nely, nelz, ndof).

  • l (float or np.ndarray) – element side length(s).

  • lin_solver (str) – linear solver identifier passed to solve_lin.

  • preconditioner (str or None) – preconditioner identifier passed to solve_lin.

  • assembly_mode (str) – “full” or “lower” triangular assembly.

assemble_system(Kes: ndarray, **kwargs: Any) csc_array[source]

Assemble the global conductivity matrix K for densities xPhys.

Parameters:

Kes (np.ndarray) – element stiffness matrices shape (nel,m,m).

Returns:

K – assembled global conductivity matrix.

Return type:

scipy.sparse.csc_array, shape (ndof, ndof)

coupling(**kwargs: Any) None[source]

Not used for single-physics heat conduction.

solve(xPhys: ndarray, **kwargs: Any) ndarray[source]

Assemble and solve for the temperature field.

Parameters:

xPhys (np.ndarray, shape (nel,) or (nel, 1)) – physical element densities.

Returns:

T – temperature field.

Return type:

np.ndarray, shape (ndof, 1)

time_evolve(**kwargs: Any) None[source]

Not applicable — stationary problem.

to_interpolation(xPhys: ndarray, **kwargs: Any) ndarray[source]

SIMP conductivity scale factors for given densities.

Parameters:

xPhys (np.ndarray, shape (nel,) or (nel, 1)) – physical element densities.

Returns:

scale – SIMP scale factors.

Return type:

np.ndarray