Good morning everybody,
I'm writing a PETSc distributed version of step-14.
In
void WeightedResidual<dim>::output_solution()
I need to interpolate the solution of the dual solver (FE_Q(2)) on the
primal space (FE_Q(1)) , otherwise I wouldn't be able to show them in the
same output file.
Moreover other interpolations between spaces are needed further ahead for
the dual-weighted error estimation.
This is my current code.
// Define the new dual_solution vector, which will house the interpolated
values
PETScWrappers::MPI::Vector completely_distributed_dual_solution_on_primal(
PrimalSolver<dim>::locally_owned_dofs,
PrimalSolver<dim>::mpi_communicator); // NO GHOST elements
FETools::interpolate(DualSolver<dim>::dof_handler,
DualSolver<dim>::completely_distributed_solution,
PrimalSolver<dim>::dof_handler,
PrimalSolver<dim>::linear_system_ptr->hanging_node_constraints,
completely_distributed_dual_solution_on_primal);
It works with 1 rank, but not with more than one.
---------------------------
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?
Thanks a lot in advance!
Kind regards,
Matteo Malvestiti
--
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].
To view this discussion visit
https://groups.google.com/d/msgid/dealii/3e487555-52f8-451b-aa66-e9146463775fn%40googlegroups.com.