Line Integral of function

34 views
Skip to first unread message

RAJAT ARORA

unread,
Aug 10, 2017, 10:13:51 PM8/10/17
to deal.II User Group
Hello everyone,

I am using deal.ii to solve a 3D solid mechanics problem. My code uses PetSc and P4est.

The geometry is a cubical box [0 1] X [0 1] X [0 1] with a uniform rectilinear mesh in the domain.

I have obtained the scalar solution vector u in the domain.

I need to find the line integral of the solution along the boundary. For example: lets say
I want to integrate the solution variable
\int u dx on the line which is on +z face and goes from from (0,0,1) to (1,0,1).

Can someone please help to figure out how to do this? In the pseudo code, my doubt is how to initialize
the fe_face_values (line values?) object and the gauss quadrature formula for this?

integral = 0;

for (; cell != endc; ++cell)
        if (cell->is_locally_owned())
        {
          for (face = 0; face<GeometryInfo<dim::faces_per_cell;++face)
                if(cell->face(face)->boundary_id == my_boundary_id) // normal facing the -y direction: bottom face
                     for (line = 0; face<GeometryInfo<dim::lines_per_face;++line)
                           if (cell->face(face)->line(line)->center()(2) == 1) // boundary line needed
                              for (q = 0; q < number_of_q_points; ++q)
                             integral += function_value_at_q * fe_face_values.JxW(q);
        }
integral = SUM of integral from all processes


Thanks.

Wolfgang Bangerth

unread,
Aug 12, 2017, 8:27:18 PM8/12/17
to dea...@googlegroups.com, RAJAT ARORA

Rajat,

> The geometry is a cubical box [0 1] X [0 1] X [0 1] with a uniform rectilinear
> mesh in the domain.
>
> I have obtained the scalar solution vector u in the domain.
>
> I need to find the line integral of the solution along the boundary. For
> example: lets say
> I want to integrate the solution variable
> \int u dx on the line which is on +z face and goes from from (0,0,1) to (1,0,1).

There is not functionality right now that allows you to do easily what you
want to do. At some fundamental level, the reason is that for solutions of
most PDEs, the solution is in the space H^1 which allows you to take integrals
over d-dimensional objects (e.g., cells) as well as (d-1)-dimensional objects
(e.g. faces) but not (d-2)-dimensional objects such as lines in 3d. It's just
not well defined mathematically.

On a pragmatic level, it's not available because nobody has implemented this.


> Can someone please help to figure out how to do this? In the pseudo code, my
> doubt is how to initialize
> the fe_face_values (line values?) object and the gauss quadrature formula for
> this?
You have to create a 2-dimensional quadrature object that you can then use in
FEFaceValues. To this end, you need the 2d quadrature objects to have only
quadrature points on one of the bounding lines. This can be done using the
QProjector class. The issue you have to pay attention to is *which* edge of
the face quad you want to integrate over. This may require a bit of book-keeping.

Best
W.

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

Reply all
Reply to author
Forward
0 new messages