This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to calculate the tangential direction value of one function ?

+2 votes

hi,

I am implementing Poisson equation with Dirichlet Boundary condition. With the help of Fenics demo, it is not difficult for us to implement it. However, I find it difficult to calculate the values related to the tangential direction.

The problems can be expressed as follows:

\Delta m = f; in \Omega
m = (\grad(\phi) \cdot \tau ) \cdot \tau; on \partial \Omega

where \phi is a function which is known from the previous step, and \tau is the tangential direction of boundaries.
As we know, \phi is a function of the domain, and \tau is orthogonal to the norm direction of boundaries.

The prototype of my problem comes from gauge method for imcompressible Navier-Stokes problem. More details can be found: https://web.math.princeton.edu/~weinan/pdf%20files/gauge%20method.pdf

I do not know whether my question expressed clearly.
Looking forward for your help.

Thanks a lot!

===========
Hamilton

######## 16/07/2017

I do not know how to respond to Wilhelmbraun's kind comments directly, much thanks to him.
As said, I can export the solution $\phi$ or $\nabla(\phi)$ point by point. However, when I try to export $\nabla(\phi)\cdot \tau$, the code does not work. I think it may because $\tau$ is defined on boundaries, and $\phi$ is defined in the domain.
So, do you know how to export $\tau$ on boundaries.
Or is there some convenient way to implement wihin the FeniCS framework without export and inport files frequently.

Thanks

Hamilton

asked Jul 12, 2017 by Hamilton FEniCS Novice (500 points)
edited Jul 16, 2017 by Hamilton

The point of my question is how to get the boundary values for Dirichlet Boundary Condition.
Namely, how to calculate the value: $(\nabla(\phi)\tau)\tau$ ?
If the values can be calculated and exported point by point, it may work.
Thanks a lot ~

Sincerely!

Hamilton

1 Answer

0 votes

Hi there,

functionals of solutions can be calculated and exported point-by-point as explained in the tutorial.

E.g. defining a normal vector to a mesh works as follows:

normal = FacetNormal(mesh)

and a tangent vector (on 2D domain) like this:

tangent = as_vector([n[1], -n[0]])

See also here. Does that help?

answered Jul 12, 2017 by wilhelmbraun FEniCS User (2,070 points)
...