Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

ZeroCoefficientFunction

More
2 years 2 months ago #4185 by jameslowman
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.

James
More
2 years 2 months ago #4186 by joachim
Replied by joachim on topic ZeroCoefficientFunction
Hi James,

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

Joachim
The following user(s) said Thank You: jameslowman
More
2 years 2 months ago #4187 by jameslowman
Replied by jameslowman on topic ZeroCoefficientFunction
Thanks so much for the quick reply Joachim. Updated and it worked!
Time to create page: 0.179 seconds