Calculate surface integral over a boundary

74 views
Skip to first unread message

dragn...@gmail.com

unread,
Sep 23, 2016, 12:29:37 PM9/23/16
to deal.II User Group
Hello guys,

I searched the forum about how to calculate the surface integral over a boundary (during the post-processing) and found one post, where he was directed to the step-12. I am not sure if I can understand from there.
Any directions how to do it or some other place to look?
Thanks.

Dragan

Jean-Paul Pelteret

unread,
Sep 23, 2016, 12:56:16 PM9/23/16
to deal.II User Group
Hi Dragan,

What is it that you're trying to evaluate? Although you don't specifically mention it, as you're wanting to do this in post-processing I presume that you're wanting to evaluate something to do with the solution? If so, then you can use the get_function_values and get_function_gradients associated with the FEFaceValues class to extract the solution at the face quadrature points.

As a further example, in step-44 a boundary integral is evaluated to compute the nodal contributions of a force applied to a surface of a body.

I hope this helps.
J-P

dragn...@gmail.com

unread,
Sep 23, 2016, 1:17:42 PM9/23/16
to deal.II User Group

Hello Jean-Paul,

Thank you for the help.
Well, the actual situation is more complex, requires a generic solution, but it simplifies into a calculation of total quantity through a boundary. For instance, a simple case: say we have heat or mass transfer problem (or any scalar quantity) and specified some boundary conditions (problem-specific), how to get the total heat/mass passing through the specified boundary? Theoretically, the equation is something like (c is concentration here):


 Honestly, I do not understand the theory in the tutorial 44 (it's completely out of my area).

Dragan

Wolfgang Bangerth

unread,
Sep 23, 2016, 1:21:23 PM9/23/16
to dea...@googlegroups.com
On 09/23/2016 11:17 AM, dragn...@gmail.com wrote:
>
> Well, the actual situation is more complex, requires a generic solution,
> but it simplifies into a calculation of total quantity through a
> boundary. For instance, a simple case: say we have heat or mass transfer
> problem (or any scalar quantity) and specified some boundary conditions
> (problem-specific), how to get the total heat/mass passing through the
> specified boundary? Theoretically, the equation is something like (c is
> concentration here):
>
> <https://lh3.googleusercontent.com/-MWUI0byfiww/V-Viw0UincI/AAAAAAAAAAo/Z_b79mL9Rv0kYw9TqBkbn3m_qcBnIKwNwCLcB/s1600/eq200.gif>
>
>
> Honestly, I do not understand the theory in the tutorial 44 (it's
> completely out of my area).

Here is a piece of code that does what you want, though with a bigger
set up to get at the solution gradients and coefficient values than you
probably need:

https://github.com/geodynamics/aspect/blob/master/source/postprocess/heat_flux_statistics.cc#L122

It loops over all faces and then over the quadrature points of each face.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

dragn...@gmail.com

unread,
Sep 23, 2016, 1:24:09 PM9/23/16
to deal.II User Group
And one more thing I forgot. Although it is typically a post-processing task I would like to get it during the integration (the problem is transient).


On Friday, September 23, 2016 at 5:56:16 PM UTC+1, Jean-Paul Pelteret wrote:

dragn...@gmail.com

unread,
Sep 23, 2016, 1:30:13 PM9/23/16
to deal.II User Group, bang...@colostate.edu
Oh yes, that' exactly what I wanted (in the post-processing case). Thanks.
And if I want to do it during integration?

Dragan Nikolic

unread,
Sep 23, 2016, 2:39:01 PM9/23/16
to dea...@googlegroups.com
To answer my own question: finally I resolved a problem. I've been always getting zeros for the surface integral. It was a typo in the expression I have been using (c is the dof, D is diffusivity):

     \sum_{q} \sum_{i} {-D \times \left( \nabla
      \phi_{i,q} \cdot \hat{\mathbf{n}} \right) \times c_i \times
      JxW_q}

but I used q index for c by mistake.

Thanks for the help, that code snipped helped me when I looked at the implementation of  get_function_gradients (and the function it calls do_function_derivatives).

Dragan
-- 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 a topic in the Google Groups "deal.II User Group" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/vCRhuC2j9YE/unsubscribe. To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.

Wolfgang Bangerth

unread,
Sep 23, 2016, 5:13:55 PM9/23/16
to dragn...@gmail.com, deal.II User Group
On 09/23/2016 11:30 AM, dragn...@gmail.com wrote:
> Oh yes, that' exactly what I wanted (in the post-processing case). Thanks.
> And if I want to do it during integration?

What do you mean by "during integration"? What are you integrating at
that time?
Message has been deleted

dragn...@gmail.com

unread,
Sep 23, 2016, 6:18:18 PM9/23/16
to deal.II User Group, dragn...@gmail.com, bang...@colostate.edu
Well, as I said deal.II is integrated into another software (DAE Tools, mostly chemical engineering applications i.e. the fluid flow coupled with several scalar transport equations). Now, it works well. Basically, the system assembly is done only once (no adaptive meshes used). The system matrices/load vector are used to generate a set of diff. equations + additional equations for surface integrals. That way, the surface integrals are evaluated and available at every time step. All these equations are a part of the larger DAE system solved using Sundials IDA. The boundary conditions and generation terms (typically very non-linear) can be set using the variables from the "outer" software and the surface integrals are stored in the variables from the outer software. This typically produces a coupled system with a non-linear FE problem in it. The Newton type non-linear solver in IDA is used to solve the system (during the time step taken by the DAE solver; the analytical Jacobian is available).

Typical results from a FE system are quantities that flow in/out of the system (thus the need for surface integrals). I have a couple of working examples at the moment:
a) Heat transfer (surface integrals are the total heat transferred)
b) Cahn-Hilliard equation (i.e. used in electrochemistry - modelling of phase separation). This is particularly interesting since it produces excellent animations. Something like this on Wikipedia: Cahn-Hilliard equation. Many FE/FV software has this as an example (i.e. FiPy, libMesh also somewhere). I can generate some very cool videos for the gallery.

It needs a more detailed explanation, but this is the basically it. I am planning to write some longer description soon

Dragan
Reply all
Reply to author
Forward
0 new messages