zwicker-group / py-pde

Python package for solving partial differential equations using finite differences.
https://py-pde.readthedocs.io
MIT License
408 stars 52 forks source link

Allow setting boundary values using functions #367

Closed david-zwicker closed 1 year ago

david-zwicker commented 1 year ago

The idea would be to use a special boundary condition to allow setting the value, derivative, or directly the value of the virtual point using a python function (which must be jitable for numbs-compiled cases). This could build on ExpressionBC and the interface would probably look something like this:

def bc_value(value, dx, x, y, z, t):
    return [some expression of the variables]

bc={'value_function': bc_value}

A use case is demonstrated in #365.