How to add a constant term with a value of a testfunction at a point in the FEM setup?

Hello everyone.
Let me first thank you for making this software. I want to use it to solve a wave-related problem. It is linear elasticity, and I am attaching the weak form of the governing equations. The code is attached as well.

The domain is a rectangle with PML conditions and a free surface at y=0.

As you see in the screenshot, the last term on the right-hand side is a constant term with the value of the test function at (0,0). I am not sure how to include that term in the code for calculations. Please help me out here.
Surface_problem.ipynb (5.0 KB)

Thank you.

There is an (undocumented) feature in ngsolve to add point sources:

f += func * w(0,0)

with w being your testfunction

best Christopher

1 Like

Hello Christopher,
Thank you for your reply.
I used what you suggested, but I am getting an error. The screenshot is attached.

I have used it differently, and it is working, but I am unsure if it is the right way. I used this:

f +=(func * w)(0,0)

Please let me know.

Also, I wanted to know if there is a way to visualise the test functions on mesh or an element.

Thank you once again.

ah, there is a mult operator missing for complex. What you do should be fine and what should also be possible is:

b += CoefficientFunction(force) * v(0,0)

to check look at the linearform vector. If you have a H1 space there should be one entry at the 0,0 node.

1 Like

Hello Christopher.
Thank you for your reply.
I tried it but I am still getting an error.

ah, then your way is the way to go. Is it doing what you expected?

1 Like

Hello Christopher.

I think it is doing what is needed, and I am sharing the screenshot of the b vector here. I can see one entry only, with all other entries as zero.

1 Like

Hello Christopher,

Is there a way to check if this non-zero value is on the (0,0) node?

Thank you.