Hi Wolfgang, 
Thanks for the wonderfully clear answer. For my function f, I can basically 
treat the line integral like a "normal" volume integral, setting the 
direction using the delta functions. This would be the right approach for a 
distributed adaptive setting as well, no? It makes no assumptions about 
cell layout and is defined at the functional level.

If I may ask a follow up with an added wrinkle - it concerns the interplay 
of material_id (cells) and functions:

What if I don't have the form of f?

In my case, I have been using the material_id marker at the cell level to 
indicate different materials, that in the assembly loops, then provide 
different coefficient values to the local sums.
 Suppose that the distribution of these cell identities(material_id) is 
updated based on the results of some FE field calculations. Then given the 
configuration of the cells at that time step, I would like to do the line 
integral (essentially compute the weight of the material above the point), 
and go on to another FE solve. However, I do not have a functional form to 
put in my line integral. 
I don't know how to describe the weight function globally, but locally (at 
the cell level) it is defined. 
Would it be possible to:
1) somehow turn the distribution of cell->material_id over my mesh into a 
Function object (via the characteristic function)?
or 2) enumerate the material property (i.e., densities) into a vector 
defined at quadrature points over the whole mesh?

Thanks for your help. 
Best, 
Sean

PS
"The material of a cell may be used during matrix generation in order to 
implement different coefficients in different parts of the domain. It is 
not used by functions of the grid and dof handling libraries." [1]

Generally, I am hoping to better understand the relationship of the mesh( 
things like looping over cells, querying for the local properties, ...) and 
the Function object class which returns values based on the spatial 
position.

[1]https://www.dealii.org/developer/doxygen/deal.II/classTriangulation.html



On Monday, June 5, 2017 at 10:55:48 PM UTC+2, Wolfgang Bangerth wrote:
>
> 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] 
> <javascript:> 
>                             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