### Specifying outward surface normal in weak form

151

views

0

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.

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

1

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.
If you let

$T=\left[T_{11},T_{21}\right]$

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$∫

Which translates to

$T=\left[T_{11},T_{21}\right]$

`T`=[`T`_{11},`T`_{21}]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$∫

_{Ω}∇`ϕ`·`T``d``x``d``y`=∫_{∂Ω}`ϕ``T`·`n``d``l`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

Hi,

Does these different representations have any effect on the elapsed time for solution generation?

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.

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