{
A.clear();
// A0.clear();
// Initialize the block dynamic sparsity pattern
BlockDynamicSparsityPattern dsp( relevant_partitioning );
// DynamicSparsityPattern dsp0( locally_relevant_dofs );
// Instantiate the cell coupling table. The coupling across the
// faces go through the dofs corresponding to the cells.
Table<2, DoFTools::Coupling> cell_coupling(dim+2, dim+2);
for(unsigned int c = 0; c < dim+2; c++)
for(unsigned int d = 0; d < dim+2; d++)
if( c == 0 && d == dim+1 ) // Coupling between pD and p
cell_coupling[c][d] = DoFTools::none;
else if( c == dim+1 && d == 0 ) // Coupling between pD and p
cell_coupling[c][d] = DoFTools::none;
else if( c == dim+1 && d == dim+1 ) // Invoking the saddle point constraint
cell_coupling[c][d] = DoFTools::none;
else
cell_coupling[c][d] = DoFTools::always; // All other variables are coupled
Table<2, DoFTools::Coupling> face_coupling(dim+2, dim+2);
for(unsigned int c = 0; c < dim+2; c++)
for(unsigned int d = 0; d < dim+2; d++){
face_coupling[c][d] = DoFTools::none;
if( (c == 0 && (d != 0 && d != dim+1)) ||
(d == 0 && (c != 0 && c != dim+1)) ||
((c != 0 && c!=dim+1) && (d != 0 && d!=dim+1)))
face_coupling[c][d] = DoFTools::always;
}
// Build the sparsity pattern from the DoFHandler
DoFTools::make_flux_sparsity_pattern( dof_handler,
dsp,
cell_coupling,
face_coupling);
constraints.condense(dsp);
// constraints.condense(dsp0);
// distribute the sparsity patttern across all partitions
SparsityTools::distribute_sparsity_pattern(
dsp,
dof_handler.locally_owned_dofs(),
mpi_communicator,
locally_relevant_dofs );
// Re-initialize the system matrix
A.reinit( owned_partitioning, dsp, mpi_communicator);
// A0.reinit( locally_owned_dofs, dsp0, mpi_communicator);
}
{
Mp.clear();
// cell_couplingM corresponds to the coupling for making the
// preconditioner coupling sparsity pattern
Table<2, DoFTools::Coupling> cell_couplingM(dim+2, dim+2);
for(unsigned int c = 0; c < dim+2; c++)
for( unsigned int d = 0; d < dim+2; d++){
if( c == dim+1 && d == dim+1 )
cell_couplingM[c][d] = DoFTools::always;
else
cell_couplingM[c][d] = DoFTools::none;
}
// Initialize the block dynamic sparsity pattern
BlockDynamicSparsityPattern dsp( relevant_partitioning );
// Build the sparsity pattern from the DoFHandler
DoFTools::make_sparsity_pattern( dof_handler,
cell_couplingM,
dsp,
constraints,
false);
constraints.condense(dsp);
// distribute the sparsity patttern across all partitions
SparsityTools::distribute_sparsity_pattern(
dsp,
dof_handler.locally_owned_dofs(),
mpi_communicator,
locally_relevant_dofs );
// Re-initialize the system matrix
Mp.reinit( owned_partitioning, dsp, mpi_communicator);
}
U_local.reinit( owned_partitioning,
relevant_partitioning,
mpi_communicator);
R.reinit( owned_partitioning,
mpi_communicator);