]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Example refinement.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 May 1998 18:07:49 +0000 (18:07 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 11 May 1998 18:07:49 +0000 (18:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@279 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/Attic/examples/error-estimation/Makefile
deal.II/deal.II/Attic/examples/error-estimation/ee.gauss.prm
deal.II/deal.II/Attic/examples/error-estimation/ee.singular.prm
deal.II/deal.II/Attic/examples/error-estimation/error-estimation.cc
deal.II/deal.II/Attic/examples/error-estimation/make_ps
tests/big-tests/error-estimation/Makefile
tests/big-tests/error-estimation/ee.gauss.prm
tests/big-tests/error-estimation/ee.singular.prm
tests/big-tests/error-estimation/error-estimation.cc
tests/big-tests/error-estimation/make_ps

index 3f035617cba6be8fc2b454710e8fc756480d6f43..35cd1f7b8afc6a8123ae4413a38f339120d7b14b 100644 (file)
@@ -11,7 +11,7 @@ target   = error-estimation
 # the archives ./Obj.a and ./Obj.g.a. By default, the debug version
 # is used to link. It you don't like that, change the following
 # variable to "off"
-debug-mode = on
+debug-mode = off
 
 # If you want your program to be linked with extra object or library
 # files, specify them here:
@@ -23,7 +23,9 @@ run-parameters  = ee.gauss.prm
 
 # To execute additional action apart from running the program, fill
 # in this list:
-additional-run-action = $(target) ee.singular.prm ; gnuplot make_ps ; ./strip_comments
+additional-run-action = $(target) ee.singular.prm ; \
+                        gnuplot make_ps ; \
+                        perl -pi -e 's/^\#.*$$\\${}n//g' data-*/*.inp
 
 # To specify which files are to be deleted by "make clean" (apart from
 # the usual ones: object files, executables, backups, etc), fill in the
index 588bb9a3274669896205882ef067498e2c1827ed..cd8daeb2fd2b3fc3a08ea2e363b68b7f7bd1be4c 100644 (file)
@@ -2,5 +2,6 @@ set Test case            = Gauss shape
 set Initial refinement   = 2
 set Refinement criterion = { global | true error | estimated error }
 set Refinement fraction  = 0.3
+set Maximum cells        = 3000
 set Output base filename = data-gauss/
 set Output format        = ucd
index d906f3f768c5353fddf787da1922bd2961001d84..6b5861d0064598fcc696b1ee7feb0e276d7fbd6d 100644 (file)
@@ -1,6 +1,7 @@
 set Test case            = Singular
 set Initial refinement   = 1
-set Refinement criterion = { global | true error | estimated error }
-set Refinement fraction  = 0.2
+set Refinement criterion = { global | estimated error }
+set Refinement fraction  = 0.1
+set Maximum cells        = 10000
 set Output base filename = data-singular/
 set Output format        = ucd
index 2b42b1b95a50cb5ec95d0e73e87341c87a62db7b..18c19ef5d5cb8666865a9b963151c5aacb89ac07 100644 (file)
@@ -80,8 +80,6 @@ class PoissonProblem : public ProblemBase<dim>,
     vector<double> l2_error, linfty_error;
     vector<double> h1_error, estimated_error;
     vector<int>    n_dofs;
-
-    vector<double> laplacian;
 };
 
 
@@ -292,6 +290,8 @@ void PoissonProblem<dim>::declare_parameters (ParameterHandler &prm) {
                     "global\\|true error\\|estimated error");
   prm.declare_entry ("Refinement fraction", "0.3",
                     ParameterHandler::RegularExpressions::Double);
+  prm.declare_entry ("Maximum cells", "3000",
+                    ParameterHandler::RegularExpressions::Integer);
   prm.declare_entry ("Output base filename", "");
   prm.declare_entry ("Output format", "ucd"
                     "ucd\\|gnuplot");
@@ -358,7 +358,8 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   QGauss3<dim>                    quadrature;
 
   unsigned int refine_step = 0;
-  while (tria->n_active_cells() < 2000)
+  const unsigned int max_cells = prm.get_integer("Maximum cells");
+  while (tria->n_active_cells() < max_cells)
     {
       cout << "Refinement step " << refine_step
           << ", using " << tria->n_active_cells() << " active cells on "
@@ -382,7 +383,6 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
 
       dVector       l2_error_per_cell, linfty_error_per_cell, h1_error_per_cell;
       dVector       estimated_error_per_cell;
-      dVector       laplacian_per_cell;
       QGauss3<dim>  q;
   
       cout << "    Calculating L2 error... ";
@@ -412,28 +412,16 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
       cout << estimated_error_per_cell.l2_norm() << endl;
       estimated_error.push_back (estimated_error_per_cell.l2_norm());
 
-      laplacian_per_cell = estimated_error_per_cell;
-      DoFHandler<dim>::active_cell_iterator cell = dof->begin_active(),
-                                           endc = dof->end();
-      for (unsigned int i=0; cell!=endc; ++cell, ++i)
-       laplacian_per_cell(i) /= (cell->diameter() * cell->diameter() / 24);
-      cout << "    Computing second derivative maximum... "
-          <<  laplacian_per_cell.linfty_norm()
-          << endl;
-      laplacian.push_back (laplacian_per_cell.linfty_norm());
-      
       dVector l2_error_per_dof, linfty_error_per_dof;
       dVector h1_error_per_dof, estimated_error_per_dof;
-      dVector laplacian_per_dof;
+      dVector error_ratio;
       dof->distribute_cell_to_dof_vector (l2_error_per_cell, l2_error_per_dof);
       dof->distribute_cell_to_dof_vector (linfty_error_per_cell,
                                          linfty_error_per_dof);
       dof->distribute_cell_to_dof_vector (h1_error_per_cell, h1_error_per_dof);
       dof->distribute_cell_to_dof_vector (estimated_error_per_cell,
                                          estimated_error_per_dof);
-      dof->distribute_cell_to_dof_vector (laplacian_per_cell,
-                                         laplacian_per_dof);
-  
+      error_ratio.ratio (h1_error_per_dof, estimated_error_per_dof);
   
       DataOut<dim> out;
       fill_data (out);
@@ -441,7 +429,7 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
       out.add_data_vector (linfty_error_per_dof, "Linfty-Error");
       out.add_data_vector (h1_error_per_dof, "H1-Error");
       out.add_data_vector (estimated_error_per_dof, "Estimated Error");
-      out.add_data_vector (laplacian_per_dof, "Second derivative pointwise");
+      out.add_data_vector (error_ratio, "Ratio True:Estimated Error");
       String filename = prm.get ("Output base filename");
       switch (refine_mode) 
        {
@@ -523,8 +511,7 @@ void PoissonProblem<dim>::print_history (const ParameterHandler &prm,
        << endl;
   ofstream out(filename);
   out << "# n_dofs    l2_error linfty_error "
-      << "h1_error estimated_error "
-      << "laplacian"
+      << "h1_error estimated_error"
       << endl;
   for (unsigned int i=0; i<n_dofs.size(); ++i)
     out << n_dofs[i]
@@ -533,7 +520,6 @@ void PoissonProblem<dim>::print_history (const ParameterHandler &prm,
        << linfty_error[i] << "  "
        << h1_error[i] << "  "
        << estimated_error[i] << "  "
-       << laplacian[i]
        << endl;
 
   double average_l2=0,
index ef9c54cf76e214725dbd6d8bab73eb2a3fbec849..38d05f569a0d3389d5bbd6faf73025aa022460fd 100644 (file)
@@ -34,16 +34,10 @@ set output "data-singular/history.global.eps"
 plot "data-singular/history.global.gnuplot" using 1:2 title "L2 error","data-singular/history.global.gnuplot" using 1:3 title "Linfty error","data-singular/history.global.gnuplot" using 1:4 title "H1 error","data-singular/history.global.gnuplot" using 1:5 title "Estimated H1 error"
 
 
-set output "data-singular/history.true_error.eps"
-
-plot "data-singular/history.true_error.gnuplot" using 1:2 title "L2 error","data-singular/history.true_error.gnuplot" using 1:3 title "Linfty error","data-singular/history.true_error.gnuplot" using 1:4 title "H1 error","data-singular/history.true_error.gnuplot" using 1:5 title "Estimated H1 error"
-
-
-
 set output "data-singular/history.estimated_error.eps"
 
 plot "data-singular/history.estimated_error.gnuplot" using 1:2 title "L2 error","data-singular/history.estimated_error.gnuplot" using 1:3 title "Linfty error","data-singular/history.estimated_error.gnuplot" using 1:4 title "H1 error","data-singular/history.estimated_error.gnuplot" using 1:5 title "Estimated H1 error"
 
 
 set output "data-singular/history.compare.eps"
-plot "data-singular/history.global.gnuplot" using 1:2 title "global refinement -- L2 error", "data-singular/history.true_error.gnuplot" using 1:2 title "ref. by true error -- L2 error", "data-singular/history.estimated_error.gnuplot" using 1:2 title "ref. by estimated error -- L2 error", "data-singular/history.global.gnuplot" using 1:4 title "global refinement -- H1 error", "data-singular/history.true_error.gnuplot" using 1:4 title "ref. by true error -- H1 error", "data-singular/history.estimated_error.gnuplot" using 1:4 title "ref. by estimated error -- H1 error"
+plot "data-singular/history.global.gnuplot" using 1:2 title "global refinement -- L2 error", "data-singular/history.estimated_error.gnuplot" using 1:2 title "ref. by estimated error -- L2 error", "data-singular/history.global.gnuplot" using 1:4 title "global refinement -- H1 error", "data-singular/history.estimated_error.gnuplot" using 1:4 title "ref. by estimated error -- H1 error"
index 3f035617cba6be8fc2b454710e8fc756480d6f43..35cd1f7b8afc6a8123ae4413a38f339120d7b14b 100644 (file)
@@ -11,7 +11,7 @@ target   = error-estimation
 # the archives ./Obj.a and ./Obj.g.a. By default, the debug version
 # is used to link. It you don't like that, change the following
 # variable to "off"
-debug-mode = on
+debug-mode = off
 
 # If you want your program to be linked with extra object or library
 # files, specify them here:
@@ -23,7 +23,9 @@ run-parameters  = ee.gauss.prm
 
 # To execute additional action apart from running the program, fill
 # in this list:
-additional-run-action = $(target) ee.singular.prm ; gnuplot make_ps ; ./strip_comments
+additional-run-action = $(target) ee.singular.prm ; \
+                        gnuplot make_ps ; \
+                        perl -pi -e 's/^\#.*$$\\${}n//g' data-*/*.inp
 
 # To specify which files are to be deleted by "make clean" (apart from
 # the usual ones: object files, executables, backups, etc), fill in the
index 588bb9a3274669896205882ef067498e2c1827ed..cd8daeb2fd2b3fc3a08ea2e363b68b7f7bd1be4c 100644 (file)
@@ -2,5 +2,6 @@ set Test case            = Gauss shape
 set Initial refinement   = 2
 set Refinement criterion = { global | true error | estimated error }
 set Refinement fraction  = 0.3
+set Maximum cells        = 3000
 set Output base filename = data-gauss/
 set Output format        = ucd
index d906f3f768c5353fddf787da1922bd2961001d84..6b5861d0064598fcc696b1ee7feb0e276d7fbd6d 100644 (file)
@@ -1,6 +1,7 @@
 set Test case            = Singular
 set Initial refinement   = 1
-set Refinement criterion = { global | true error | estimated error }
-set Refinement fraction  = 0.2
+set Refinement criterion = { global | estimated error }
+set Refinement fraction  = 0.1
+set Maximum cells        = 10000
 set Output base filename = data-singular/
 set Output format        = ucd
index 2b42b1b95a50cb5ec95d0e73e87341c87a62db7b..18c19ef5d5cb8666865a9b963151c5aacb89ac07 100644 (file)
@@ -80,8 +80,6 @@ class PoissonProblem : public ProblemBase<dim>,
     vector<double> l2_error, linfty_error;
     vector<double> h1_error, estimated_error;
     vector<int>    n_dofs;
-
-    vector<double> laplacian;
 };
 
 
@@ -292,6 +290,8 @@ void PoissonProblem<dim>::declare_parameters (ParameterHandler &prm) {
                     "global\\|true error\\|estimated error");
   prm.declare_entry ("Refinement fraction", "0.3",
                     ParameterHandler::RegularExpressions::Double);
+  prm.declare_entry ("Maximum cells", "3000",
+                    ParameterHandler::RegularExpressions::Integer);
   prm.declare_entry ("Output base filename", "");
   prm.declare_entry ("Output format", "ucd"
                     "ucd\\|gnuplot");
@@ -358,7 +358,8 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
   QGauss3<dim>                    quadrature;
 
   unsigned int refine_step = 0;
-  while (tria->n_active_cells() < 2000)
+  const unsigned int max_cells = prm.get_integer("Maximum cells");
+  while (tria->n_active_cells() < max_cells)
     {
       cout << "Refinement step " << refine_step
           << ", using " << tria->n_active_cells() << " active cells on "
@@ -382,7 +383,6 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
 
       dVector       l2_error_per_cell, linfty_error_per_cell, h1_error_per_cell;
       dVector       estimated_error_per_cell;
-      dVector       laplacian_per_cell;
       QGauss3<dim>  q;
   
       cout << "    Calculating L2 error... ";
@@ -412,28 +412,16 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
       cout << estimated_error_per_cell.l2_norm() << endl;
       estimated_error.push_back (estimated_error_per_cell.l2_norm());
 
-      laplacian_per_cell = estimated_error_per_cell;
-      DoFHandler<dim>::active_cell_iterator cell = dof->begin_active(),
-                                           endc = dof->end();
-      for (unsigned int i=0; cell!=endc; ++cell, ++i)
-       laplacian_per_cell(i) /= (cell->diameter() * cell->diameter() / 24);
-      cout << "    Computing second derivative maximum... "
-          <<  laplacian_per_cell.linfty_norm()
-          << endl;
-      laplacian.push_back (laplacian_per_cell.linfty_norm());
-      
       dVector l2_error_per_dof, linfty_error_per_dof;
       dVector h1_error_per_dof, estimated_error_per_dof;
-      dVector laplacian_per_dof;
+      dVector error_ratio;
       dof->distribute_cell_to_dof_vector (l2_error_per_cell, l2_error_per_dof);
       dof->distribute_cell_to_dof_vector (linfty_error_per_cell,
                                          linfty_error_per_dof);
       dof->distribute_cell_to_dof_vector (h1_error_per_cell, h1_error_per_dof);
       dof->distribute_cell_to_dof_vector (estimated_error_per_cell,
                                          estimated_error_per_dof);
-      dof->distribute_cell_to_dof_vector (laplacian_per_cell,
-                                         laplacian_per_dof);
-  
+      error_ratio.ratio (h1_error_per_dof, estimated_error_per_dof);
   
       DataOut<dim> out;
       fill_data (out);
@@ -441,7 +429,7 @@ void PoissonProblem<dim>::run (ParameterHandler &prm) {
       out.add_data_vector (linfty_error_per_dof, "Linfty-Error");
       out.add_data_vector (h1_error_per_dof, "H1-Error");
       out.add_data_vector (estimated_error_per_dof, "Estimated Error");
-      out.add_data_vector (laplacian_per_dof, "Second derivative pointwise");
+      out.add_data_vector (error_ratio, "Ratio True:Estimated Error");
       String filename = prm.get ("Output base filename");
       switch (refine_mode) 
        {
@@ -523,8 +511,7 @@ void PoissonProblem<dim>::print_history (const ParameterHandler &prm,
        << endl;
   ofstream out(filename);
   out << "# n_dofs    l2_error linfty_error "
-      << "h1_error estimated_error "
-      << "laplacian"
+      << "h1_error estimated_error"
       << endl;
   for (unsigned int i=0; i<n_dofs.size(); ++i)
     out << n_dofs[i]
@@ -533,7 +520,6 @@ void PoissonProblem<dim>::print_history (const ParameterHandler &prm,
        << linfty_error[i] << "  "
        << h1_error[i] << "  "
        << estimated_error[i] << "  "
-       << laplacian[i]
        << endl;
 
   double average_l2=0,
index ef9c54cf76e214725dbd6d8bab73eb2a3fbec849..38d05f569a0d3389d5bbd6faf73025aa022460fd 100644 (file)
@@ -34,16 +34,10 @@ set output "data-singular/history.global.eps"
 plot "data-singular/history.global.gnuplot" using 1:2 title "L2 error","data-singular/history.global.gnuplot" using 1:3 title "Linfty error","data-singular/history.global.gnuplot" using 1:4 title "H1 error","data-singular/history.global.gnuplot" using 1:5 title "Estimated H1 error"
 
 
-set output "data-singular/history.true_error.eps"
-
-plot "data-singular/history.true_error.gnuplot" using 1:2 title "L2 error","data-singular/history.true_error.gnuplot" using 1:3 title "Linfty error","data-singular/history.true_error.gnuplot" using 1:4 title "H1 error","data-singular/history.true_error.gnuplot" using 1:5 title "Estimated H1 error"
-
-
-
 set output "data-singular/history.estimated_error.eps"
 
 plot "data-singular/history.estimated_error.gnuplot" using 1:2 title "L2 error","data-singular/history.estimated_error.gnuplot" using 1:3 title "Linfty error","data-singular/history.estimated_error.gnuplot" using 1:4 title "H1 error","data-singular/history.estimated_error.gnuplot" using 1:5 title "Estimated H1 error"
 
 
 set output "data-singular/history.compare.eps"
-plot "data-singular/history.global.gnuplot" using 1:2 title "global refinement -- L2 error", "data-singular/history.true_error.gnuplot" using 1:2 title "ref. by true error -- L2 error", "data-singular/history.estimated_error.gnuplot" using 1:2 title "ref. by estimated error -- L2 error", "data-singular/history.global.gnuplot" using 1:4 title "global refinement -- H1 error", "data-singular/history.true_error.gnuplot" using 1:4 title "ref. by true error -- H1 error", "data-singular/history.estimated_error.gnuplot" using 1:4 title "ref. by estimated error -- H1 error"
+plot "data-singular/history.global.gnuplot" using 1:2 title "global refinement -- L2 error", "data-singular/history.estimated_error.gnuplot" using 1:2 title "ref. by estimated error -- L2 error", "data-singular/history.global.gnuplot" using 1:4 title "global refinement -- H1 error", "data-singular/history.estimated_error.gnuplot" using 1:4 title "ref. by estimated error -- H1 error"

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.