Timo,
"
What I have done in several codes (and what is used in ASPECT), is to
always create block matrices and vectors but to put all DoFs into a
single block when a direct solver is used. This decision can be made at
rintime. Inside the solve routine
you can just access block_matrix.block(0,0), which is a SparseMatrix.
Same for the vector. This way, there are no different code paths,
different types, or copies involved. "
In terms of readability, this sounds like the best solution.
My motivation to use block structures even for direct solvers is to compute
norms of the pressure or the velocity, if we talk about the Stokes system.
Or in general, having access to the individual blocks to write them to files,...
If I am not mistaken, you create a nested finite element system with one block
FESystem<3> feVelocity( FE_Q<3>(degree), 3 );
FE_DGQ<3> fePressure(degree-1);
FESystem<3> nestedFE ( feVelocity, 1, fePressure, 1 );
resulting in a 1x1 block system.
But it is not clear to me how to compute the norms of velocity and pressure in that case.
So far, I used a Block indices object as returned by DoFTools::count_dofs_per_fe_block()
since I compute the l2-norm only of the unconstrained DoFs.
That said, how do you access the velocity and pressure block when working with direct solvers?
Thank you,
Simon