[deal.II] Re: About applying periodic boundary condition on the same mesh by different methods

2017-07-05 Thread Daniel Arndt
Chuyi,

i finished it. But i think in the second step 
> ConstraintMatrix::get_constraint_lines() should be 
> (*constraint_entries)[0].first by calling constraint_entries = 
> ConstraintMatrix::get_constraint_entries(* IndexSet::ElementIterator), 
> right? 
>
Yes, you're right ConstraintMatrix::get_constraint_lines()  should have 
been ConstraintMatrix::get_constraint_entries(). Also note that there might 
be more than one constraint entry and that not all the coefficients are 1. 
This in particular happens if you consider adaptive mesh refinement.
Otherwise, I am happy to hear that this worked well for you!

Best,
Daniel

>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: About applying periodic boundary condition on the same mesh by different methods

2017-07-05 Thread Chuyi Duan
Thanks Daniel,

i finished it. But i think in the second step 
ConstraintMatrix::get_constraint_lines() should be 
(*constraint_entries)[0].first by calling constraint_entries = 
ConstraintMatrix::get_constraint_entries(* IndexSet::ElementIterator), 
right? 

Best,
Chuyi

在 2017年6月27日星期二 UTC+2上午12:01:10,Daniel Arndt写道:
>
> Chuyi,
>
> I still have a question about how to apply periodic boundary conditons: Is 
>> there any possibility now to apply PBC with a value 1.0 in x_component and 
>> y_component while -1.0 in z_component? I've read an older version of 
>> step-45 before (like 8.3.0), which showed we could change that when calling 
>> ConstraintMatrix::add_entry, but later this has been removed, and now I 
>> can't find how to do it.
>>
> I guess with PBC in z_component with value -1.0 you mean something similar 
> to u(x,y,0)=-u(x,y,1)?
> Unfortunately, this is a bit complicated as constraints in a 
> ConstraintMatrix can't be changed easily after they have been added.
>
> Using make_periodicity_constraints you get u(x,y,0)=u(x,y,1) and then you 
> would just invert the sign for all the entries in the lines corresponding 
> to the respective DoFs in the ConstraintMatrix.
> For doing so, you can get the interesting DoFs via 
> DoFTools::extract_boundary_dofs() [1] and then request the respective 
> constraints via ConstraintMatrix::get_constraint_lines() [2].
> From these information you would create another ConstraintMatrix (where 
> the line entries have the inverted sign) and merge the other constraints in 
> via ConstraintMatrix::merge() [3] with left_object_wins.
>
> Best,
> Daniel
>
> [1] 
> https://www.dealii.org/8.4.0/doxygen/deal.II/namespaceDoFTools.html#ad3067f335a97de429176178689222f3a
> [2] 
> https://www.dealii.org/8.4.0/doxygen/deal.II/classConstraintMatrix.html#a96b20c2f6162fdde6bafcea825f1cb31
> [3] 
> https://www.dealii.org/8.4.0/doxygen/deal.II/classConstraintMatrix.html#a08b5378ad8b23e5fb86c71a2c66bff13
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: About applying periodic boundary condition on the same mesh by different methods

2017-06-26 Thread Daniel Arndt
Chuyi,

I still have a question about how to apply periodic boundary conditons: Is 
> there any possibility now to apply PBC with a value 1.0 in x_component and 
> y_component while -1.0 in z_component? I've read an older version of 
> step-45 before (like 8.3.0), which showed we could change that when calling 
> ConstraintMatrix::add_entry, but later this has been removed, and now I 
> can't find how to do it.
>
I guess with PBC in z_component with value -1.0 you mean something similar 
to u(x,y,0)=-u(x,y,1)?
Unfortunately, this is a bit complicated as constraints in a 
ConstraintMatrix can't be changed easily after they have been added.

Using make_periodicity_constraints you get u(x,y,0)=u(x,y,1) and then you 
would just invert the sign for all the entries in the lines corresponding 
to the respective DoFs in the ConstraintMatrix.
For doing so, you can get the interesting DoFs via 
DoFTools::extract_boundary_dofs() [1] and then request the respective 
constraints via ConstraintMatrix::get_constraint_lines() [2].
>From these information you would create another ConstraintMatrix (where the 
line entries have the inverted sign) and merge the other constraints in via 
ConstraintMatrix::merge() [3] with left_object_wins.

Best,
Daniel

[1] 
https://www.dealii.org/8.4.0/doxygen/deal.II/namespaceDoFTools.html#ad3067f335a97de429176178689222f3a
[2] 
https://www.dealii.org/8.4.0/doxygen/deal.II/classConstraintMatrix.html#a96b20c2f6162fdde6bafcea825f1cb31
[3] 
https://www.dealii.org/8.4.0/doxygen/deal.II/classConstraintMatrix.html#a08b5378ad8b23e5fb86c71a2c66bff13

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: About applying periodic boundary condition on the same mesh by different methods

2017-06-26 Thread Chuyi Duan
Hi Daniel,

