setup matrix using petsc and metis in 3D

30 views
Skip to first unread message

Jose Javier Muñoz Criollo

unread,
May 6, 2014, 10:45:41 AM5/6/14
to dea...@googlegroups.com
Hi

I'm using deal.ii-8.0.0.
I'm trying to setup a parallel sparse matrix:

 PETScWrappers::MPI::SparseMatrix system_matrix;

Until now I was working in 2D, so I had been initializing the matrix like this:

   const types::global_dof_index n_local_dofs
      = DoFTools::count_dofs_with_subdomain_association (dof_handler,
                                                         this_mpi_process);
 
    system_matrix.reinit      (mpi_communicator,
                               dof_handler.n_dofs (),
                               dof_handler.n_dofs (),
                               n_local_dofs,
                               n_local_dofs,
                               dof_handler.max_couplings_between_dofs());


I'm currently working on the 3D model. According to the documentation of the function max_couplings_between_dofs(), it shouldn't be used in a 3D case and in fact it throws an error if this is attempted. I'm trying to initialize the matrix in a similar way to step-40 (although it uses p4est for the grid). Like this:

    IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs ();
    CompressedSimpleSparsityPattern compressed_pattern (dof_handler.n_dofs());
    DoFTools::make_sparsity_pattern (dof_handler,
                                                      compressed_pattern);
    constraints.condense (compressed_pattern);
    SparsityPattern sp;
    sp.copy_from (compressed_pattern);

    system_matrix.reinit (locally_owned_dofs,
                                   locally_owned_dofs,
                                   sp,
                                   mpi_communicator);

But when I compile I receive an error like this:

undefined reference to `void dealii::PETScWrappers::MPI::SparseMatrix::reinit<dealii::SparsityPattern>(dealii::IndexSet const&, dealii::IndexSet const&, dealii::SparsityPattern const&, ompi_communicator_t* const&)'
make: *** [trl_3d_petsc_03_03_2014] Error 1

Is it related with the fact that I'm not using p4est? If so, which would be the correct way to reinit the matrix? Maybe using this other reinit function?

PETScWrappers::MPI::SparseMatrix::SparseMatrix
( const MPI_Comm &  communicator,
  const SparsityType &  sparsity_pattern,
  const std::vector< size_type > &  local_rows_per_process,
  const std::vector< size_type > &  local_columns_per_process,
  const unsigned int  this_process,
  const bool  preset_nonzero_locations = true )


Best Regards
javier

--
José Javier Muñoz Criollo
PhD Student | Cardiff University School of Engineering
E-mail: josejm...@gmail.com

Timo Heister

unread,
May 6, 2014, 11:24:56 AM5/6/14
to dea...@googlegroups.com
>> SparsityPattern sp;
>> system_matrix.reinit (locally_owned_dofs,
>> locally_owned_dofs,
>> sp,
>> mpi_communicator);

You don't need the dealii::SparsityPattern. Try feeding the
CompressedSimpleSparsityPattern as argument 3 into reinit(). Also see
step-18.

--
Timo Heister
http://www.math.clemson.edu/~heister/

Jose Javier Muñoz Criollo

unread,
May 8, 2014, 6:43:05 AM5/8/14
to dea...@googlegroups.com

Yes, you're right. How did I miss step 18? Thanks for your help.


Javier


--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages