Specifying outward surface normal in weak form

6 months ago by
I am trying to derive the weak form for a set of PDEs in two dimensional space and by the usual approach of calculus, my weak form will have the following form

vi being the outward normal of the surface. How can this be implemented in Fenics syntax for weak form (Not sure how is vi specified in Fenics for such a situation).
Also, I am trying to solve this equation with a set of other scalar equations, and hence would like to formulate without using vectors.
Community: FEniCS Project

1 Answer

6 months ago by
You get the normal by writing
vi = FacetNormal(mesh)​​
But something's off with your weak form. It should be a scalar equation with no free indices.
Yes I do understand. I will be extracting two components separately and solving with another set of coupled equations.
This will be my actual equation in weak form.

I have to extract the nx and ny components of the normal as that comes in my weak formulation
written 6 months ago by Aswin Rajeevan  
If you let
Then your weak form is
$\int_{\Omega}\nabla\phi\cdot T\mathrm{d}x\mathrm{d}y=\int_{\partial\Omega}\phi T\cdot n\mathrm{d}l$Ωϕ·Tdxdy=∂ΩϕT·ndl
Which translates to
inner(grad(phi),T)*dx = inner(phi*T,n)*ds​

in UFL.

If you really do need the components of the normal vector you can address them using vi[0] for the x- and vi[1] for the y-component respectively.

written 6 months ago by klunkean  
Does these different representations have any effect on the elapsed time for solution generation?
written 6 months ago by Aswin Rajeevan  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »