Jacobian for face elements

162 views
Skip to first unread message

Soon Kiat Lau

unread,
Jan 22, 2015, 6:59:19 PM1/22/15
to dea...@googlegroups.com
Hello,

Allow me to first thank the authors of deal.ii for writing a program that allows anyone to delve into FEM without emptying their wallets! :)

I am trying to extract individual entries from the Jacobian of face elements. By face elements, I am referring to the surfaces of elements in 3D, or edges of elements in 2D. These elements are created using the FEFaceValues class.

Unfortunately, when I try to extract the Jacobian of these face elements, I always end up with matrices filled with zeroes. Additionally, I expected the matrix to be a dim x (dim - 1) matrix, but the return value is a dim x dim matrix.

The reason why I am trying to get their Jacobians is to calculate the derivative of the area of an element's surface in real space (x,y,z) with respect to the area of the parent element's surface (ξ1, ξ2, ξ3). This is for the 3D case.

I first tried doing this in 2-D by modifying the step-7 code. Below are some of the changes I did:

Line 600 (added the update_jacobian flag)
FEFaceValues<dim> fe_face_values (*fe, face_quadrature_formula,
update_jacobians | update_values | update_quadrature_points |
update_normal_vectors | update_JxW_values);

Line 700 (display the Jacobian row by row)
Tensor<2,dim> jacobian = fe_face_values.jacobian(q_point);

std:cout    << "Face number: "
                << face
                << std:endl
                << "q_point: "
                << q_point
                << std::endl
                << "Jacobian x1: "
                << jacobian[0]
                << std::endl
                << "Jacobian x2: "
                << jacobian[1]
                << std::endl;

The output will be mostly a bunch of zeroes. I greatly appreciate any help with this issue. Thank you!

Martin Kronbichler

unread,
Jan 23, 2015, 4:09:33 AM1/23/15
to dea...@googlegroups.com
Dear Soon,


> Unfortunately, when I try to extract the Jacobian of these face
> elements, I always end up with matrices filled with zeroes.
> Additionally, I expected the matrix to be a dim x (dim - 1) matrix,
> but the return value is a dim x dim matrix.

There are two problems here:
- The reason that the Jacobian is filled with zero is a bug in deal.II.
I will soon create a pull request to address this issue.
- Regarding the dimensions, the Jacobian transformation for FEFaceValues
is still reflecting the transformation of the whole element including
the interior, so this is not what you are expecting. We have the
capabilities to compute derivative forms of dimension spacedim x dim (3
x 2) which is what you want, but they are not accessible as long as you
don't work in the co-dim 1 case. Or am I missing something here, Luca?

Best,
Martin


Luca Heltai

unread,
Jan 23, 2015, 5:13:44 AM1/23/15
to Deal.II Users
In co-dimension one this is the default. It shouldn't be hard to add this capability to FEFaceValues, though, since the machinery is already in place.

You could do this very quickly by hand, storing into a DerivativeForm< order, dim-1, dim > (assuming you are in co-dimension zero), the gradient of the transformation.

DerivativeForm has a lot of members that compute what you typically need in these cases.

L.

--
Luca Heltai <luca....@gmail.com>
http://people.sissa.it/~heltai/
Scuola Internazionale Superiore di Studi Avanzati
Phone: +39 040 3787 449, Office: 622
--
There are no answers, only cross references
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Soon Kiat Lau

unread,
Jan 23, 2015, 2:27:55 PM1/23/15
to dea...@googlegroups.com
Hello all,

Thank you for replying to my question. Hopefully this bug gets fixed in the next release.

Dr. Heltai, where or how do I get the gradient of the transformation? I tried writing some code to create it from the shape functions, but it is not working out because I am still unfamiliar with deal.ii's classes. I have read the documentation for the FEFaceValues and DerivativeForm classes but I could not find any function or property that gives the gradient of transformation.


Thank you,
SKL

Martin Kronbichler

unread,
Jan 23, 2015, 3:36:27 PM1/23/15
to dea...@googlegroups.com
Dear Soon,


> Thank you for replying to my question. Hopefully this bug gets fixed
> in the next release.

If you use the development version (via github), you can get the
Jacobian of the transformation already. If you test it and find
problems, please let us know.

Regarding what you are looking for: With the Jacobian, you get the full
transformation, including what is in the interior of the element. To get
the dim x dim-1 surface part out of it, my (unqualified) guess is that
you just need to take the part orthogonal to the unit face vector, i.e.,
the dim-1 corresponding to the other two unit directions.

Best,
Martin


Soon Kiat Lau

unread,
Jan 26, 2015, 6:39:17 PM1/26/15
to dea...@googlegroups.com
Hello Dr. Kronbichler,

Thank you for applying the changes! I am not familiar with github, but I tried downloading the master zip file and installing it. When I ran the command 'make test' during installation, I encountered errors on all four tests. I then tried downloading the latest official version of deal.II (8.2.1) and manually replace the files with your modifications (https://github.com/dealii/dealii/commit/cfbfe858ddb22426f6c521e558ea404a8ff59667), but I still get the same problem during 'make test.'

I have attached the quicktests.log files for your reference (master is for the github build, 8.2.1 is for the latest official version). It seems that the tests always failed because of an undefined reference to `clock_gettime'. I did some searching and found that it is a Linux function that can be included with time.h (http://linux.die.net/man/3/clock_gettime). Should I include this file when running the tests?


Thank you for your time,
SKL
master_quicktests.log
8.2.1_quicktests.log

Matthias Maier

unread,
Jan 26, 2015, 6:55:01 PM1/26/15
to dea...@googlegroups.com

Am 27. Jan 2015, 00:39 schrieb Soon Kiat Lau <soonk...@gmail.com>:

> (http://linux.die.net/man/3/clock_gettime). Should I include this file when
> running the tests?

I guess that -lrt is missing from the link interface
(This seems to be possible with bundled boost + no external feature)

In order to debug this issue, please attach the file 'detailed.log'
located in your build directory.

Best,
Matthias

Soon Kiat Lau

unread,
Jan 26, 2015, 7:04:58 PM1/26/15
to dea...@googlegroups.com
Hello Matthias,

Please find attached the requested files. I have attached the logs for the master build from github, and also the 8.2.1 build.


Thank you,
SKL
master_detailed.log
8.2.1_detailed.log

Matthias Maier

unread,
Jan 27, 2015, 4:55:35 AM1/27/15
to dea...@googlegroups.com

Am 27. Jan 2015, 01:04 schrieb Soon Kiat Lau <soonk...@gmail.com>:

> Hello Matthias,
>
> Please find attached the requested files. I have attached the logs
> for the master build from github, and also the 8.2.1 build.
>

Please cd into your build directory (where detailed.log is located) and
reconfigure with:

$ cmake -DDEAL_II_LIBRARIES="rt" .

(do not omit the dot) and rebuild the library:

$ make

Do the tests work now?

Matthias Maier

unread,
Jan 27, 2015, 6:53:58 AM1/27/15
to dea...@googlegroups.com

This issue is fixed in the following pull-request:

https://github.com/dealii/dealii/pull/475

Soon Kiat Lau

unread,
Jan 27, 2015, 10:08:34 AM1/27/15
to dea...@googlegroups.com
Hello Matthias,

I have applied the changes and it passed all four tests with flying colors! Thank you for your help!

My original problem (Jacobian for face elements) was also solved, so thank you Dr. Heltai and Dr. Kronbichler!

I hope to contribute to the deal.II community in the future.


Regards,
SKL
Reply all
Reply to author
Forward
0 new messages