Re: [deal.II] Re: Initialization of PETSc::MPI::BlockSparseMatrix

2020-09-17 Thread Wolfgang Bangerth

On 9/17/20 9:07 AM, Gabriel Stankiewicz wrote:
I created IndexSets by using the function 
DoFTools::locally_owned_dofs_per_component() and then gathering all indices 
corresponding to displacement DoFs (three instances of IndexSet) into one 
IndexSet using IndexSet::add_indices() and the fourth instance correponded to 
electric potential DoFs. However, the function 
DoFTools::locally_owned_dofs_per_component() wasn't returning only locally 
owned DoFs but also the locally not owned ones.


No, that isn't right. This is a function that is so widely used that it is 
hard to believe that it would be wrong. If you think that it returns something 
wrong, I believe that your *understanding* of what this function returns is 
wrong, and that might lead to further confusion downstream when you are 
thinking how to initialize matrices.


There are quite a number of tutorial programs that build parallel block 
matrices. I know that step-32 does this for Trilinos, but I think that the 
parallel Navier-Stokes solver does it for PETSc. It would be useful to just 
compare your code with how these programs do it.


Best
 W.

--

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

--
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/7456c0c4-d042-2455-50bc-659ddaf9de16%40colostate.edu.


Re: [deal.II] Re: Initialization of PETSc::MPI::BlockSparseMatrix

2020-09-17 Thread Gabriel Stankiewicz
I created IndexSets by using the function 
DoFTools::locally_owned_dofs_per_component() and then gathering all indices 
corresponding to displacement DoFs (three instances of IndexSet) into one 
IndexSet using IndexSet::add_indices() and the fourth instance correponded 
to electric potential DoFs. However, the function 
DoFTools::locally_owned_dofs_per_component() wasn't returning only locally 
owned DoFs but also the locally not owned ones. In the end I used the check 
locally_owned_dofs.is_element() to make sure I gather only locally owned 
DoFs for displacement and electric potential into my final IndexSets. The 
resulting IndexSets were always of size 2145. 

I also tried first explicitly setting the sizes of the final IndexSets 
using IndexSet::set_size() function, but as said, I could not add indices 
larger than the size to these index sets (eg. id = 440 could not be added 
to the IndexSet of size 330).

I didn't try the function IndexSet::split_by_block(), I didn't notice it in 
the dealii manual. I will try this one when I come back to the office, 
thank you for the suggestion!

Best,
Gabriel



środa, 16 września 2020 o 19:52:50 UTC+2 Timo Heister napisał(a):

> > This results in failed assertion, since: rows[0].size() = 2145, 
> rows[1].size() = 2145, but bdsp.block(0,0).n_rows() = 1815, 
> bdsp.block(1,1).n_rows() = 330 etc...
>
> The size() of each IndexSet needs to correspond to the size of each
> block of the sparsity pattern and this is what the assertion checks. I
> think that this check is correct. If you want your first block to be
> 1815 DoFs large, then rows[0].size() needs to be 1815.
>
> How are you creating these IndexSets? I find the function
> IndexSet::split_by_block() convenient to use.
>
>
> -- 
> Timo Heister
> http://www.math.clemson.edu/~heister/
>

-- 
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/7b6a254b-02d4-4339-b44b-716aca258292n%40googlegroups.com.