I can further confirm the problem is with what is called in step-37 
mg_matrices. Since in setup the mg_matrices is aware of both the CG 
dof_handler and DG dof_handler it leads to it making a larger size. 
However, the diagonal_inverse vector is setup with the CG dof_handler which 
in turn does not match the mg_matrices size when initializing in the 
smoother when making the preconditioner.

Currently, for system_matrix and mg_matrices I have simply only changed the 
reinit() functions to account for a std::vector of DoFHandlers and a 
std::vector of AffineConstraints. In addition, this leads to needing to 
form a std::vector of MGConstrainedDoFs for the mg_matrices. I thought this 
was needed so that I could use the values of the DG variables in the 
computation of the system_matrix and mg_matrices. Is there a different way 
I should be doing this?

On Wednesday, June 21, 2023 at 12:29:11 PM UTC-6 Sean Johnson wrote:

> I am trying to make a matrix free solver like in step-37; however, my 
> equations involve variables that are solved with a DG DoFHandler. So for 
> solving I changed within LaplaceProblem<dim>::setup_system() the 
> following functions to account for multiple DoFHandler's: 
> system_mf_storage->reinit()
> mg_mf_storage_level->reinit()
> which led to me having to edit mg_matrices[level 
> <https://www.dealii.org/current/doxygen/deal.II/grid__out_8cc.html#a9082f945c1d289684d0bcd51ee08e11e>].initialize()
>  
> to account for multiple mg_constrained_dofs.
>
> All of that was fine until I got to LaplaceProblem<dim>::solve(). I cant 
> edit either of the following functions because they don't allow for 
> multiple DoFHandler's:
> MGTransferMatrixFree<dim, float> 
> <https://www.dealii.org/current/doxygen/deal.II/classMGTransferMatrixFree.html>
>  
> mg_transfer(mg_constrained_dofs);
> mg_transfer.build(dof_handler);
>
> I am unsure if that will cause problems but the line that for sure does 
> cause an error and for the code not to finish is initializing the 
> mg_smoother:
> mg_smoother.initialize(mg_matrices, smoother_data);
>
> This always gives me the error:
> An error occurred in line <2684> of file 
> </home/sjohnson/AE_beginnings/dealii/include/deal.II/lac/precondition.h> in 
> function
>     void 
> dealii::internal::PreconditionChebyshevImplementation::initialize_preconditioner(const
>  
> MatrixType&, std::shared_ptr<dealii::DiagonalMatrix<VectorType> >&) [with 
> MatrixType = Brill_Evolution::alpha_Operator<2, 4, float>; VectorType = 
> dealii::LinearAlgebra::distributed::Vector<float>]
> The violated condition was: 
>     preconditioner->m() == 0
> Additional information: 
>     Preconditioner appears to be initialized but not sized correctly
>
> I believe this is because the mg_matrices has been initialized with 
> multiple dof_handlers but I am unsure how to address this problem and have 
> not been able to find a matrixfree example with multiple dof_handlers.
>
> Thanks,
> Sean Johnson
>

-- 
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/83592226-ce08-48cd-9d1c-63c3007b0148n%40googlegroups.com.

Reply via email to