# Use different test functions for different dof

**URL:** <https://community.freefem.org/t/use-different-test-functions-for-different-dof/3824>\
**Category:** General Discussion\
**Created:** [March 28, 2025, 2:58am UTC](https://community.freefem.org/t/use-different-test-functions-for-different-dof/3824 "2025-03-28T02:58:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pi.3.141](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@pi.3.141](https://community.freefem.org/u/pi.3.141)\
**Post date:** [March 28, 2025, 2:58am UTC](https://community.freefem.org/t/use-different-test-functions-for-different-dof/3824/1 "2025-03-28T02:58:39Z")

</div>

Dear FreeFem community,  
I am studying a contact problem, and it turns out that I have to solve a problem, which uses a particular fespace (i.e. different test functions for different dof). More precisely, the problem is as follows. I have:

1. a domain **D1** , with mesh **th1** , nodes **x1i** , fespace **V1** ,
2. another domain **D2** , with mesh **th2** , nodes **x2j** , fespace **V2** and
3. **(X1,Y1)** in **V1^2** , which maps **D1** to **D2** and is compatible in the sense that transfers nodes to nodes.

Next, I note by **v1i** the test functions of **V1** , and by **v2j** the test functions of **V2** , and I consider the fespace **W1** in **(D1,th1)** defined by:  
**W1** =span{ **v1i** , with **x1i** not a node of border 1, **v2j(X1,Y1)** with **(X1,Y1)^{-1}(x2j)** node of border 1}.

Can this space W1 be implemented? If not, I wonder what would be the technique for solving, for example,  
**-\Delta w1 = 1** in W1, with **w1=0** on borders (2,3,4) ?

Thank you!

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 28, 2025, 9:52am UTC](https://community.freefem.org/t/use-different-test-functions-for-different-dof/3824/2 "2025-03-28T09:52:54Z")

</div>

Hello,  
The key point is to have a well-defined variational formulation. It doesn’t look to be the case with your statements.

---

<div class="post-metadata">

**Author:** ![pi.3.141](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@pi.3.141](https://community.freefem.org/u/pi.3.141)\
**Post date:** [March 28, 2025, 4:26pm UTC](https://community.freefem.org/t/use-different-test-functions-for-different-dof/3824/3 "2025-03-28T16:26:58Z")

</div>

Dear Francois,  
Thank you for the comment. I have edited my original post with a clear description of my problem. I appreciate any comment/suggestion!

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [March 28, 2025, 5:27pm UTC](https://community.freefem.org/t/use-different-test-functions-for-different-dof/3824/4 "2025-03-28T17:27:57Z")

</div>

One could try to define directly the matrix of the system, building it by blocks corresponding to dofs on border 1, and all other dofs.
