Question concerning Other()

More
6 years 9 months ago - 6 years 9 months ago #357 by pschroe
Hi guys,

in the context of DG methods, I want to be able to compute the average (or mean) of the product of trial and test function. For example, as follows:
Code:
V = VectorL2(mesh,order=2) u = V.TrialFunction() v = V.TestFunction() uv = InnerProduct(u,v) avg_uv = 0.5*( uv + uv.Other() )
This does not work. The exception suggests to use the Other()-operator on sub-trees.
Is the following meant with that?
Code:
avg_uv = 0.5*( InnerProduct(u,v) + InnerProduct(u.Other(),v.Other()) )
Because this does not lead to an error ;-)

Thanks for your help!
Best, Philipp
Last edit: 6 years 9 months ago by pschroe.
More
6 years 9 months ago #358 by schruste
Hi Philipp,

Other() is only implemented for ProxyFunctions (test or trialfunctions). The product/InnerProduct of both is not a ProxyFunction anymore but a general CoefficientFunction. That why the first version does not work, but the second.

Best,
Christoph
More
6 years 9 months ago #359 by joachim
Replied by joachim on topic Question concerning Other()
Hi,

you can use the Other also to Coefficients,
or to Coefficient-trees, as long as they don't contain a proxy.

Sorry for this limitation, the fix requires some effort.
Now an exception is thrown if we violate this constraint.

Joachim
More
6 years 9 months ago #360 by pschroe
Replied by pschroe on topic Question concerning Other()
Thank you very much! I just wanted to make sure I understood the exception :-)
Time to create page: 0.099 seconds