>  for (unsigned int i=0;i<dof_handler_total.n_dofs();i++)
>         if (selected_dofs[i]==true)
> {
>           sum+=vector_solution(i); ///where vector_solution is the
> vector that I want to integrate./
>           nodes_number++; ///number of nodes belonging to the boundary
> out1./
> }
>
> double integral_per_surface=sum/nodes_number;

This can only work if you have a uniform mesh since you need to weigh the 
contribution of all dofs by the surface element in the integral.

Why not do something like
  double integral = 0;
  for (cell=...)
    for (f=0...)
      if (cell->face(f)->at_boundary() &&
           cell->face(f)->boundary_indicator == something interesting)
        {
          fe_face_values.reinit (cell, f);
          fe_face_values.get_function_values (solution,
                                                    local_solution_values);
          for (q=0; q<fe_face_values.n_quadrature_points; ++q)
            integral += local_solution_values[q] * fe_face_values.JxW(q);
        }

?

W.

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

_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to