Re: [deal.II] Periodic BC in parallel distributed homogenization problem

2020-10-23 Thread 'maurice rohracker' via deal.II User Group
Dear Daniel,

Thanks for your reply. 

We are having some offsets at the periodic boundary and therefore set it by 
ourself.

Adding the periodicity with 
`triangulation.add_periodicity(periodicFacePairVector)` before distributing 
the dofs as in step-45 helped.

We are using DoFTools::make_periodicity_constraints() later on and merge a 
new constraint into the existing one.

Best,
Maurice

d.arnd...@gmail.com schrieb am Mittwoch, 21. Oktober 2020 um 18:04:57 UTC+2:

> Maurice,
>
> Is there any reason that you don't use 
> DoFTools::make_periodicity_constraints() as shown in 
> https://www.dealii.org/current/doxygen/deal.II/step_45.html?
>
> Best,
> Daniel
>
> Am Mi., 21. Okt. 2020 um 11:16 Uhr schrieb 'maurice rohracker' via deal.II 
> User Group :
>
>> Dear all,
>>
>>
>> For a project, I try to implement a parallel distributed homogenization 
>> problem with periodic BC. A serial version is already implemented.
>>
>> The feature of the periodic BC in the serial case is that it is not 
>> purely periodic, but periodic with some offset.
>>
>>
>> Therefore the periodic boundary pairs are collected 
>> (`dealii::GridTools::collect_periodic_faces*(*
>>
>>  doFHandler, ...)`) and after that stored together with the DOF indices 
>> to handle the periodic BC by oneself afterwards.
>>
>>
>> For the parallel implementation, I go through the following steps:
>>
>>1. gather periodic face pairs for all directions using 
>>`dealii::GridTools::collect_periodic_faces(triangulation, ..., 
>>periodic_vector)`
>>2. add periodicity by `triangulation.add_periodicity(periodic_vector)`
>>3. collect periodic boundary pairs using 
>>`dealii::GridTools::collect_periodic_faces*(*
>>4.  doFHandler, ..., periodic_vector2)`
>>5. store the pairs with the DOFs by looping over the 
>>`periodic_vector2`
>>
>>
>>- to access the DOFs I tried the following
>>
>> `*for **(**const auto * :
>>
>>  periodic*_vector2)*
>>
>> *{*
>>
>>  (...)
>>
>>
>>  // loop over the DOFs of the boundary periodic pair cells
>>
>>  *if **(*facePair.cell*[*0*]*->is_locally_owned*() *&& facePair.cell*[*1
>> *]*->is_locally_owned*())*
>>
>> * {*
>>
>>  facePair.cell*[*0*]*->get_dof_indices*(*localDOFIndicesPlus*)*;
>>
>>  facePair.cell*[*1*]*->get_dof_indices*(*localDOFIndicesMinus*)*;
>>
>>  *}*
>>
>>  *else if **(*facePair.cell*[*0*]*->is_locally_owned*())*
>>
>> * {*
>>
>>  facePair.cell*[*0*]*->get_dof_indices*(*localDOFIndicesPlus*)*;
>>
>>  *(*facePair.cell*[*0*]*->periodic_neighbor*(*facePair.face_idx*[*0*]))*
>> ->get_dof_indices*(*localDOFIndicesMinus*)*;
>>
>>  *}*
>>
>>  *else if **(*facePair.cell*[*1*]*->is_locally_owned*())*
>>
>> * {*
>>
>> * (*facePair.cell*[*1*]*->periodic_neighbor*(*facePair.face_idx*[*1*]))*
>> ->get_dof_indices*(*localDOFIndicesPlus*)*;
>>
>>  facePair.cell*[*1*]*->get_dof_indices*(*localDOFIndicesMinus*)*;
>>
>>  *}*
>>
>>
>> (...) // store plus and minus point of the boundary together with dof if 
>> the periodicity of plus and minus point is fulfilled
>>
>> }`
>>
>>
>> Unfortunately, the resulting localDOFIndicesPlus/Minus of type 
>> `std::vector*<*dealii::types::global_dof_index*> *localDOFIndicesPlus*(*
>>
>>  nDOFsPerCell*)*;` only contain garbage values (very high numbers).
>>
>>
>> My first question would be, is it possible to access the DOF indices of 
>> ghost cells, as I did?
>>
>> Is our procedure enough to ensure that the periodic boundary cells of a 
>> triangulation owned by one processor are ghost cells of the corresponding 
>> triangulation owned by another processor?
>>
>>
>> Thanks in advance for your help. If there are any unclarities in my 
>> explanation, feel free to ask.
>>
>>
>> Best, Maurice
>>
>> -- 
>> 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/ce15100c-7daa-410b-bc91-6cd0288c9c3an%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/b8b9d32f-13e7-4275-b461-0d5b93ff1008n%40googlegroups.com.


