Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-25 Thread Wolfgang Bangerth

On 1/24/21 5:25 PM, Animesh Rastogi IIT Gandhinagar wrote:


Thank you for your reply. I was able to setup the slepc eigenvalue solver. The 
issue is that it is taking a lot of time to calculate the smallest eigenvalue 
for just 1 degrees of freedom. Largest eigenvalue is calculated pretty 
fast. I tried many solvers in slepc - Krylov Schur, JD, Arnoldi iteration, 
Lanczos etc. However, I am facing the same issue. Also, the KrylovSchur solver 
is giving me following error after taking a lot of time - /The number of 
converged eigenvectors is 0 but 1 were requested. /Could you please help me 
with this. I also tried to do shift-invert operation (wondering if that would 
help) and got the following error


Animesh,
I don't know the eigenvalue solvers well enough to help. But step-36 solves 
for the smallest eigenvalues. You might want to compare what you have against 
step-36 and understand why that program works and yours doesn't.


Best
 W.

--

Wolfgang Bangerth  email: bange...@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/9fcc652f-904d-ee7f-02f5-553c5a39b946%40colostate.edu.


Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-24 Thread Animesh Rastogi IIT Gandhinagar
Dear Prof. Bangerth,

Thank you for your reply. I was able to setup the slepc eigenvalue solver. 
The issue is that it is taking a lot of time to calculate the smallest 
eigenvalue for just 1 degrees of freedom. Largest eigenvalue is 
calculated pretty fast. I tried many solvers in slepc - Krylov Schur, JD, 
Arnoldi iteration, Lanczos etc. However, I am facing the same issue. Also, 
the KrylovSchur solver is giving me following error after taking a lot of 
time - *The number of converged eigenvectors is 0 but 1 were requested. *Could 
you please help me with this. I also tried to do shift-invert operation 
(wondering if that would help) and got the following error - 

