I am writing some code to read boundary conditions as coefficient functions from other files, and to generalize the application of said boundary conditions into the weak form later. To do so, I load all the coefficient functions into a dictionary and have a for loop in my linear form that will apply them.

I have an issue when I assign a zero vector boundary condition (a velocity at a wall, for instance). Because the boundary conditions are being applied for every coefficient function in the for loop, when I try something like an “OuterProduct” on the zero vector, it will give a dimension error. The vector coefficient function of zeros has been replaced with something called “ZeroCoefficientFunction”. I am guessing this is to aid in assembly for sparsity.

My question is – how can I identify a ‘ZeroCoefficientFunction’ in code? I can’t seem to figure out how to check for them, as their dimensions seem the same as a non zero CF… Attached is some code to show this error. I understand that the code is fairly useless (trying to calculate the outer product of a zero vector), but I hope the explanation above shows why this might occur sometimes.


Attachment: dfa62de54bc41b96c3a0938405e07bc0

Hi James,

there was a bug in the dimension of the ZeroCoefficientFunction,
your test-case works with very recent nightly versions.


Thanks so much for the quick reply Joachim. Updated and it worked!