[deal.II] Re: Relation between Solution Error Behavior and Polynomial Approximation Degree

2017-11-28 Thread seven
I see. 

Thanks,
Jiaqi

在 2017年11月27日星期一 UTC-5下午6:31:54,Jaekwang Kim写道:
>
> No, I typically, calculate values itself and use MATLAB to draw plots. 
>
> Thanks,
>
> Jaekwang 
>
> On Monday, November 27, 2017 at 3:24:46 PM UTC-6, seven wrote:
>>
>> Hello Jaekwang,
>>
>> I am trying to generate some log-log plots, and wondering if you used the 
>> functions in deal.ii to generate the figure. If not, what did you use?
>>
>> Thanks,
>> Jiaqi
>>
>> 在 2016年9月29日星期四 UTC-4上午11:41:48,Jaekwang Kim写道:
>>>
>>>
>>> <https://lh3.googleusercontent.com/-dkfwJvgPEmc/V-00Y-c4tzI/A5s/pb0Z-IBRe-An_S39dSDzxWg1k5GJlEbKQCLcB/s1600/step7plotting.jpg>
>>>
>>> Hi all, I have question on error behavior of FEM. 
>>>
>>> I thought that the order of error is O(h^p) where h is a mesh-size and p 
>>> is polynomial degree we use in approximation. 
>>>
>>> So, I thought that if I plot an error with number of mesh in log-log 
>>> scale, than the graph will show -p slope. 
>>> However, I the error behaves little bit different from my expectation.
>>>
>>> For example, I use a step7 tutorial program (which solves Helmholtz 
>>> decomposition and compares the FEM solution with exact solution.) 
>>>
>>> The error curve showed more steep slope whenever I increase polynomial 
>>> degree approximation however, the slope is not (-p). 
>>> I reached slope (-3) when I used fifth-degree polynomial 
>>> approximation...   
>>> You can check this behavior in attached picture. 
>>>
>>> Until now, I have considered, 
>>>
>>> 1. Mapping(From reference cell to real cell) degree (which is originally 
>>> set to 1 but I used higher mapping) 
>>> 2. Instead of Qgauss quadrature, I am using QgaussLobatto Quadrature for 
>>> any integration over cells. 
>>> 3. Shape function , again I tried to use QgaussLobatto node point for 
>>> this) 
>>>
>>> is there any suggestion that I need to fix more? 
>>> or my first prediction that the slope will show '-p' or error will just 
>>> behave O(h^p) was wrong?
>>>
>>> I am always thank you for all guys!
>>>
>>> Jaekwang Kim  
>>>
>>

-- 
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: Relation between Solution Error Behavior and Polynomial Approximation Degree

2017-11-27 Thread seven
Hello Jaekwang,

I am trying to generate some log-log plots, and wondering if you used the 
functions in deal.ii to generate the figure. If not, what did you use?

Thanks,
Jiaqi

在 2016年9月29日星期四 UTC-4上午11:41:48,Jaekwang Kim写道:
>
>
> 
>
> Hi all, I have question on error behavior of FEM. 
>
> I thought that the order of error is O(h^p) where h is a mesh-size and p 
> is polynomial degree we use in approximation. 
>
> So, I thought that if I plot an error with number of mesh in log-log 
> scale, than the graph will show -p slope. 
> However, I the error behaves little bit different from my expectation.
>
> For example, I use a step7 tutorial program (which solves Helmholtz 
> decomposition and compares the FEM solution with exact solution.) 
>
> The error curve showed more steep slope whenever I increase polynomial 
> degree approximation however, the slope is not (-p). 
> I reached slope (-3) when I used fifth-degree polynomial approximation... 
>   
> You can check this behavior in attached picture. 
>
> Until now, I have considered, 
>
> 1. Mapping(From reference cell to real cell) degree (which is originally 
> set to 1 but I used higher mapping) 
> 2. Instead of Qgauss quadrature, I am using QgaussLobatto Quadrature for 
> any integration over cells. 
> 3. Shape function , again I tried to use QgaussLobatto node point for 
> this) 
>
> is there any suggestion that I need to fix more? 
> or my first prediction that the slope will show '-p' or error will just 
> behave O(h^p) was wrong?
>
> I am always thank you for all guys!
>
> Jaekwang Kim  
>

-- 
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: Vertices constraints inside the domain

2017-03-23 Thread seven
Guess I figured it out. I didn't do 
constraints.distribute();


