Access old solution(s) in MatrixFreeOperators::Base::apply_add()

16 views
Skip to first unread message

Maxi Miller

unread,
Jul 26, 2019, 10:42:22 AM7/26/19
to deal.II User Group
I followed step-37 for creating a MatrixFreeOperator, but now I also would like to access a previous solution (which is needed during apply_add()), and stored using a LinearAlgebra::distributed::Vector. In step-48 there is an example which uses previous solutions, but here the solve-function is replaced, and therefore making it difficult to implement it in my problem.
Thus, what would be the most efficient way of giving the operator-function apply_add access to those solution vectors? I tried adding a class member and initializing it during setup_system(), but when accessing it via read_dof_values(), I had a layout mismatch, resulting in
The violated condition was:
    vec
.partitioners_are_compatible(*dof_info.vector_partitioner)
Additional information:
   
The parallel layout of the given vector is not compatible with the parallel partitioning in MatrixFree. Use MatrixFree::initialize_dof_vector to get a compatible vector.

Are there better ways?
Thanks!

Daniel Arndt

unread,
Jul 26, 2019, 1:36:49 PM7/26/19
to dea...@googlegroups.com
Maxi,

[...] I tried adding a class member and initializing it during setup_system(), but when accessing it via read_dof_values(), I had a layout mismatch, resulting in
The violated condition was:
    vec
.partitioners_are_compatible(*dof_info.vector_partitioner)
Additional information:
   
The parallel layout of the given vector is not compatible with the parallel partitioning in MatrixFree. Use MatrixFree::initialize_dof_vector to get a compatible vector.

Did you initialize its layout via MatrixFree::initialize_dof_vector() in fact?

Best,
Daniel

Maxi Miller

unread,
Jul 26, 2019, 4:30:02 PM7/26/19
to deal.II User Group
I found my mistake, I could not reuse the same partition for the main matrix and the MG-matrices, thus I had to add


       
LinearAlgebra::distributed::Vector<float> local_solution;

        mg_matrices
[level].initialize_dof_vector(local_solution);

//        local_solution = solution;

        mg_matrices
[level].set_old_solution(local_solution);

in the loop while creating those matrices. My next problem, though, is how to fill the local_solution-vector based on the solution-vector. When uncommenting the line above, I get exactly the same error as before. Are there alternatives?
Reply all
Reply to author
Forward
0 new messages