Errors in get_function_gradients() using PETSc

57 views
Skip to first unread message

Lex Lee

unread,
Oct 25, 2023, 1:08:58 AM10/25/23
to deal.II User Group
Hello deal.ii develpoers,


In my FSI problem, the parallization code solved 2 sets of equations using the "workstream" class interfacing with PETSc. Equation 1 will get known values of variables in equation 2, and so does equation 2. 

The solution for equation 2 is initiallized in this way.

hp_index_set = dof_handler.locally_owned_dofs();
hp_relevant_set = DoFTools::extract_locally_relevant_dofs(dof_handler);
solution.reinit(hp_index_set,
                hp_relevant_set,
                mpi_communicator);


In the "assemble_local" part, I used this line to get parts of the solution values.
 
fe_values[extractor_displacement].get_function_gradients(solution, grad_u);


In the "workstream" part, there are worker, copier, and workstream function.

    PerTaskData cp;

    auto worker =
      [this](const typename DoFHandler<dim>::active_cell_iterator &cell,
          ScratchData &                                         scratch,
          PerTaskData &                                         copy_data) {
        this->local_assemble_volume(cell, scratch, copy_data);
      };
    auto copier = [this](const PerTaskData &copy_data) {
       this->copy_local_to_global_volume(copy_data);
    };

      WorkStream::run(CellFilter(IteratorFilters::LocallyOwnedCell(),
                                 volume_dof_handler.begin_active()),
                      CellFilter(IteratorFilters::LocallyOwnedCell(),
                                 volume_dof_handler.end()),
                      worker,
                      copier,
                      sd,
                      cp);
      volume_system_matrix.compress(VectorOperation::add);
      volume_system_rhs.compress(VectorOperation::add);


Note that I used a cell filter to make the code run on locally owned cells, instead of ghosted cells.However, an error will occur in the "get function values" line. It failed to call back the function 

get_dof_values(values, local_values.begin(), local_values.end());

in the source file. Refer to the picture below.

The reason is deal.ii somehow tries to get values on ghosted cells, ignoring the cell filter. 

Screenshot from 2023-10-24 21-34-45.png

Screenshot from 2023-10-24 21-35-05.png
This puzzled me a lot for a long time. Any suggestion? 

Regards,
Lex

Wolfgang Bangerth

unread,
Oct 25, 2023, 10:35:05 AM10/25/23
to dea...@googlegroups.com

Lex,
you show the backtrace, but what is the actual error message you observe?
Best
WB

On 10/24/23 23:08, Lex Lee wrote:
> *** Caution: EXTERNAL Sender ***
> Screenshot from 2023-10-24 21-34-45.png
>
> Screenshot from 2023-10-24 21-35-05.png
> This puzzled me a lot for a long time. Any suggestion?
>
> Regards,
> Lex
>
> --
> The deal.II project is located at http://www.dealii.org/
> <http://www.dealii.org/>
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> <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+un...@googlegroups.com
> <mailto:dealii+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/d408514c-0f75-4448-8279-ac550830c6c1n%40googlegroups.com <https://groups.google.com/d/msgid/dealii/d408514c-0f75-4448-8279-ac550830c6c1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Lex Lee

unread,
Oct 25, 2023, 12:52:13 PM10/25/23
to deal.II User Group

Hello Prof. Bangerth,

Thanks for your reply.

"you show the backtrace, but what is the actual error message you observe?"

Did you mean what is the thrown error message in the command line?

input: mpirun -np 2 ./v1.0

output :
corrupted double-linked list
Decompressing section '.debug_rnglists'...inflated from 6492533 to 22203369 bytes

it stopped at this line
this->local_assemble_volume(cell, scratch, copy_data);

in the worker function
   auto worker =
      [this](const typename DoFHandler<dim>::active_cell_iterator &cell,
          ScratchData &                                         scratch,
          PerTaskData &                                         copy_data) {
        this->local_assemble_volume(cell, scratch, copy_data);
      };


Did I understand your question clear?



Lex

Wolfgang Bangerth

unread,
Oct 25, 2023, 3:23:32 PM10/25/23
to dea...@googlegroups.com


On 10/25/23 10:52, Lex Lee wrote:
>
> Did you mean what is the thrown error message in the command line?

Yes. What is the error message you see when you run the program on the
command line?


> input: mpirun -np 2 ./v1.0
>
> output :
> corrupted double-linked list
> Decompressing section '.debug_rnglists'...inflated from 6492533 to
> 22203369 bytes

I suspect this is some output you get from the debugger?

Best
W.

Lex Lee

unread,
Oct 25, 2023, 3:31:08 PM10/25/23
to deal.II User Group
I suspect this is some output you get from the debugger?

No, not from the debugger. 

Actually it is the output error message from the command line.


Lex

Wolfgang Bangerth

unread,
Oct 25, 2023, 3:53:09 PM10/25/23
to dea...@googlegroups.com

On 10/25/23 13:31, Lex Lee wrote:
>
> Actually it is the output error message from the command line.

Then how do you know that the problem happens because you are trying to
call get_dof_indices() on a ghost or artificial cell?

Best
W.

Lex Lee

unread,
Oct 25, 2023, 4:08:12 PM10/25/23
to deal.II User Group
Refer to the 2 pictures in the first email. 

The compilier tells me.

When an error occurred, it will backtrace the error and output the status && values of something. 

Regarding this function,  get_dof_values(values, local_values.begin(), local_values.end());

the compilier says these 3 inputs are not on the locally owned cells. 



Lex

Wolfgang Bangerth

unread,
Oct 25, 2023, 7:34:32 PM10/25/23
to dea...@googlegroups.com

On 10/25/23 14:08, Lex Lee wrote:
>
> The compilier tells me.
>
> When an error occurred, it will backtrace the error and output the
> status && values of something.
>
> Regarding this function, get_dof_values(values, local_values.begin(),
> local_values.end());
>
> the compilier says these 3 inputs are not on the locally owned cells.

I do not understand this statement. You say the "compiler says these 3
inputs are not on a locally owned cell". I don't think the compiler does
(perhaps the debugger -- the compiler has nothing to do any more once
the program runs), but in any case, what I'm asking is that you show me
exactly what it is the compiler (or any other program says). What you
show in the first picture is a stacktrace where in the program something
happens, and in the second picture what the values of certain variables
are. But neither of these screenshots show that the 3 inputs are not on
a locally owned cell, or at least I don't see why it would say that. I
see that you get a segmentation fault, but I don't know why that would
imply that you are on anything but a locally owned cell.

Separately, though, are you running in debug mode? If this is in release
mode, you should really switch to debug mod first.

Best
W.
Reply all
Reply to author
Forward
0 new messages