Re: [deal.II] Periodic BC in parallel distributed homogenization problem

2020-10-21 Thread Daniel Arndt
Maurice,

Is there any reason that you don't use
DoFTools::make_periodicity_constraints() as shown in
https://www.dealii.org/current/doxygen/deal.II/step_45.html?

Best,
Daniel

Am Mi., 21. Okt. 2020 um 11:16 Uhr schrieb 'maurice rohracker' via deal.II
User Group :

> Dear all,
>
>
> For a project, I try to implement a parallel distributed homogenization
> problem with periodic BC. A serial version is already implemented.
>
> The feature of the periodic BC in the serial case is that it is not purely
> periodic, but periodic with some offset.
>
>
> Therefore the periodic boundary pairs are collected
> (`dealii::GridTools::collect_periodic_faces*(*
>
>  doFHandler, ...)`) and after that stored together with the DOF indices
> to handle the periodic BC by oneself afterwards.
>
>
> For the parallel implementation, I go through the following steps:
>
>1. gather periodic face pairs for all directions using
>`dealii::GridTools::collect_periodic_faces(triangulation, ...,
>periodic_vector)`
>2. add periodicity by `triangulation.add_periodicity(periodic_vector)`
>3. collect periodic boundary pairs using
>`dealii::GridTools::collect_periodic_faces*(*
>4.  doFHandler, ..., periodic_vector2)`
>5. store the pairs with the DOFs by looping over the `periodic_vector2`
>
>
>- to access the DOFs I tried the following
>
> `*for **(**const auto * :
>
>  periodic*_vector2)*
>
> *{*
>
>  (...)
>
>
>  // loop over the DOFs of the boundary periodic pair cells
>
>  *if **(*facePair.cell*[*0*]*->is_locally_owned*() *&& facePair.cell*[*1
> *]*->is_locally_owned*())*
>
> * {*
>
>  facePair.cell*[*0*]*->get_dof_indices*(*localDOFIndicesPlus*)*;
>
>  facePair.cell*[*1*]*->get_dof_indices*(*localDOFIndicesMinus*)*;
>
>  *}*
>
>  *else if **(*facePair.cell*[*0*]*->is_locally_owned*())*
>
> * {*
>
>  facePair.cell*[*0*]*->get_dof_indices*(*localDOFIndicesPlus*)*;
>
>  *(*facePair.cell*[*0*]*->periodic_neighbor*(*facePair.face_idx*[*0*]))*
> ->get_dof_indices*(*localDOFIndicesMinus*)*;
>
>  *}*
>
>  *else if **(*facePair.cell*[*1*]*->is_locally_owned*())*
>
> * {*
>
> * (*facePair.cell*[*1*]*->periodic_neighbor*(*facePair.face_idx*[*1*]))*
> ->get_dof_indices*(*localDOFIndicesPlus*)*;
>
>  facePair.cell*[*1*]*->get_dof_indices*(*localDOFIndicesMinus*)*;
>
>  *}*
>
>
> (...) // store plus and minus point of the boundary together with dof if
> the periodicity of plus and minus point is fulfilled
>
> }`
>
>
> Unfortunately, the resulting localDOFIndicesPlus/Minus of type `std::vector
> *<*dealii::types::global_dof_index*> *localDOFIndicesPlus*(*
>
>  nDOFsPerCell*)*;` only contain garbage values (very high numbers).
>
>
> My first question would be, is it possible to access the DOF indices of
> ghost cells, as I did?
>
> Is our procedure enough to ensure that the periodic boundary cells of a
> triangulation owned by one processor are ghost cells of the corresponding
> triangulation owned by another processor?
>
>
> Thanks in advance for your help. If there are any unclarities in my
> explanation, feel free to ask.
>
>
> Best, Maurice
>
> --
> 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/ce15100c-7daa-410b-bc91-6cd0288c9c3an%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/CAOYDWbLXwnPXVYx0ceacBfsOuXE%2BPsd%3Dv9EUV1Yzo6T8-p%3DGfw%40mail.gmail.com.


