While I can do what Wolfgang wrote below, I was being lazy and did the
following

I store the inverse mass matrix as following

   dealii::PreconditionBlockSOR<dealii::SparseMatrix<double>,double>
inv_mass_matrix;

Then

      CompressedSparsityPattern c_sparsity(dof_handler.n_dofs());
      DoFTools::make_sparsity_pattern (dof_handler, c_sparsity);
      sparsity_pattern.copy_from(c_sparsity);
      system_matrix.reinit (sparsity_pattern);
      MatrixCreator::create_mass_matrix (mapping,
                                         dof_handler,
                                         QGauss<dim>(fe.degree+1),
                                         system_matrix);
      // Compute the inverse of the blocks
      inv_mass_matrix.initialize (system_matrix, fe.dofs_per_cell);

Once I assemble the rhs in M*du/dt = rhs into right_hand_side, I use

inv_mass_matrix.vmult (newton_update, right_hand_side);

where now newton_update = du/dt and I can apply an RK scheme.

Does the above look ok ? The code is not yet working (blow up after 2-3 time
steps) so I might be making a mistake.

Note that fe is of type FE_DGQ.

praveen

On Fri, Apr 29, 2011 at 7:47 PM, Wolfgang Bangerth
<[email protected]>wrote:

>
> > This needs the mass matrix M which is a block diagonal matrix and does
> not
> > change with time. I am planning to compute its inverse and store it. In
> the
> > RK scheme, I will just use vmult to multiply the inverse with the right
> > hand side, to get du/dt and update the solution.
> >
> > I am not sure how to compute/store the inverse.
>
> If your matrix is block diagonal, the inverse is the matrix that consists
> of
> the inverse blocks. In other words, to store the inverse, rather than
> assemble
> the matrix of the blocks you compute on each cell and then invert the whole
> thing, you could compute the local contributions, invert them, and copy the
> inverses into the global matrix.
>
>
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to