Sorry for messing up the topic. I should be Understanding loops in 
matrix-free. I wanted to insert a figure of the source code rather than the 
google groups formatting and it didn't work for some reason.
David schrieb am Samstag, 6. Februar 2021 um 19:15:07 UTC+1:

> Hi there,
>
> I'm currently trying to pack my cell operations into one of the 
> matrix-free loop functions.
> In my first version, I implemented the loops manually by using (sorry for 
> the odd formatting):
> ```
>             local_apply_cell(*matrix_free,
>                              system_rhs,
>                              source_vector,
>                              std::make_pair(0,
>                                             
> matrix_free->n_cell_batches()));
>             local_apply_boundary_face(
>               *matrix_free,
>               system_rhs,
>               source_vector,
>               std::make_pair(mf_data_reference->n_inner_face_batches(),
>                              mf_data_reference->n_inner_face_batches() +
>                                
> mf_data_reference->n_boundary_face_batches()));
> ```
> which works as desired. I don't have any operations on internal faces and 
> ghost exchange/compression doesn't matter for the rest of the question.
>
> In a second step, I replaced the manually implemented loops by the 
> matrix-free loop in the following way:
> ```
>             matrix_free->template loop<VectorType, VectorType>(
>               [&](const auto &data,
>                   auto &      dst,
>                   const auto &src,
>                   const auto &cell_range) {
>                 local_apply_cell(data, dst, src, cell_range);
>               },
>               [](const auto &, auto &, const auto &, const auto &) {},
>               [&](const auto &data,
>                   auto &      dst,
>                   const auto &src,
>                   const auto &face_range) {
>                 local_apply_boundary_face(data, dst, src, face_range);
>               },
>               system_rhs,
>               source_vector,
>               true,
>               MatrixFree<dim, Number, 
> VectorizedArrayType>::DataAccessOnFaces::
>                 none,
>               MatrixFree<dim, Number, 
> VectorizedArrayType>::DataAccessOnFaces::
>                 none);
> ```
>
> However, the system starts diverging after a time (as opposed to the 
> 'manual' loop), i.e., the result is different.
>
> I should probably add as a comment that I use sorted boundary condition 
> according to the boundary cell batches so that I apply the first set of 
> data to the first boundary face batch and the second one to the second... 
> Though, I checked the ordering manually and the loop-function seems to work 
> in the same order on the batches as the manual loop.
>
> I also tried to set the vector zeroing on the destination vector to 
> 'false' (I use continuous elements) but it doesn't make any difference. 
> According to my understanding of the loop function, both implementations 
> should be equivalent. I probably miss something here.
>
> Maybe anyone else has an idea about the differences.
> Thanks in advance and best regards,
> David
>
>

-- 
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/620dc4c7-4adf-47f7-8f43-cc9a3dd3e22en%40googlegroups.com.

Reply via email to