在 2017年3月23日星期四 UTC-4上午1:38:32,seven写道:
>
>
> Hello all,
>
> I am trying to project a solution in FE_DGP(sol_dg) to FE_Q (sol_cg), but 
> I only know the gradients of sol_dg and its values at some vertices, so I 
> want to fix values of sol_cg at the same vertices after the projection.
>
> The first method I tried is quite straightforward, but the resulting 
> global matirx is very ill-conditioned. I set the corresponding row to zero 
> except the diagonal entry, and then change the right hand size.
>
> for( ; cell_c!= endc;++cell_dg, ++cell_c ){
> const unit active_index = cell_dg->active_cell_index();
> if(interface_flag[active_index] == 1){
> fe_values_continuous.reinit(cell_c);
> fe_values_v_dg.reinit(cell_dg);
> fe_values_v_dg.get_function_values(solution, solu_dg);
> cell_c->get_dof_indices(local_dof_indices_c);
> for(unit vert=0; vert<4; ++vert){
> // local_dof_indices_c[vert] global index
> const unit index_i = local_dof_indices_c[vert];
> ls_rhs_continuous(index_i) = solu_dg[vert]* aver_diag;
> for(unit i=0; i<size_m; ++i)
> ls_matrix_continuous.set(local_dof_indices_c[vert], i, 0.);
> ls_matrix_continuous.set(index_i, index_i, aver_diag);
> }
> }
>
> } 
> so I want to use constraint matrix to do the same thing, but cannot get 
> the right answer. 
>
> for( ; cell_c!= endc;++cell_dg, ++cell_c ){
> const unit active_index = cell_dg->active_cell_index();
> if(interface_flag[active_index] == 1){
> fe_values_continuous.reinit(cell_c);
> fe_values_v_dg.reinit(cell_dg);
> fe_values_v_dg.get_function_values(solution, solu_dg);
> cell_c->get_dof_indices(local_dof_indices_c);
> for(unit vert=0; vert<4; ++vert){
> // local_dof_indices_c[vert] global index
> const unit index_i = local_dof_indices_c[vert];
> constraints.add_line(index_i);
> constraints.set_inhomogeneity(index_i, solu_dg[vert]);
> }
> }
> }
> constraints.close();
>
> cell_c = dof_handler_continuous.begin_active();
> cell_dg = dof_handler.begin_active();
> for( ; cell_c!=endc; ++cell_c, ++cell_dg){
> fe_values_dg.reinit(cell_dg);
> fe_values_dg.get_function_gradients(solution, grad_dg);
>
> ls_matrix = 0;
> ls_rhs = 0;
> fe_values_continuous.reinit(cell_c);
>
> for(unit q=0; q<n_q_points; ++q){
> for(unit i=0; i<dofs_per_cell_continuous; ++i){
> ls_rhs(i) += fe_values_continuous.shape_grad(i,q)
>   * fe_values_continuous.JxW(q)
>   * grad_dg[q];
> for(unit j=0; j<dofs_per_cell_continuous; ++j)
> ls_matrix(i,j) += fe_values_continuous.shape_grad(i,q)
>* fe_values_continuous.shape_grad(j,q)
>* fe_values_continuous.JxW(q);
> }
> }
> cell_c->get_dof_indices(local_dof_indices_c);
> constraints.distribute_local_to_global (ls_matrix, ls_rhs,
> local_dof_indices_c,
> ls_matrix_continuous, 
> ls_rhs_continuous);
>
> Any help would be appreciated
>
> Thanks,
> Jiaqi 
>

-- 
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] Vertices constraints inside the domain

2017-03-22 Thread seven

Hello all,

I am trying to project a solution in FE_DGP(sol_dg) to FE_Q (sol_cg), but I 
only know the gradients of sol_dg and its values at some vertices, so I 
want to fix values of sol_cg at the same vertices after the projection.

The first method I tried is quite straightforward, but the resulting global 
matirx is very ill-conditioned. I set the corresponding row to zero except 
the diagonal entry, and then change the right hand size.

for( ; cell_c!= endc;++cell_dg, ++cell_c ){
const unit active_index = cell_dg->active_cell_index();
if(interface_flag[active_index] == 1){
fe_values_continuous.reinit(cell_c);
fe_values_v_dg.reinit(cell_dg);
fe_values_v_dg.get_function_values(solution, solu_dg);
cell_c->get_dof_indices(local_dof_indices_c);
for(unit vert=0; vert<4; ++vert){
// local_dof_indices_c[vert] global index
const unit index_i = local_dof_indices_c[vert];
ls_rhs_continuous(index_i) = solu_dg[vert]* aver_diag;
for(unit i=0; iactive_cell_index();
if(interface_flag[active_index] == 1){
fe_values_continuous.reinit(cell_c);
fe_values_v_dg.reinit(cell_dg);
fe_values_v_dg.get_function_values(solution, solu_dg);
cell_c->get_dof_indices(local_dof_indices_c);
for(unit vert=0; vert<4; ++vert){
// local_dof_indices_c[vert] global index
const unit index_i = local_dof_indices_c[vert];
constraints.add_line(index_i);
constraints.set_inhomogeneity(index_i, solu_dg[vert]);
}
}
}
constraints.close();

cell_c = dof_handler_continuous.begin_active();
cell_dg = dof_handler.begin_active();
for( ; cell_c!=endc; ++cell_c, ++cell_dg){
fe_values_dg.reinit(cell_dg);
fe_values_dg.get_function_gradients(solution, grad_dg);

ls_matrix = 0;
ls_rhs = 0;
fe_values_continuous.reinit(cell_c);

for(unit q=0; qget_dof_indices(local_dof_indices_c);
constraints.distribute_local_to_global (ls_matrix, ls_rhs,
local_dof_indices_c,
ls_matrix_continuous, 
ls_rhs_continuous);

Any help would be appreciated

Thanks,
Jiaqi 

-- 
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.