[0]PETSC ERROR: - Error Message 
--
[0]PETSC ERROR: Shift-and-invert requires a target 'which' (see 
EPSSetWhichEigenpairs), for instance -st_type sinvert -eps_target 0 
-eps_target_magnitude
[0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html 
for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.13.1, May 02, 2020 
[0]PETSC ERROR: ./cook_membrane on a arch-linux-c-debug named 
animesh-Inspiron-7572 by animesh Sun Jan 24 18:14:28 2021
[0]PETSC ERROR: Configure options --download-mumps --download-scalapack 
--download-ptscotch=0 --with-shared-libraries
[0]PETSC ERROR: #1 EPSCheckCompatibleST() line 112 in 
/home/animesh/Documents/slepc-3.13.4/src/eps/interface/epssetup.c
[0]PETSC ERROR: #2 EPSSetUp() line 303 in 
/home/animesh/Documents/slepc-3.13.4/src/eps/interface/epssetup.c
[0]PETSC ERROR: #3 EPSSolve() line 136 in 
/home/animesh/Documents/slepc-3.13.4/src/eps/interface/epssolve.c




Code snippet - 

  std::cout<<"Calculating the smallest eigenvalue at  
"< On 1/18/21 1:29 PM, Animesh Rastogi IIT Gandhinagar wrote:
> > 
> > How should I initialize the "index set" that is required for this 
> function? In 
> > step-17 
> > <
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2Fstep_17.html=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C2c8127fe83f34bdd8e4308d8bbefc22d%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637465985723412724%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000=wri%2BF49jx4BqWdoLNTpAT3ZrLf%2FNj69MqkKbc%2FtkUsg%3D=0>,
>  
>
> > 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.
>
> If you have only one processor, then the locally_owned_dofs are simply all 
> DoFs. You can use the same function you use to get the locally_owned_dofs 
> set 
> on every processor in the parallel context, but an easier way is to call
> complete_index_set(dof_handler.n_dofs())
>
> 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/d6b1aa0c-e432-4ee8-902e-8f5cd1c00df8n%40googlegroups.com.


Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-18 Thread Wolfgang Bangerth

On 1/18/21 1:29 PM, Animesh Rastogi IIT Gandhinagar wrote:


How should I initialize the "index set" that is required for this function? In 
step-17 
, 
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.


If you have only one processor, then the locally_owned_dofs are simply all 
DoFs. You can use the same function you use to get the locally_owned_dofs set 
on every processor in the parallel context, but an easier way is to call

  complete_index_set(dof_handler.n_dofs())

Best
 W.


--

Wolfgang Bangerth  email: bange...@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/7b9541a3-e5f9-a7e9-8c62-702eec42c6f3%40colostate.edu.


Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-18 Thread Animesh Rastogi IIT Gandhinagar
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. 


How should I initialize the "index set" that is required for this function? 
In step-17 , 
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 
  void Solid::system_setup()
  {
timer.enter_subsection("Setup system");

//std::vector 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(, , 
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=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C632a418808d74ae65e4e08d8ba51cd69%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637464207804492937%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000=3quCIk6VKgjyi7Zuln4b7yBND9kqpixCRnmmH830xMA%3D=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.


Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-17 Thread Wolfgang Bangerth



I would like to use SparseDirectMumps to solve the linear system 
. 
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: bange...@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/fc01dc0f-c6b5-6924-38ae-ef7f0332c803%40colostate.edu.


Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-16 Thread Animesh Rastogi IIT Gandhinagar
Dear Prof. Bangerth,

Thank you for your explanation. I have converted matrices and vectors into 
non-blocked objects and have changed them into PETScWrappers::MPI data 
types.

I would like to use SparseDirectMumps to solve the linear system 
.
 
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? Do I need to pass this mpi_communicator object when I 
setup the sparsity pattern, tangent matrix etc in the system_setup() 
function. I could not understand what other changes do I need to bring in 
my code so that I can use SparseDirectMumps solver. Ultimately, my plan is 
to use the SLEPc eigenvalue solver after the solution convergences at every 
load/displacement step.

Thanks a lot!

Animesh

On Friday, January 15, 2021 at 10:53:17 PM UTC-6 Wolfgang Bangerth wrote:

>
> > Thank you for your reply. I tried as you suggested. However, I am 
> getting the 
> > following error -
> > 
> > 
> /home/animesh/Documents/dealii/dealii-9.2.0/examples/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.cc:873:20:
>  
>
> > error: ‘BlockSparseMatrix’ in namespace ‘dealii::PETScWrappers’ does not 
> name 
> > a type
> >  PETScWrappers::BlockSparseMatrix tangent_matrix;
>
> I now remember that we removed the non-MPI class at some point.
>
>
> > So I used as suggested in the documentation and am getting the following 
> error 
> > related to that.
> > 
> > 
> /home/animesh/Documents/dealii/dealii-9.2.0/examples/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.cc:1288:37:
>  
>
> > error: no matching function for call to 
> > ‘dealii::PETScWrappers::MPI::BlockVector::reinit(std::vector int>&)’
> >  system_rhs.reinit(dofs_per_block);
>
> Look up the documentation of that class and what arguments the reinit() 
> and 
> constructor functions take:
>
> https://www.dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1MPI_1_1BlockVector.html
>
>
> > Also, I wish to use a Direct solver by PETSc and could not find any 
> related to 
> > the PETSc block vector. In my current code, I am using 
> SparseDirectUMFPACK. Do 
> > I need to convert my entire code to be using non-blocked vectors and 
> matrices 
> > to use the Direct Solver by PETSc? (Although the system is "blocked", it 
> only 
> > has one block that contains the displacement degree of freedom).
>
> Correct. PETSc does not know the concept of "block" vectors and matrices. 
> So 
> if you want to use a direct solver via PETSc, then you have to put 
> everything 
> into non-blocked objects.
>
> The point of blocks is to facilitate block-based solvers such as Schur 
> complements etc. If you don't intend to build solvers this way, there is 
> no 
> benefit to using block matrices and vectors. Just because you have 
> multiple 
> solution components doesn't mean that you *have* to split your linear 
> algebra 
> objects into blocks.
>
> 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/49df65b6-2bfd-4e92-89d0-b72f2231f233n%40googlegroups.com.


Re: [deal.II] Finite Strain Compressibility problem with PETSc Data Structures

2021-01-15 Thread Wolfgang Bangerth



Thank you for your reply. I tried as you suggested. However, I am getting the 
following error -


/home/animesh/Documents/dealii/dealii-9.2.0/examples/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.cc:873:20: 
error: ‘BlockSparseMatrix’ in namespace ‘dealii::PETScWrappers’ does not name 
a type

  PETScWrappers::BlockSparseMatrix tangent_matrix;


I now remember that we removed the non-MPI class at some point.


So I used as suggested in the documentation and am getting the following error 
related to that.


/home/animesh/Documents/dealii/dealii-9.2.0/examples/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.cc:1288:37: 
error: no matching function for call to 
‘dealii::PETScWrappers::MPI::BlockVector::reinit(std::vector&)’

  system_rhs.reinit(dofs_per_block);


Look up the documentation of that class and what arguments the reinit() and 
constructor functions take:

https://www.dealii.org/current/doxygen/deal.II/classPETScWrappers_1_1MPI_1_1BlockVector.html


Also, I wish to use a Direct solver by PETSc and could not find any related to 
the PETSc block vector. In my current code, I am using SparseDirectUMFPACK. Do 
I need to convert my entire code to be using non-blocked vectors and matrices 
to use the Direct Solver by PETSc? (Although the system is "blocked", it only 
has one block that contains the displacement degree of freedom).


Correct. PETSc does not know the concept of "block" vectors and matrices. So 
if you want to use a direct solver via PETSc, then you have to put everything 
into non-blocked objects.


The point of blocks is to facilitate block-based solvers such as Schur 
complements etc. If you don't intend to build solvers this way, there is no 
benefit to using block matrices and vectors. Just because you have multiple 
solution components doesn't mean that you *have* to split your linear algebra 
objects into blocks.


Best
 W.

--

Wolfgang Bangerth  email: bange...@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/27f0df5f-c586-6ff7-0d08-73e1f3cef5f7%40colostate.edu.