For my reserarch i need to transform
the bilinear form corresponding to the Laplace equation in 2D
between two sets of coordinates i.e.
xp,yp=F(xc,yc)
Let J be the Jacobian for this transfomation , detJ its determinant
and JinvT the tranpose of the inverse of J
in fenics we would write
a_p = inner(grad(u), grad(v))dxp
In terms of xc and yc it should become
a_c =inner(JinvTgrad(u),JinvT*grad(v))detJdxc
I have implemented the above but the
solutions obtained in both coordinate system do not agree with each other.
However, in 1D a simple example works perfectly.
Any suggestions would be appreciated.
I do these transformations a lot in my own research and have never run into problems with them. If you post an example where it’s failing, I can take a look.
In the attached zip file there are 4 python scripts.
There are 2 scripts for the one dimensional
laplace problem and 2 for the two dimensional laplace problem.
the 1D problem is with the boundary condition f(0)=0 f(1)=0
while 2D problem has the boundary condition f(x,y)=x+y.
The 1D scripts produce the expected output
while the 2D scripts gives a difference between the obtained and expected
results.
I would appreciate if you could send me one of your scripts where you
do a similar thing which works, also indicating the exact version of fenics that
you are using.
I’m not sure how to attach files on here. Based on your description, my first debugging step would be to double check that you’re defining the boundary data f correctly. Using your earlier notation, if you want to impose boundary data f on the boundary of the mapped domain, you would need to use boundary data f\circ\mathbf{F} in your FEniCS formulation, since functions are all defined on the un-mapped domain.
The main place I personally use transformations of forms is in an open-source library I wrote to do isogeometric analysis (IGA) with FEniCS, called tIGAr. The changes of variable are all implemented in this file
although possibly with more generality than is needed for your specific case.