]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Corrected the refine_and_coarsen_optimize function, the error behaves like N^{-2...
authorgoll <goll@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 Dec 2011 14:57:17 +0000 (14:57 +0000)
committergoll <goll@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 16 Dec 2011 14:57:17 +0000 (14:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@24834 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/grid_refinement.cc

index 119c70b9f1e9a550e10f0debd55c7b0d117d1e44..4d0dd20bf7ae4d9cdc0997797dd40be885e90ef6 100644 (file)
@@ -528,7 +528,10 @@ GridRefinement::refine_and_coarsen_optimize (Triangulation<dim,spacedim> &tria,
                                   // The first M cells are refined
                                   // to minimize the expected error
                                   // multiplied with the expected
-                                  // number of cells.
+                                  // number of cells to the power of
+                                  // 2 * expected order of the finite
+                                  // element space divided by the dimension
+                                  // of the discretized space.
                                   // We assume that the error is
                                   // decreased by (1-2^(-order)) a_K if the cell
                                   // K with error indicator a_K is
@@ -537,17 +540,17 @@ GridRefinement::refine_and_coarsen_optimize (Triangulation<dim,spacedim> &tria,
                                   // The expected number of cells is
                                   // N+(2^d-1)*M (N is the current number
                                   // of cells)
-  double min = ((std::pow(2.,dim)-1)*(1.+M)+N) * (E-s0);
+  double min =std::pow( ((std::pow(2.,dim)-1)*(1.+M)+N),(double) order/dim) * (E-s0);
 
   unsigned int minArg = N-1;
 
   for (M=1;M<criteria.size();++M)
     {
-      s0 += (1-std::pow(2.,-order)) * criteria(tmp[M]);
+      s0+= (1-std::pow(2.,-order)) * criteria(tmp[M]);
 
-      if ( ((std::pow(2.,dim)-1)*(1+M)+N)*(E-s0) <= min)
+      if ( std::pow(((std::pow(2.,dim)-1)*(1+M)+N), (double) order/dim) * (E-s0) <= min)
        {
-         min = ((std::pow(2.,dim)-1)*(1+M)+N)*(E-s0);
+         min =  std::pow(((std::pow(2.,dim)-1)*(1+M)+N), (double) order/dim) * (E-s0);
          minArg = M;
        }
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.