Skip to content

Passing arguments to low level operator #655

Answered by david-zwicker
ilGriso92 asked this question in Q&A
Discussion options

You must be logged in to vote

This can be done by supplying a numba dictionary when calling the operator:

import pde
from pde.tools.numba import numba_dict

grid = pde.UnitGrid([4, 4])
field = pde.ScalarField.random_uniform(grid)

def boundary(value, dx, x, y, t):
    return np.sin(t)

operator = grid.make_operator("gradient", bc=[{"value_expression": boundary}, {"derivative": 0.0}])
operator(field.data, args=numba_dict({"t": 1}))

I'll look into whether we could call numba_dict automatically in future versions of the package, so one could simply provide a python dictionary instead.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ilGriso92
Comment options

@david-zwicker
Comment options

Answer selected by ilGriso92
@ilGriso92
Comment options

@david-zwicker
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #654 on February 06, 2025 14:02.