[deal.II] Periodic BC in parallel distributed homogenization problem

2020-10-21 Thread 'maurice rohracker' via deal.II User Group


Dear all,


For a project, I try to implement a parallel distributed homogenization 
problem with periodic BC. A serial version is already implemented.

The feature of the periodic BC in the serial case is that it is not purely 
periodic, but periodic with some offset.


Therefore the periodic boundary pairs are collected 
(`dealii::GridTools::collect_periodic_faces*(*

 doFHandler, ...)`) and after that stored together with the DOF indices to 
handle the periodic BC by oneself afterwards.


For the parallel implementation, I go through the following steps:

   1. gather periodic face pairs for all directions using 
   `dealii::GridTools::collect_periodic_faces(triangulation, ..., 
   periodic_vector)`
   2. add periodicity by `triangulation.add_periodicity(periodic_vector)`
   3. collect periodic boundary pairs using 
   `dealii::GridTools::collect_periodic_faces*(*
   4.  doFHandler, ..., periodic_vector2)`
   5. store the pairs with the DOFs by looping over the `periodic_vector2`


   - to access the DOFs I tried the following
   
`*for **(**const auto * :

 periodic*_vector2)*

*{*

 (...)


 // loop over the DOFs of the boundary periodic pair cells

 *if **(*facePair.cell*[*0*]*->is_locally_owned*() *&& facePair.cell*[*1*]*
->is_locally_owned*())*

* {*

 facePair.cell*[*0*]*->get_dof_indices*(*localDOFIndicesPlus*)*;

 facePair.cell*[*1*]*->get_dof_indices*(*localDOFIndicesMinus*)*;

 *}*

 *else if **(*facePair.cell*[*0*]*->is_locally_owned*())*

* {*

 facePair.cell*[*0*]*->get_dof_indices*(*localDOFIndicesPlus*)*;

 *(*facePair.cell*[*0*]*->periodic_neighbor*(*facePair.face_idx*[*0*]))*
->get_dof_indices*(*localDOFIndicesMinus*)*;

 *}*

 *else if **(*facePair.cell*[*1*]*->is_locally_owned*())*

* {*

* (*facePair.cell*[*1*]*->periodic_neighbor*(*facePair.face_idx*[*1*]))*
->get_dof_indices*(*localDOFIndicesPlus*)*;

 facePair.cell*[*1*]*->get_dof_indices*(*localDOFIndicesMinus*)*;

 *}*


(...) // store plus and minus point of the boundary together with dof if 
the periodicity of plus and minus point is fulfilled

}`


Unfortunately, the resulting localDOFIndicesPlus/Minus of type `std::vector
*<*dealii::types::global_dof_index*> *localDOFIndicesPlus*(*

 nDOFsPerCell*)*;` only contain garbage values (very high numbers).


My first question would be, is it possible to access the DOF indices of 
ghost cells, as I did?

Is our procedure enough to ensure that the periodic boundary cells of a 
triangulation owned by one processor are ghost cells of the corresponding 
triangulation owned by another processor?


Thanks in advance for your help. If there are any unclarities in my 
explanation, feel free to ask.


Best, Maurice

-- 
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/ce15100c-7daa-410b-bc91-6cd0288c9c3an%40googlegroups.com.