Dear Prof. Bangerth,

Thank you for your reply. I have changed the required data structures using 
PETSc wrappers. I have another doubt regarding this. Since I am running on 
a single machine, how should I use the reinit() function for PETSc Sparse 
Matrix. I was thinking to use the (3/5th) reinit() function. 
<https://dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1MPI_1_1SparseMatrix.html#a645ab9f99494a47ebb6492e92e707130>

How should I initialize the "index set" that is required for this function? 
In step-17 <https://www.dealii.org/current/doxygen/deal.II/step_17.html>, 
it uses the locally_owned_dofs to initialize the index set, however, that 
program was for multiple machines which is not the case with me.

Below is my system_setup() function currently - 

template <int dim,typename NumberType>
  void Solid<dim,NumberType>::system_setup()
  {
    timer.enter_subsection("Setup system");

    //std::vector<unsigned int> block_component(n_components, u_dof); // 
Displacement

    // The DOF handler is then initialised and we renumber the grid in an
    // efficient manner. We also record the number of DOFs per block.

    dof_handler_ref.distribute_dofs(fe);
    DoFRenumbering::Cuthill_McKee(dof_handler_ref);

    //DoFRenumbering::component_wise(dof_handler_ref, block_component);
    //DoFTools::count_dofs_per_block(dof_handler_ref, dofs_per_block,
                                 //  block_component);

    std::cout << "Triangulation:"
              << "\n\t Number of active cells: " << 
triangulation.n_active_cells()
              << "\n\t Number of degrees of freedom: " << 
dof_handler_ref.n_dofs()
              << std::endl;

    // Setup the sparsity pattern and tangent matrix
    tangent_matrix.clear();
    {
      //const types::global_dof_index n_dofs_u = dofs_per_block[u_dof];

      DynamicSparsityPattern csp(dof_handler_ref.n_dofs());

      //csp.block(u_dof, u_dof).reinit(n_dofs_u, n_dofs_u);
      //csp.collect_sizes();

      Table<2, DoFTools::Coupling> coupling(n_components, n_components);
      for (unsigned int ii = 0; ii < n_components; ++ii)
        for (unsigned int jj = 0; jj < n_components; ++jj)
          coupling[ii][jj] = DoFTools::always;
      DoFTools::make_sparsity_pattern(dof_handler_ref,
                                      coupling,
                                      csp,
                                      constraints,
                                      false);
      sparsity_pattern.copy_from(csp);
    }

 
*   tangent_matrix.reinit(<Index_Set Required>, <Index_Set_Required>, 
sparsity_pattern,mpi_communicator);*

    
system_rhs.reinit(mpi_communicator,dof_handler_ref.n_dofs(),dof_handler_ref.n_dofs());
    //system_rhs.collect_sizes();

    
solution_n.reinit(mpi_communicator,dof_handler_ref.n_dofs(),dof_handler_ref.n_dofs());
    //solution_n.collect_sizes();

    setup_qph();

    timer.leave_subsection();
  }

Thanks! 

Animesh


On Sunday, January 17, 2021 at 12:03:22 PM UTC-6 Wolfgang Bangerth wrote:

>
> > I would like to use SparseDirectMumps to solve the linear system 
> > <
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdealii%2Fcode-gallery%2Fblob%2Fmaster%2FQuasi_static_Finite_strain_Compressible_Elasticity%2Fcook_membrane.cc%23L2171&data=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C632a418808d74ae65e4e08d8ba51cd69%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637464207804492937%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3quCIk6VKgjyi7Zuln4b7yBND9kqpixCRnmmH830xMA%3D&reserved=0>.
>  
>
> > The documentation tells that I would need an mpi_communicator object to 
> use 
> > this solver. Since my code is running on a single machine in serial 
> (only the 
> > assembly is hyper-threaded), how do I need to initialize 
> mpi_communicator?
>
> Just use MPI_COMM_SELF in all places where you need to pass a communicator.
>
> Best
> W.
>
> -- 
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: bang...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/f54e6e80-a5cc-4315-9e89-dd82ad97a2een%40googlegroups.com.

Reply via email to