Re: [deal.II] Difference between BlockDynamicSparsityPattern and TrilinosWrappers::BlockSparsityPattern

2019-08-30 Thread Wolfgang Bangerth


Bruno,
I don't quite recall if we ever used the BlockDynamicSparsityPattern in a 
parallel context. For sure, the way you're initializing it implies that every 
process allocates the memory for all DoFs as it's not given the information 
about locally_relevant_dofs. I'd have to look up whether there is a way to do 
that. On the other hand, I would assume that the Trilinos version has a way to 
designate what are the locally relevant dofs on each process.

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/6660a035-74c3-1219-c886-70b71c800305%40colostate.edu.


[deal.II] Difference between BlockDynamicSparsityPattern and TrilinosWrappers::BlockSparsityPattern

2019-08-30 Thread Bruno Blais
Hello,
I am currently working on a parallel implementation of step-57, thus I am 
learning to live with BlockVectors, BlockMatrices and BlockSparsityPatterns 
in parallel. 
Originally, I thought that I could make my sparsity pattern the following 
way (i.e as in step-57, but distributing it afterwards) :
std::vector block_component(dim+1, 0);
block_component[dim] = 1;
DoFRenumbering::component_wise (dof_handler, block_component);
dofs_per_block.resize (2);
DoFTools::count_dofs_per_block (dof_handler, dofs_per_block, block_component
);
unsigned int dof_u = dofs_per_block[0];
unsigned int dof_p = dofs_per_block[1];

locally_owned_dofs.resize(2);
locally_owned_dofs[0] = dof_handler.locally_owned_dofs().get_view(0, dof_u);
locally_owned_dofs[1] =dof_handler.locally_owned_dofs().get_view(dof_u, 
dof_u + dof_p);

IndexSet locally_relevant_dofs_acquisition;
DoFTools::extract_locally_relevant_dofs(dof_handler, 
locally_relevant_dofs_acquisition);
locally_relevant_dofs.resize(2);
locally_relevant_dofs[0] = locally_relevant_dofs_acquisition.get_view(0, 
dof_u);
locally_relevant_dofs[1] = locally_relevant_dofs_acquisition.get_view(dof_u, 
dof_u + dof_p);

... Place where I make my constraints ...

BlockDynamicSparsityPattern dsp(dofs_per_block, dofs_per_block);
DoFTools::make_sparsity_pattern(dof_handler, dsp, nonzero_constraints);

SparsityTools::distribute_sparsity_pattern(
 dsp,
 dof_handler.locally_owned_dofs_per_processor(),
 mpi_communicator,
 locally_relevant_dofs_acquisition);

system_matrix.reinit(dsp);
pressure_mass_matrix.reinit(dsp.block(1, 1));

When launching in sequential - Debug I have no issue and my solver works 
perfectly. When launching in parallel, within my pre-conditioner, I get an 
error such as :
The violated condition was: 
in.trilinos_partitioner().SameAs(m.DomainMap()) == true
Additional information: 
Column map of matrix does not fit with vector map!

Clearly, I am doing something wrong with my sparsity pattern since it 
appears the block of my vector and the block of my matrix are incompatible 
in size.
I have found that step 32 uses a TrilinosWrappers::BlockSparsityPattern 
instead of a BlockDynamicSparsityPattern. Is this what I should do with my 
case?
I am unsure what is the distinction between what I am doing right now and 
what the TrilinosWrappers::BlockSparsityPattern would do?

If there is a lack of information, I can post a link to the code which is, 
regretfully, quite big.
Best
Bruno

-- 
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/f1b8455d-5a5e-4623-9b70-b4baf87e2435%40googlegroups.com.