I still have a question about how to apply periodic boundary conditons: Is 
there any possibility now to apply PBC with a value 1.0 in x_component and 
y_component while -1.0 in z_component? I've read an older version of 
step-45 before (like 8.3.0), which showed we could change that when calling 
ConstraintMatrix::add_entry, but later this has been removed, and now I 
can't find how to do it.

Best
Chuyi

在 2017年6月1日星期四 UTC+2下午2:31:58,Daniel Arndt写道:
>
> Chuyi,
>
>
>> i was trying to use Dealii to solve a 3-dimensional elastic-plastic 
>> question on a cubic by applying periodic boundary condition like in step-45 
>> (v. 8.5.0). 
>> std::vector::
>> cell_iterator> > periodicity_vector;
>> GridTools::collect_periodic_faces(dof_handler, 1, 2, 2, 
>> periodicity_vector);//1,2,2: the first two numbers refer to the cell 
>> faces at the boundary, the third number to the direction 
>> DoFTools::make_periodicity_constraints >(
>> periodicity_vector,constraint_matrix);
>>
>> But i got different results as i have created the mesh using 
>> GridGenerator::subdivided_hyper_rectangle (triangulation, rep, p1, p2);//rep 
>> is the repetition
>> method 1 to get the mesh:
>> p1 (0, 0, 0) 
>> p2(1, 1, 1) 
>> rep=(8, 8, 8)
>> no global refinement
>>
>> method 2 to get the mesh:
>> p1 (0, 0, 0) 
>> p2(1, 1, 1) 
>> rep=(1, 1, 1)
>> global refinement = 3
>>
>> I just wonder why there come two different results when these two meshes 
>> are actually the same.
>>
> How do the two solutions actually differ? How many constraints a created 
> in either of these cases?
> Can you provide us with a minimal example just setting up the periodic 
> constraints in case they are different?
>
> Best,
> Daniel
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: About applying periodic boundary condition on the same mesh by different methods

2017-06-13 Thread Chuyi Duan
Hello Daniel,

I think i've found where the problem was. It's because I used 
set_boundary_id with active_cell_iterator after global_refinement. But I 
found in source codes of collect_periodic_faces function it's just 
cell_iterator that has been used. I've instead called set_boundary_id at 
first then global_refinement and it goes well.

Thank you anyway.

Chuyi

在 2017年6月1日星期四 UTC+2下午2:31:58,Daniel Arndt写道:
>
> Chuyi,
>
>
>> i was trying to use Dealii to solve a 3-dimensional elastic-plastic 
>> question on a cubic by applying periodic boundary condition like in step-45 
>> (v. 8.5.0). 
>> std::vector::
>> cell_iterator> > periodicity_vector;
>> GridTools::collect_periodic_faces(dof_handler, 1, 2, 2, 
>> periodicity_vector);//1,2,2: the first two numbers refer to the cell 
>> faces at the boundary, the third number to the direction 
>> DoFTools::make_periodicity_constraints >(
>> periodicity_vector,constraint_matrix);
>>
>> But i got different results as i have created the mesh using 
>> GridGenerator::subdivided_hyper_rectangle (triangulation, rep, p1, p2);//rep 
>> is the repetition
>> method 1 to get the mesh:
>> p1 (0, 0, 0) 
>> p2(1, 1, 1) 
>> rep=(8, 8, 8)
>> no global refinement
>>
>> method 2 to get the mesh:
>> p1 (0, 0, 0) 
>> p2(1, 1, 1) 
>> rep=(1, 1, 1)
>> global refinement = 3
>>
>> I just wonder why there come two different results when these two meshes 
>> are actually the same.
>>
> How do the two solutions actually differ? How many constraints a created 
> in either of these cases?
> Can you provide us with a minimal example just setting up the periodic 
> constraints in case they are different?
>
> Best,
> Daniel
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: About applying periodic boundary condition on the same mesh by different methods

2017-06-01 Thread Daniel Arndt
Chuyi,


> i was trying to use Dealii to solve a 3-dimensional elastic-plastic 
> question on a cubic by applying periodic boundary condition like in step-45 
> (v. 8.5.0). 
> std::vector::
> cell_iterator> > periodicity_vector;
> GridTools::collect_periodic_faces(dof_handler, 1, 2, 2, periodicity_vector
> );//1,2,2: the first two numbers refer to the cell faces at the boundary, 
> the third number to the direction 
> DoFTools::make_periodicity_constraints >(
> periodicity_vector,constraint_matrix);
>
> But i got different results as i have created the mesh using 
> GridGenerator::subdivided_hyper_rectangle (triangulation, rep, p1, p2);//rep 
> is the repetition
> method 1 to get the mesh:
> p1 (0, 0, 0) 
> p2(1, 1, 1) 
> rep=(8, 8, 8)
> no global refinement
>
> method 2 to get the mesh:
> p1 (0, 0, 0) 
> p2(1, 1, 1) 
> rep=(1, 1, 1)
> global refinement = 3
>
> I just wonder why there come two different results when these two meshes 
> are actually the same.
>
How do the two solutions actually differ? How many constraints a created in 
either of these cases?
Can you provide us with a minimal example just setting up the periodic 
constraints in case they are different?

Best,
Daniel

-- 
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.
For more options, visit https://groups.google.com/d/optout.