On Tuesday, October 8, 2019 at 8:43:23 AM UTC-4, Yang Liu wrote:
>
>
> Dear DEAL.II users,
>
> The DEAL.II software provides the function 
> VectorTools::compute_mean_value() to integrate the solution over the whole 
> domain. 
>
> But now I would like to integrate the solution over a subdomain. 
>
> fCan anyone give me some suggestions? Thanks in advance!
>

Hello,

I guess it's not currently part of the library since the subdomain are 
determined by the partitioner, so it's rather odd that you need to 
integrate a specific subdomain. What you can do however, is basically copy 
this code

https://github.com/dealii/dealii/blob/0ecc60213ae1236616047153348e5996052eb2e2/include/deal.II/numerics/vector_tools.templates.h#L9035-L9105

and add a parameter such that

 compute_mean_value(const Mapping<dim, spacedim> &   mapping,
                     const DoFHandler<dim, spacedim> &dof,
                     const Quadrature<dim> &          quadrature,
                     const VectorType &               v,
                     const unsigned int               component,
                     const unsigned int              
 subdomain_to_integrate)

and change line 9062

if (cell->is_locally_owned())

to

if (cell->is_locally_owned() && cell->subdomain_id == 
subdomain_to_integrate)

Not sure if there is a more elegant way. 

Doug

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/426afa6d-0df6-4fa7-9636-476f2a14977e%40googlegroups.com.

Reply via email to