zwicker-group / py-pde

Python package for solving partial differential equations using finite differences.

Home Page:https://py-pde.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: ability to pass a diffusivity array (instead of float)

ma-sadeghi opened this issue · comments

Currently, we can only pass a scalar diffusivity. It'd be very useful if we could optionally pass a scalar field for diffusivity (each element corresponding to a single point/control-volume in the grid).

I'm not quite sure what you are referring to, but solving a diffusion equation with spatially dependent coefficients is possible; see #229.

If you think you found an issue in the package, please give a reproducible code example showing an error and describe your expected behavior.

Is it also possible to have a diffusivity that changes as a function of time? I solve a diffusion problem where the diffusivity depends on the concentration of the diffusing specie. I would like to solve the equation with a constant diffusivity, calculate a time (and space?) dependent diffusivity from the solution, substitute that back into the solver, and iterate to convergence.

Yes, certainly. If you use the method presented in #229, you can simply have expressions that depend on t to get explicit temporal dependence.

Excellent! Thanks for pointing this out.