Hi Guilhem,

Thanks for reporting the bug and providing a failing test. I have opened a 
PR (hopefully) fixing the issue 
(https://github.com/dealii/dealii/pull/12738) and simplified your code a 
bit (since the issue was not related to MatrixFree). Maybe you could verify 
that it indeed works for you!?

Looking forward to your result you will obtain with MatrixFree! If you want 
you can also checkout the new global-coarsening multigrid infrastructure as 
shown in step-75.

PM

On Thursday, 2 September 2021 at 18:14:23 UTC+2 [email protected] wrote:

> Dear deal-ii users and developers, 
>
> I am currently implementing a code that minimizes an energy functional 
> depending on a traceless symmetric tensor (5D solution) for liquid crystal 
> physics. The physics details matters not, I will just mention that I am 
> using a combination of trust-region Newton iterations with a Truncated 
> Conjugate Gradient (TCG) solver and matrix-free approach with multigrid 
> preconditioning. This works exceedingly well for simple problems with 
> Dirichlet boundary conditions, and I must say I am very impressed by the 
> quality and efficiency of the dealii library and the excellent 
> documentation, so a big thanks to all the developers! 
>
> However, I have a problem when I want to use periodic boundary conditions 
> together with matrix-free multigrid preconditioning (it works fine with 
> matrix-free but no preconditioner). Specifically, the problem arises when I 
> try to use the method MGTransferMatrixFree::interpolate_to_mg, that allows 
> me to transfer the solution of my problem at each level of the 
> triangulation (where it is further used in the calculation of the system 
> matrix at this level, which in my case corresponds to the hessian of the 
> free energy functional, but I think that it is irrelevant for the problem I 
> have).
>
> Basically, this method tries to access an element of a distributed vector 
> that is not stored on the current MPI process, so I get an exception raised 
> by LinearAlgebra::distributed::Vector. If I use Dirichlet BCs instead of 
> periodic ones, the problem goes away. So it seems to be a problem with the 
> way that the vectors of my problem are partitioned when I include periodic 
> BCs. To illustrate this problem, I am attaching a MWE that shows how I 
> setup matrix-free and multigrid objects with periodic BCs, and raises the 
> same error as in my main code. I am using deal.II v9.3 on an archlinux 
> distribution.
>
> I have looked at all the tutorials related to matrix-free and multigrid 
> objects (this is how I wrote the base program in the first place), but was 
> not able to find a solution on my own. I have tried various way of 
> specifying the AffineConstraints objects for the level matrix-free objects, 
> but none worked out. I also tried dummy AffineConstraints like in step 59 
> which uses periodic faces, but this does not work, so I guess this is is 
> specific to FE_DGQ (whereas I am using FE_Q spaces). I must do something 
> wrong because it works so well without periodic BCs, so if anyone has an 
> idea this would be great :) I am happy to provide any additional details 
> that you would deem important.
>
> Best regards,
>
> Guilhem
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/dealii/0a9e58b3-495c-4cd9-9c65-1b80afd46a0dn%40googlegroups.com.

Reply via email to