Possibility to use different function space for Test and Trial function

Hello everyone,

I’m interesting in finding the possibility to define the TestFunction and TrialFunction with different spaces. More specifically, I’m particular interested in using DG to represent a fundamental 1D FVM discretization, to do so, i need to define the TestFunction as constant 1. I tested it in FEniCS but failed.

Is there anyone know if it is possbile to do so in the current FEniCS? If possible, what is the right way to implement?

Thanks a lot!

Unless I’m missing something, the basis of a DG0 space is the constant 1 defined on each element of the mesh… There’s no need to “mix spaces”. It would be helpful if you post a minimal working example.

I’m not quite sure what you’re trying to do, but if you have any hope of solving your discrete system, you’ll need the same number of TestFunctions as TrialFunctions. So for each TrialFunction, there is an associated test function. Suppose for any given TrialFunction u, then the associated test function is w = Pu, where P is some operator (e.g. w = u’). Then you can simply write a non-symmetric weak form. That is, instead of a(w,u), you might have a(Pw,u). Then use Galerkin, and you’ve got what you want.

Hi Nate,

I didn’t clearly decribe the problem at the first time. The motivation is actually to solve the problem, for instance a Poisson equation in FEniCS as cell-center FVM. Therefore, DG0 should be considered, while I noticed in this way, the SIP DG used in the FEniCS undocumented demo (which is implemented for DG1) cannot be applied directly.

Could you please provide me some tips or reference that how the weak form should be formulated accodingly?

Considering an element-wise constant trial and test function u and v, can we derive the Laplace operator like below?

\int_{\Omega} (\nabla \cdot \nabla u) vdV = \sum_{T \in \tau} \int_{\partial T} \nabla u \cdot \vec{n} v dS - \sum_{T \in \tau} \int_{T} \nabla u \cdot \nabla v dV = \sum_{T \in \tau} \int_{\partial T} \nabla u \cdot \vec{n} v dS

And if this is correct, what is the weak form looks like in FEniCS? I assume that for the DG0 functional space, the SIP is no longer suitable, so a cerntral/average numerical flux should be considered?

Hi peb,

thanks a lot for pointing that out. I guess with the operator on the test function, this is the so-call Petrov-Galerkin method?

In my case, it is clear now that the trial function need to be DG0 so does the test function, and for Poisson equation, standard Galerkin and symmetric weak form is fine. My question is how to formulate the weak formin FEniCS and make the assembled matrix solve the Poisson equation like cell-centered FVM will do.

BTW, this problem had been discussed here, but the information is still limited to me.