Kyusik,
Am Donnerstag, 3. November 2016 10:51:20 UTC+1 schrieb hank...@gmail.com: > > Hi all, > > I'm trying to calculate absolute values of (exact_solution - > numeric_solution) and visualize it using Visit. > > So, I added the following in my code. > > error = solution; > error -= exact_solution; > > for(unsigned it i=0;i<error.size(),++i) > error(i)=std::fabs(error(i)); > > ... > data_out.add_data_vector(solution,"solution"); > data_out.add_data_vector(exact_solution,"exact_solution"); > data_out.add_data_vector(error,"error"); > Yes, this gives you a representation of the discretization error. And, I also calculated the {l2_norm of (exact_solution - numeric_solution) > / sqrt(#cells)} (I divided l2norm by sqrt(#cell) Because I want to know > kind of average value of difference between two solution.) > > i.e. I want to calculate sqrt{sum_i(exact_sol_i - sol_i)^2 / (#cell)} (I > think it is kind of average value of difference between two solutions) > What do you mean by "average value" here? You probably just wnat to compute the error in the L2-norm, isn't it? > So, I added the following in my code.... > > Vector<float> difference_per_cell (triangulation.n_active_cells()); > VectorTools::integrate_difference(dof_handler, > solution, > ExactSolution<dim>(), > difference_per_cell, > QGauss<dim>(2), > > VectorTools::L2_norm); > const double L2_error = difference_per_cell.l2_norm(); > > std::cout<<"l2norm(error)="<<L2_error/triangulation.n_active_cells()<<std::endl; > > So, l2_norm(error) is 1.14461e-09 > > But the almost all values in the plot of error(Error_fe1.png) are about > 10^-4 that is 10^5 times higher than l2norm. > If the error is O(1.e-4) you expect the L^2 error to be approximately \sqrt{\int_\Omega 1.e-8} = |\Omega|^{1/2} 1.e-4. Assuming |\Omega|~1, this would suggest that you use approximately 1.e-4/1.e-9=1.e5 cells. What I want to say: Consider just the L2-norm! Due to |\Omega|~1, this should give you an error in the magnitude of what you are observing in the plot. 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.