Sorry, I forgot to answer to the list as well ;-)
---------- Forwarded message ----------
Date: Wed, 30 May 2012 16:41:00
From: Bärbel Janssen <[email protected]>
To: tong qin <[email protected]>
Subject: Re: [deal.II] meshworker on blockmatrix
Dear Tong,
you can use MatrixBlockVector<SparseMatrix<double> >, it is documented in
http://www.dealii.org/developer/doxygen/deal.II/classMatrixBlockVector.html
The MeshWorker::Assembler::MatrixLocalBlocksToGlobalBlocks< MATRIX, number
can then assemble directly into that object above.
The assemble_system function would look like:
StokesProblem<dim>::assemble_system ()
{
for (unsigned int i=0;i<matrices.size();++i)
matrices.matrix(i) = 0;
MeshWorker::Assembler::MatrixLocalBlocksToGlobalBlocks<SparseMatrix<double>
assembler;
MeshWorker::IntegrationInfoBox<dim> info_box;
const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points,
n_gauss_points);
UpdateFlags update_flags = update_values | update_gradients;
info_box.add_update_flags(update_flags, true, true, true, true);
assembler.initialize(&dof_handler.block_info(), matrices);
MeshWorker::DoFInfo<dim> dof_info(dof_handler.block_info());
info_box.initialize(fe, mapping, &dof_handler.block_info());
MeshWorker::integration_loop<dim, dim>(
dof.begin_active(), dof.end(),
dof_info, info_box,
&Stokes<dim>::cell_matrix,
&Stokes<dim>::bdry_matrix,
&Stokes<dim>::face_matrix,
assembler);
}
It is very important to initialize the BlockInfo object in DoFHandler when you
setup your system!!!
I hope this helps. Let us know if there is still something not clear.
Best,
Bärbel
--
Bärbel Janssen
Institut für Angewandte Mathematik
Universität Heidelberg
Im Neuenheimer Feld 293, Raum 213
Telefon: +49 6221 54-5449
On Fri, 11 May 2012, tong qin wrote:
Dear dealii developers,
Recently I'm working on the stokes equation with DG element. I assembled the
matrix with meshworker.
To solve the matrix with iterative methods, I want to put the system in block
structure. The meshworker
does not
support sparse block matrix directly. I wonder whether I can modify some part
of the source code so
that it can assemble the
matrix in a block way. Thanks!
Best
Tong
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii