I’ve been able to split the periodic faces from the rest of the internal faces, and I use a class similar to the internal interfaces class to handle the periodic interfaces and some mako kernels to decouple the fluxes for select scalars. I’d now like to calculate the average on the LHS and RHS of the periodic boundary in order to make some control loops, but I can’t seem to figure out how to do this from the internal interface classes.
Is there a way to access the solution from the internal interface classes so I can take an integral, similar to in the plugins or BC interfaces? My first thought was to create a class similar to MassFlowBCMixin to do this, but the implementation has proven quite cumbersome.
The averaging over the periodic surface is working now
My next issue is that I can’t seem to be able to pass an external value to the kernels.
I attempted to replicate what was done here (and something similar worked for a plugin I made a while ago), but it throws “invalid argument specification”
My class is similar to the MassFlowBC one, and is structured as follows (I only want to use the external value in the comm_flux kernel):
When I had tried to use the bind method on a scalar like in the MassFlowBC class, it threw ‘PointwiseKernel’ object has no attribute ‘bind’ so I’m wondering if I did something wrong in my solvers/base/system.py file…
Only scalar arguments require binding. In your case you’re using an array, so it doesn’t need to be rebound (the pointer remains constant). See the turbulent inflow plugin for an example of this—it never calls bind.
I got it working. The mako kernel compiler didn’t like missing the parameter definitions in the header when I tried adding the externs keyword. I figured out you can access external values without the using the externs keyword as long as you pass extrns=self._external_args to the kernel. I also forgot gradur, but that wasn’t the issue. For reference, the mako file header in the working version looks like this (i.e., no params or externs keywords):