Re: [deal.II] Difference between 2 Wasy to Initialize System Matrix in MPI World

2023-09-28 Thread Lex Lee
Hello Timo, 

Thanks for your reply and suggestion. Now, I know what the difference is.

Since  I'm using "make_flux_sparsity_pattern" function and have to input 
the coupling dofs table -- ''cell coupling" + "face coupling". It seems 
that I have no choice but to use "constraints.condense(dsp)" after 
"make_flux_sparsity_pattern" implementation.  

There are 4 template member functions for "make_flux_sparsity_pattern" in 
this 
link: https://www.dealii.org/current/doxygen/deal.II/group__constraints.html
In my opinion, only #3 is suitable for my case.  

Any better idea?


Again, thanks a lot for sharing your ideas with me. 


Best,
Lex
On Thursday, September 28, 2023 at 1:22:49 PM UTC-7 Timo Heister wrote:

> Lex,
>
> I would strongly advice against using AffineConstraints::condense() in an 
> MPI parallel computation. It is inefficient and also likely incorrect if 
> you run it before distribute_sparsity_pattern().
> Instead, use distribute_local_to_global during assembly (see step-40 for 
> an example).
>
> --
> Timo Heister
> http://www.math.clemson.edu/~heister/
> --
> *From:* dea...@googlegroups.com  on behalf of 
> Lex Lee 
> *Sent:* Wednesday, September 27, 2023 8:15:14 PM
> *To:* deal.II User Group 
> *Subject:* [deal.II] Difference between 2 Wasy to Initialize System 
> Matrix in MPI World 
>  
>
> *This Message Is From An External Sender:* Use caution when opening links 
> or attachments if you do not recognize the sender. 
> Hello all, 
>
>
> Previously, I initialized my system matrix in this way (option A) 
>
> DoFTools::make_flux_sparsity_pattern(dof_handler,
> dsp,
> cell_coupling,
> face_coupling);
> constraints_newton_update.condense(dsp);
> SparsityTools::distribute_sparsity_pattern(dsp,
>hp_index_set,
>mpi_communicator,
>hp_relevant_set);
> system_matrix.reinit(hp_index_set,
>  hp_index_set,
>  dsp,
>  mpi_communicator);
>
> However, the generated system matrix is singular. I was stuck by the 
> singular matrix problem for about 2 weeks.
>
>
> Then, I initialized the matrix with option B, which generates a full rank 
> matrix. Although, I don't see the difference between these 2 ways.  Can 
> someone explain this to me? Thans in advance.
>
> DoFTools::make_flux_sparsity_pattern(dof_handler,
>  dsp,
>  cell_coupling,
>  face_coupling);
> constraints_newton_update.condense(dsp);
> sparsity_pattern.copy_from(dsp);
> system_matrix.reinit(hp_index_set,
>  sparsity_pattern,
>  mpi_communicator);
>
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/abecb5ba-e894-47eb-bc0d-1ef5590ba14cn%40googlegroups.com
>  
> 
> .
>

-- 
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/81544eab-000a-4638-9c36-111bb92887c7n%40googlegroups.com.


Re: [deal.II] Difference between 2 Wasy to Initialize System Matrix in MPI World

2023-09-28 Thread Timo Heister
Lex,

I would strongly advice against using AffineConstraints::condense() in an MPI 
parallel computation. It is inefficient and also likely incorrect if you run it 
before distribute_sparsity_pattern().
Instead, use distribute_local_to_global during assembly (see step-40 for an 
example).

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

From: dealii@googlegroups.com  on behalf of Lex Lee 

Sent: Wednesday, September 27, 2023 8:15:14 PM
To: deal.II User Group 
Subject: [deal.II] Difference between 2 Wasy to Initialize System Matrix in MPI 
World


This Message Is From An External Sender: Use caution when opening links or 
attachments if you do not recognize the sender.

Hello all,


Previously, I initialized my system matrix in this way (option A)

DoFTools::make_flux_sparsity_pattern(dof_handler,
dsp,
cell_coupling,
face_coupling);
constraints_newton_update.condense(dsp);
SparsityTools::distribute_sparsity_pattern(dsp,
   hp_index_set,
   mpi_communicator,
   hp_relevant_set);
system_matrix.reinit(hp_index_set,
 hp_index_set,
 dsp,
 mpi_communicator);

However, the generated system matrix is singular. I was stuck by the singular 
matrix problem for about 2 weeks.


