Dear Seyed,

For output purposes, the output vectors must contain values for both 
locally owned and locally relevant DoFs. This is because DataOut needs to 
output the solution for an entire patch (i.e. one whole cell) , which 
demands that it knows the solution at all of the DoFs in that cell.

In step-40, the two relevant lines are:
    locally_relevant_solution.reinit (locally_owned_dofs,
                                     locally_relevant_dofs, mpi_communicator
);
and
data_out.add_data_vector (locally_relevant_solution, "u");

So one easy way to do this is to simply create a new temporary vector in 
your output() function, copy the solution from the vector with only locally 
owned DoFs to the new one that contains the union of the owned and relevant 
indices.
locally_relevant_solution = locally_owned_solution;
This will copy the relevant data from other processors to the each process 
that requires it.

I hope this helps,
Jean-Paul


On Friday, February 3, 2017 at 12:56:54 PM UTC+1, Seyed Ali Mohseni wrote:
>
> I realized my vector is not an MPI Vector and I am trying to use the 
> compress function. This won't work I assume. So I changed my global 
> variable to
>
> LA::MPI::Vector configurational_forces;
>
> This means I have to initialize it by the following command:
>
> configurational_forces.reinit(locally_owned_dofs, mpi_com);
>
>
> Now I have a problem. If I use the above approach and synchronize. 
> Everything works, but when I try to output or store, I think something goes 
> wrong. In my opinion, I just need to initialize the configurational_forces 
> vector with a larger IndexSet and not just to a locally owned one. Is that 
> possible?
>
> When I run the problem I receive the following error:
>
> ----------------------------------------------------
> Exception on processing: 
>
> --------------------------------------------------------
> An error occurred in line <131> of file 
> </home/seyedali/programming/c++/projects/dealii/source/lac/petsc_vector_base.cc>
>  
> in function
>     dealii::PETScWrappers::internal::VectorReference::operator double() 
> const
> The violated condition was: 
>     (index >= static_cast<size_type>(begin)) && (index < 
> static_cast<size_type>(end))
> Additional information: 
>     You tried to access element 18 of a distributed vector, but only 
> elements 0 through 17 are stored locally and can be accessed.
> --------------------------------------------------------
>
> Aborting!
> ----------------------------------------------------
>
>
> Any ideas?
>
> Kind regards,
> S. A. Mohseni
>
>

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

Reply via email to