Evaluation of ProxyFunction

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 NGS-Py Finite Element Tool — NGS-Py 6.2.2302 documentation 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:
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 :slight_smile:

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:

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

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)

C += u * v * dx + epsilon * u* v * ds(definedon=mesh.Boundaries("left"))

Best,
Michael

Michael – Perfect, your last suggestion works well. Thank you for taking the time to reply.