# 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:
# 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
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
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
vector<double> l2_error, linfty_error;
vector<double> h1_error, estimated_error;
vector<int> n_dofs;
-
- vector<double> laplacian;
};
"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");
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 "
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... ";
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);
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)
{
<< 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]
<< linfty_error[i] << " "
<< h1_error[i] << " "
<< estimated_error[i] << " "
- << laplacian[i]
<< endl;
double average_l2=0,
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"
# 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:
# 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
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
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
vector<double> l2_error, linfty_error;
vector<double> h1_error, estimated_error;
vector<int> n_dofs;
-
- vector<double> laplacian;
};
"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");
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 "
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... ";
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);
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)
{
<< 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]
<< linfty_error[i] << " "
<< h1_error[i] << " "
<< estimated_error[i] << " "
- << laplacian[i]
<< endl;
double average_l2=0,
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"