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

Integrals and quadrature used withing a form

0 votes

Hello,

I would like to define a function that includes an integral of an unknown in a single direction of a 3D mesh, like this:

$$ U(x,y,z) = \int_{z_b}^z u(x,y,z') dz' $$

I would like an expression for the continuous definite integral of $u(x,y,z)$. For example, using rectangular quadrature,

$$ U(x,y,z) = \int_{z_b}^z u(x,y,z') dz' \approx (z-z_b) u\left(x,y,\frac{z_b+z}{2}\right).$$

I keep seeing "quadrature" elements -- can they be used to solve this problem? I'd rather use built-in tools if I can, but otherwise I'll have to use numpy or something.

asked Aug 26, 2015 by pf4d FEniCS User (2,970 points)
edited Aug 31, 2015 by pf4d

Hello pf4d, your notation is ambiguous to me. One thing is that you're integrating over z' but use z both in the integrand and as upper limit. Another is that the left hand side should still depend on x,y? Using different letters, do you mean this?

f(x,y) = \int_a^b u(x,y,z) dz

But sorry, I don't see how to solve this using built-in tools, and no, quadrature elements is something entirely different.

Yes, I think this may have been ambiguous -- I've edited the equation to better describe what I'm doing.

If I were working on a 2D mesh, then I could just define several $u$ functions in sigma coordinates and use them for the depth-integrated values. However, my problem is defined on a 3D mesh, and as such I cannot separate the layers in a UFL form explicitly, like $u(0.5, 0.5, 0.5)$.

My best solution to this problem is create my own Newton solver and at each iteration solve the integration problem explicitly, as described here.

I thought that I could maybe hack the quadrature parts of FEniCS used for FEM machinery to do this in a neater way.

...