## libmesh-users

 [Libmesh-users] normals From: Michael Povolotskyi - 2005-12-21 15:26:34 ``` Dear Libmesh developers,
I have question:

Where do normal vectors returned by FEBase::normals point? Outside of the element or inside the element?

Thank you,
Michael.

```
 Re: [Libmesh-users] normals From: Michael Povolotskyi - 2005-12-21 15:47:22 ```John, let me be more specific: does the direction of a normal depend on the orientation of nodes of the side? It seems that we found such dependence but may be this was our error. Michael. John Peterson wrote: >Outside, I hope you didn't find something different :( > >-John > >Michael Povolotskyi writes: > > > > > > > > > > > > > > > > Dear Libmesh developers,
> > I have question:
> >
> > Where do normal vectors returned by FEBase::normals point? Outside of > > the element or inside the element?
> >
> > Thank you,
> > Michael.
> > > >
> >
> > > > > > > -- ------------------------------------------------------------ Michael Povolotskyi, Ph.D. University of Rome "Tor Vergata" Department of Electronic Engineering Viale Politecnico, 1 - 00133 Rome - Italy Phone + 39 06 72597781 Fax + 39 06 2020519 http://www.optolab.uniroma2.it/pages/moshe/moshe.html ------------------------------------------------------------- ```
 Re: [Libmesh-users] normals From: John Peterson - 2005-12-21 16:05:22 ```Michael Povolotskyi writes: > John, > let me be more specific: > does the direction of a normal depend on the orientation of nodes of > the side? Well, it does to some extent I guess. If you arbitrarily flip the two nodes of a say QUAD4, then the Jacobian map will be wrong for that element In the fe_boundary.C file, the outward normal is defined by (in 2D) const Point n(dxyzdxi_map[p](1), -dxyzdxi_map[p](0), 0.); dxyzdxi_map[p](1) is dy / d(xi) at quadrature point p, etc. > > It seems that we found such dependence but may be this was our error. Can you explain or give exactly the test case you found? -J ```
 Re: [Libmesh-users] normals From: Michael Povolotskyi - 2005-12-21 16:20:09 ```John, I don't mean to flip, I mean to change order: {1,2,3,4} to {4,3,2,1}. Can this change the direction of the normal? Michael. John Peterson wrote: >Michael Povolotskyi writes: > > John, > > let me be more specific: > > does the direction of a normal depend on the orientation of nodes of > > the side? > >Well, it does to some extent I guess. If you arbitrarily flip the >two nodes of a say QUAD4, then the Jacobian map will be wrong for >that element > >In the fe_boundary.C file, the outward normal is defined by (in 2D) > >const Point n(dxyzdxi_map[p](1), -dxyzdxi_map[p](0), 0.); > >dxyzdxi_map[p](1) is dy / d(xi) at quadrature point p, etc. > > > > > > It seems that we found such dependence but may be this was our error. > >Can you explain or give exactly the test case you found? > >-J > > > > -- ------------------------------------------------------------ Michael Povolotskyi, Ph.D. University of Rome "Tor Vergata" Department of Electronic Engineering Viale Politecnico, 1 - 00133 Rome - Italy Phone + 39 06 72597781 Fax + 39 06 2020519 http://www.optolab.uniroma2.it/pages/moshe/moshe.html ------------------------------------------------------------- ```
 Re: [Libmesh-users] normals From: Roy Stogner - 2005-12-21 18:27:20 ```On Wed, 21 Dec 2005, Michael Povolotskyi wrote: > I don't mean to flip, I mean to change order: > {1,2,3,4} to {4,3,2,1}. > Can this change the direction of the normal? That will give you an inverted element, won't it? I think libMesh assumes that QUAD4 element nodes are numbered clockwise; you may be getting negative Jacobians, not just inverted normals. --- Roy Stogner ```
 Re: [Libmesh-users] normals From: Roy Stogner - 2005-12-21 18:28:18 ```On Wed, 21 Dec 2005, Roy Stogner wrote: > On Wed, 21 Dec 2005, Michael Povolotskyi wrote: > >> I don't mean to flip, I mean to change order: >> {1,2,3,4} to {4,3,2,1}. >> Can this change the direction of the normal? > > That will give you an inverted element, won't it? I think libMesh > assumes that QUAD4 element nodes are numbered clockwise; you may be > getting negative Jacobians, not just inverted normals. Counter-clockwise, I mean, counter-clockwise. In fact, don't take my word for it either way; check the diagram in include/geom/face_quad4.h for yourself. ;-) --- Roy Stogner ```
 Re: [Libmesh-users] normals From: Michael Povolotskyi - 2005-12-22 17:13:53 ``` Roy,
The thing is that we are not getting any negative Jacobians (at least in Debug mode there was no error message),
but normals get inverted if the orientation of  elements are negative (clockwise).

Our meshes are generated by GMSH software that sometimes generates negatively oriented elements.
Michael.

Roy Stogner wrote:
On Wed, 21 Dec 2005, Michael Povolotskyi wrote:

I don't mean to flip, I mean to change order:
{1,2,3,4} to {4,3,2,1}.
Can this change the direction of the normal?

That will give you an inverted element, won't it?  I think libMesh
assumes that QUAD4 element nodes are numbered clockwise; you may be
getting negative Jacobians, not just inverted normals.
---
Roy Stogner

--  ------------------------------------------------------------ Michael Povolotskyi, Ph.D. University of Rome "Tor Vergata" Department of Electronic Engineering Viale Politecnico, 1 - 00133 Rome - Italy   Phone + 39 06 72597781 Fax   + 39 06 2020519 http://www.optolab.uniroma2.it/pages/moshe/moshe.html; -------------------------------------------------------------
```