Evaluation of ProxyFunction

More
5 years 1 month ago #1929 by JanWesterdiep
Hello team,

After recently attending a workshop in Vienna that featured NGSolve (RMMM2019), I finally took the plunge and am slowly working on understanding the codebase. I have a number of questions, with one problem in particular. For now, I am using the Python frontend, which I hope will be sufficient for my application.

- I am used to navigating code documentation with something like Doxygen, but it seems this is unavailable for NGSolve. Although very extensive, sometimes the example code at ngsolve.org/docu is not sufficient and I resort to calling `help(variable_or_class)` to get some idea of the methods a class has. Is this the intended way? Is there any way for me to generate/find Doxygen-like documentation?
- My specific application features point evaluations of test- and trial functions, like such:
Code:
I = some_mesh_on_the_interval() X = H1(I) u, v = X.TnT() C = BilinearForm(X) C += u * v * dx + epsilon * u(I(0.0)) * v(I(0.0))
This code gives me the cryptic error "netgen.libngpy._meshing.NgException: cannot evaluate ProxyFunction without userdata", however it does not give me a traceback to *where* this error comes from, and this string gives no hits on google, nor does "userdata" yield a hit in the documentation.

Am I approaching this problem the wrong way?

In any case, thank you immensely for the codebase :-)
More
5 years 1 month ago #1930 by mneunteufel
Hi JanWesterdiep,

it is not possible to evaluate a ProxyFunction at a mesh point.
Therefore you first have to solve the problem and then evaluate the GridFunction where the solution is stored.

I don't understand your BilinarForm completely. Do you want to have a boundary integral?
This is done by the ds integrator:

Code:
I = some_mesh_on_the_interval() X = H1(I) u, v = X.TnT() C = BilinearForm(X) C += u * v * dx + epsilon * u* v * ds

However, with this both boundaries of the interval are "evaluated". You can use the IfPos command
Code:
C += u * v * dx + IfPos(x-1e-5,0,1)*epsilon * u* v * ds

or use the definedon syntax (therefore the boundaries must have a name or number)
Code:
C += u * v * dx + epsilon * u* v * ds(definedon=mesh.Boundaries("left"))

Best,
Michael
More
5 years 1 month ago #1931 by JanWesterdiep
Michael -- Perfect, your last suggestion works well. Thank you for taking the time to reply.
Time to create page: 0.098 seconds