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

Reply via email to