# Facets orientation in inner surface with fenicsX

**URL:** <https://fenicsproject.discourse.group/t/facets-orientation-in-inner-surface-with-fenicsx/8034>\
**Category:** Uncategorized\
**Created:** [April 12, 2022, 3:39pm UTC](https://fenicsproject.discourse.group/t/facets-orientation-in-inner-surface-with-fenicsx/8034 "2022-04-12T15:39:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![RaphaelC](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/raphaelc/32/3394_2.png) [@RaphaelC](https://fenicsproject.discourse.group/u/RaphaelC)\
**Post date:** [April 13, 2022, 12:15pm UTC](https://fenicsproject.discourse.group/t/facets-orientation-in-inner-surface-with-fenicsx/8034/3 "2022-04-13T12:15:14Z")

</div>

I found some way to fix my problem, but it does not generalize very well. As I know the real normal, I can then use the ufl conditional operator:

```python
vec_x = fem.Constant(domain,PETSc.ScalarType((1.0,0,0)))
vec_y = fem.Constant(domain,PETSc.ScalarType((0.0,1.0,0)))
vecs=[-vec_x,vec_x,-vec_y,vec_y]
for i in range(0,4):
    n_corr=ufl.conditional(ufl.le(ufl.inner(N('+'),vecs[i]),0.0),n('-'),n('+'))
    SurfaceForm_inner = fem.form(ufl.inner(n_corr,vecs[i])*dS(i))#+ fem.Constant(domain, PETSc.ScalarType(0.0))*dx)
    surface_inner = domain.comm.allreduce(fem.assemble_scalar(SurfaceForm_inner), op=MPI.SUM)

    print(f"Checking pressure on surface {i}: reference={reference}, {surface_inner} ")

```

However it works only as my normal vector is very specific (constant on each side).

---

_[View the full topic](https://fenicsproject.discourse.group/t/facets-orientation-in-inner-surface-with-fenicsx/8034)._
