Hi, all,

If there is no function to compute convergence above, I need to write the 
code by myself.

For Question 1, I write a code to compute the L2 norm of (solution_1 - 
solution_2):

    template <int dim>
  double StokesProblem<dim>::norm_compute (const Vector<double> solu_1,
                                              const Vector<double> solu_2)
  {
    QGauss<dim>   quadrature_formula(degree+2);    
    
    FEValues<dim> fe_values (fe, quadrature_formula,
                             update_values    |
                             update_quadrature_points  |
                             update_JxW_values |
                             update_gradients);                            
  
    const unsigned int   dofs_per_cell   = fe.dofs_per_cell;
    
    const unsigned int   n_q_points      = quadrature_formula.size();
    FullMatrix<double>   local_con_rate_matrix (dofs_per_cell, 
dofs_per_cell);
    std::vector<types::global_dof_index> local_dof_indices (dofs_per_cell); 
    
    std::vector<double> solu_1_values(n_q_points);
    std::vector<double> solu_2_values(n_q_points);
    
    double norm_12 = 0, norm_24 = 1,norm_12_square = 0, norm_24_square = 1, 
rate_124 = 0, con_rate = 0; 
    typename DoFHandler<dim>::active_cell_iterator
    cell = dof_handler.begin_active(),
    endc = dof_handler.end();   
    for (; cell!=endc; ++cell)    
      {
        fe_values.reinit (celli);  
        fe_values.get_function_values (solu_1, solu_1_values);
        fe_values.get_function_values (solu_2, solu_2_values);
        for (unsigned int q=0; q<n_q_points; ++q)
         {
            const double delta_12 = solu_1_values[q] - solu_2_values[q]; 
             
            norm_12_square += ( delta_12 * delta_12 )
                                        * fe_values.JxW(q);                
                       
        }
     }
     norm_12 = std::sqrt(norm_12_square);
     return norm_12;
  } 

Is that right?

For question 2, as the 2 solution vectors have different sizes, we don't 
have the same cells, so the cell loop cannot compute altogether:
typename DoFHandler<dim>::active_cell_iterator
    cell_1 = dof_handler_1.begin_active(),
    endc_1 = dof_handler_1.end(); 
typename DoFHandler<dim>::active_cell_iterator
    cell_2 = dof_handler_2.begin_active();  
    for (; cell_1!=endc_2; ++cell_1, ++cell_2)    
      {....}

I wander how to solve this problem?

Thanks in advance!
Best,
Chucui

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

Reply via email to