Whoops, this one was indeed a silly error! The problem had nothing to do 
with the `get_function_values` function. Rather, it only showed up there 
because that is the only place that I use ghost elements. These weren't 
being updated because (as clearly stated in the ghost vector documentation 
<https://www.dealii.org/current/doxygen/deal.II/DEALGlossary.html#GlossGhostedVector>)
 
one should not write to a ghosted vector, except by a copy assignment from 
a completely distributed (non-ghost) vector. I fixed the problem by copying 
the `locally_relevant_solution` vector into a 
`completely_distributed_solution` vector, adding the update there, and then 
copying back over to the `locally_relevant_solution` vector.

As an aside, is there a way to throw a warning/error if one tries to write 
to a ghosted vector with anything except a completely distributed vector? 
If possible, it might save someone some frustration...

In any case, so sorry for all the spam.

Kind regards,
Lucas

On Wednesday, January 26, 2022 at 4:31:21 PM UTC-6 Lucas Myers wrote:

> Hi everyone,
>
> I've been trying to write a parallel distributed solution to a nonlinear 
> PDE using Newton's method. It runs fine on one rank, but when I use two the 
> solver fails to converge on the second iteration. I've tracked the 
> difference (between one rank and two) down to the `get_function_values` 
> function evaluating the previous solution at quadrature points differently. 
> This seems to happen only near the boundaries of regions owned by different 
> ranks. I figure this is some sort of synchronization error, but I cannot 
> figure out how to fix it. I believe that I am calling `compress` when is 
> necessary, and call `update_ghost_values` prior to calling 
> `get_function_values`. However, I am still getting the difference.
>
> To help with debugging, I've tried to write a program which mimics the 
> behavior in as few lines as possible (~150 with comments and whitespace). I 
> attach it here in case it helps identify my (hopefully silly) error. 
>
> Any help is much appreciated.
>
> Kind regards,
> Lucas
>

-- 
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/8731f7ac-aa73-451d-8212-df4b6f43fd30n%40googlegroups.com.

Reply via email to