On 1/17/25 04:09, Matteo Malvestiti wrote:
I've read in another discussion here on the user group, that interpolate should take in ghosted vectors, but I get an error as soon as I try that.
Specifically, if I do:

PETScWrappers::MPI::Vector
locally_relevant_dual_solution_on_primal(
    PrimalSolver<dim>::locally_owned_dofs,
    PrimalSolver<dim>::locally_relevant_dofs,
    PrimalSolver<dim>::mpi_communicator); // with NO GHOST elements

FETools::interpolate(DualSolver<dim>::dof_handler,
                            DualSolver<dim>::locally_relevant_solution,
                            PrimalSolver<dim>::dof_handler,
 PrimalSolver<dim>::linear_system_ptr->hanging_node_constraints,
                           locally_relevant_dual_solution_on_primal);

I then get the following error (even just in serial execution):

An error occurred in line <941> of file </var/folders/8z/hlb6vc015qjggytkxn84m6_c0000gn/T/heltai/spack-stage/spack-stage-dealii-9.6.0-rc1-3efkxbxl3aseiejk73xqv2r4jrvgva4l/spack-spc/include/deal.II/lac/pe

tsc_vector_base.h> in function

     const VectorReference dealii::PETScWrappers: :internal: :VectorReference: :operator+=(const PetscScalar &) const

The violated condition was:

     !vector.has_ghost_elements)

Additional information:


You are trying an operation on a vector that is only allowed if the vector has no ghost elements, but the vector you are operating on does have ghost elements.

Specifically, there are two kinds of operations that are typically not allowed on vectors with ghost elements. First, vectors with ghost elements are read-only and cannot appear in operations that write into these vectors. Second, reduction operations (such as computing the norm of a vector, or taking dot products between vectors) are not allowed to ensure that each vector element is counted only once (as opposed to once for the owner of the element plus once for each process on which the element is stored as a ghost copy).


See the glossary entry on 'Ghosted vectors' for more


Can someone more expert than me help to understand how I should face interpolations?

Matteo,
Thanks for reporting this!

It is entirely possible that this function has simply never been tried with parallel triangulations. I know that it was written several years before we ever started implementing parallel computations.

A good first step would be to create a "minimal working example" -- a complete, compilable code that only sets up data structures and then calls the function in question to demonstrate the error. The content of the vectors you pass in is not important, they might as well be zero vectors.

Would you be willing to come up with such a piece of code and submit it as a bug to the github repository? I can't promise that anyone has the capacity to actually fix the issue, but we can at least tell you where one might have to look to fix it!

Best
 Wolfgang

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           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 dealii+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/9242fdaa-19c5-4227-bb3b-4a3775acee37%40colostate.edu.

Reply via email to