On 06/02/2017 07:37 AM, Sean McGovern wrote:

What's a good way to integrate a quantity in the vertical direction? For example, how do I find the weight of water above a point (assuming variable density, so that the integration is necessary)? In a structured regular mesh, I would fix the x and y coordinates of the grid and iterate over the z coordinate adding up the different weight contributions per cell.
  What would the way to emulate this in dealii be (in a globally refined 
context)?

What you want to do (a line integral) is, in general, a difficult operation on non-uniform meshes. As with all integrals, you will want to approximate it with some kind of quadrature rule, which would require you to evaluate the solution at quadrature points that are located *somewhere*, as far as the mesh is concerned. You can do this evaluation with VectorTools::point_value(), and this will work if you use a relatively small number of quadrature points located along your vertical line. But the function is expensive if you need a lot of quadrature points.

An alternative is to rewrite the line integral as a volume integral. For example, your integral

  \int_a^b  f(x0,y0,z)  dz

(where 'f' is a function of your finite element solution, and x0,y0 are the coordinates of the vertical line you're trying to integrate along) is equal to

  \int\int\int f(x,y,z) \delta(x-x0) \delta(y-y0)  dz dy dz

If you replace the delta functions by an appropriate approximation (e.g., a Gaussian with a width equal to several times the mesh size), then the integral is approximated by the volume integral

  \int\int\int f(x,y,z) K(x,y,z)  dz dy dz

with some kernel K(x,y,z). This is now just any other ordinary volume integral where K(x,y,z) is explicitly given. It is easy to integrate on a finite element mesh.

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.edu/~bangerth/

--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to