Then, I initialized the matrix with option B, which generates a full rank 
matrix. Although, I don't see the difference between these 2 ways.  Can someone 
explain this to me? Thans in advance.

DoFTools::make_flux_sparsity_pattern(dof_handler,
 dsp,
 cell_coupling,
 face_coupling);
constraints_newton_update.condense(dsp);
sparsity_pattern.copy_from(dsp);
system_matrix.reinit(hp_index_set,
 sparsity_pattern,
 mpi_communicator);

--
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/abecb5ba-e894-47eb-bc0d-1ef5590ba14cn%40googlegroups.com.

-- 
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/BN7PR06MB528358C2164AB180FA3660FDA1C1A%40BN7PR06MB5283.namprd06.prod.outlook.com.


[deal.II] Re: Difference between 2 Wasy to Initialize System Matrix in MPI World

2023-09-28 Thread Lex Lee
Hi Abbas, thanks for the reply. I did debug with option A, but no error 
reported/no exception is thrown. To me, option A is the same as option B. 
However, the two generated system matrixs in the code are not the same. 

On Thursday, September 28, 2023 at 10:27:17 AM UTC-7 abbas.b...@gmail.com 
wrote:

> Did you try to run in Debug? If not give it a try and see if an exception 
> is thrown. 
>
> Abbas
>
> On Thursday, September 28, 2023 at 3:15:14 AM UTC+2 hitl...@gmail.com 
> wrote:
>
>> Hello all, 
>>
>>
>> Previously, I initialized my system matrix in this way (option A)
>>
>> DoFTools::make_flux_sparsity_pattern(dof_handler,
>> dsp,
>> cell_coupling,
>> face_coupling);
>> constraints_newton_update.condense(dsp);
>> SparsityTools::distribute_sparsity_pattern(dsp,
>>hp_index_set,
>>mpi_communicator,
>>hp_relevant_set);
>> system_matrix.reinit(hp_index_set,
>>  hp_index_set,
>>  dsp,
>>  mpi_communicator);
>>
>> However, the generated system matrix is singular. I was stuck by the 
>> singular matrix problem for about 2 weeks.
>>
>>
>> Then, I initialized the matrix with option B, which generates a full rank 
>> matrix. Although, I don't see the difference between these 2 ways.  Can 
>> someone explain this to me? Thans in advance.
>>
>> DoFTools::make_flux_sparsity_pattern(dof_handler,
>>  dsp,
>>  cell_coupling,
>>  face_coupling);
>> constraints_newton_update.condense(dsp);
>> sparsity_pattern.copy_from(dsp);
>> system_matrix.reinit(hp_index_set,
>>  sparsity_pattern,
>>  mpi_communicator);
>>
>

-- 
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/fdcd61c9-ca93-4de7-b644-4b396defe09dn%40googlegroups.com.


[deal.II] Re: Difference between 2 Wasy to Initialize System Matrix in MPI World

2023-09-28 Thread Abbas Ballout
Did you try to run in Debug? If not give it a try and see if an exception 
is thrown. 

Abbas

On Thursday, September 28, 2023 at 3:15:14 AM UTC+2 hitl...@gmail.com wrote:

> Hello all, 
>
>
> Previously, I initialized my system matrix in this way (option A)
>
> DoFTools::make_flux_sparsity_pattern(dof_handler,
> dsp,
> cell_coupling,
> face_coupling);
> constraints_newton_update.condense(dsp);
> SparsityTools::distribute_sparsity_pattern(dsp,
>hp_index_set,
>mpi_communicator,
>hp_relevant_set);
> system_matrix.reinit(hp_index_set,
>  hp_index_set,
>  dsp,
>  mpi_communicator);
>
> However, the generated system matrix is singular. I was stuck by the 
> singular matrix problem for about 2 weeks.
>
>
> Then, I initialized the matrix with option B, which generates a full rank 
> matrix. Although, I don't see the difference between these 2 ways.  Can 
> someone explain this to me? Thans in advance.
>
> DoFTools::make_flux_sparsity_pattern(dof_handler,
>  dsp,
>  cell_coupling,
>  face_coupling);
> constraints_newton_update.condense(dsp);
> sparsity_pattern.copy_from(dsp);
> system_matrix.reinit(hp_index_set,
>  sparsity_pattern,
>  mpi_communicator);
>

-- 
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/7bcd69b4-708a-44cf-9d91-32e840ae4ffdn%40googlegroups.com.