Import and update a matrix during runtime

Hi, everyone

I wonder if I can update some data in the kernel run like time. Because I’m trying to use the actuator line method in PyFR, which requires updating some parameters in every step.I can only transfer individual data like this q.enqueue(kernels['eles/negdivconf'], t=t, x1=a, x2=b].
However, an error occurs when I try to transfer a matrix. Could you give me some advice?

Best regards

Other than time, are these parameters global or local? By that I mean are there a few of the same parameters needed by all the kernels, or will each element need different parameters?

Thank you for the reply.
I think these parameters are local. In fact, I want to add some parameters just like adding the source term a particular kernel. In my case, the difference is that these parameters need to be recalculated at each step.

OK, you are probably best allocating some new memory and then passing that in a similar manner as how memory is passed to other kernels.

You can see some examples of memory allocation here: https://github.com/PyFR/PyFR/blob/1a8f7fb821024f14eae745c39a58b89e9104f3fa/pyfr/solvers/base/elements.py#L177

You’ll just want to call the alloc from your solver-specific set_backend in elements.py

Then you can pass it to the kernel. You’ll want something like this in the mako: https://github.com/PyFR/PyFR/blob/1a8f7fb821024f14eae745c39a58b89e9104f3fa/pyfr/solvers/baseadvec/kernels/negdivconf.mako#L11
and this in the set_backend of elements.py: https://github.com/PyFR/PyFR/blob/1a8f7fb821024f14eae745c39a58b89e9104f3fa/pyfr/solvers/baseadvec/elements.py#L113

That kernel also shows you how to pass the time to a kernel.

Thanks for your advice.
According to the examples, I allocated memory and passed it to the kernel. But there are still two problems.
First, only the data in the pointwise matrix can be passed correctly. This means that if I want to pass 100 parameters, I have to create a matrix of 100number of points. Can I create a 1010 matrix and pass it to all the points in the kernel
Second, how can I update the data in the matrix? I can’t update it like time. I tried using the set() function, but the matrix cannot be found in the integrator.

Thanks again for your time.

Please see the current turbulent inflow pull request (https://github.com/PyFR/PyFR/pull/358) for an example of how an entire matrix can be updated at runtime.

Regards, Freddie.