Dear all,
Meanwhile, I found out that the ExactSolution class seems to offer
exactly what I need. However, I have attached a patch that extends
that class in two ways:
1. It is satisfied with const references to the EquationSystem
objects.
2. It can compute also the L1 and L_INF norms of the errors (I had to
extend the FEMNormType enum for that case, too).
Would you please be so kind and check that changes in (provided you
like them)?
Best Regards,
Tim
--
Dr. Tim Kroeger Phone +49-421-218-7710
[EMAIL PROTECTED], [EMAIL PROTECTED] Fax +49-421-218-4236
MeVis Research GmbH, Universitaetsallee 29, 28359 Bremen, Germany
Amtsgericht Bremen HRB 16222
Geschaeftsfuehrer: Prof. Dr. H.-O. Peitgen
Index: include/enums/enum_norm_type.h
===================================================================
--- include/enums/enum_norm_type.h (Revision 3002)
+++ include/enums/enum_norm_type.h (Arbeitskopie)
@@ -35,6 +35,9 @@
H1 = 1,
H2 = 2,
+ L1 = 5,
+ L_INF = 6,
+
H1_SEMINORM = 10,
H2_SEMINORM = 11,
Index: include/solvers/exact_solution.h
===================================================================
--- include/solvers/exact_solution.h (Revision 3002)
+++ include/solvers/exact_solution.h (Arbeitskopie)
@@ -68,7 +68,7 @@
* must be initialized with an EquationSystems
* object.
*/
- ExactSolution (EquationSystems& es);
+ ExactSolution (const EquationSystems& es);
/**
* Destructor.
@@ -81,7 +81,7 @@
* allows the user to attach a second EquationSystems
* object with a reference fine grid solution.
*/
- void attach_reference_solution (EquationSystems* es_fine);
+ void attach_reference_solution (const EquationSystems* es_fine);
/**
* Attach function similar to system.h which
@@ -234,13 +234,13 @@
* Constant reference to the \p EquationSystems object
* used for the simulation.
*/
- EquationSystems& _equation_systems;
+ const EquationSystems& _equation_systems;
/**
* Constant pointer to the \p EquationSystems object
* containing the fine grid solution.
*/
- EquationSystems* _equation_systems_fine;
+ const EquationSystems* _equation_systems_fine;
/**
* Extra order to use for quadrature rule
Index: src/solvers/exact_solution.C
===================================================================
--- src/solvers/exact_solution.C (Revision 3002)
+++ src/solvers/exact_solution.C (Arbeitskopie)
@@ -35,7 +35,7 @@
#include "tensor_value.h"
#include "vector_value.h"
-ExactSolution::ExactSolution(EquationSystems& es) :
+ExactSolution::ExactSolution(const EquationSystems& es) :
_exact_value (NULL),
_exact_deriv (NULL),
_exact_hessian (NULL),
@@ -68,7 +68,7 @@
}
-void ExactSolution::attach_reference_solution (EquationSystems* es_fine)
+void ExactSolution::attach_reference_solution (const EquationSystems* es_fine)
{
libmesh_assert (es_fine != NULL);
_equation_systems_fine = es_fine;
@@ -206,6 +206,10 @@
return std::sqrt(error_vals[1]);
case H2_SEMINORM:
return std::sqrt(error_vals[2]);
+ case L1:
+ return error_vals[3];
+ case L_INF:
+ return error_vals[4];
// Currently only Sobolev norms/seminorms are supported
default:
libmesh_error();
@@ -347,7 +351,7 @@
const MeshBase& _mesh = computed_system.get_mesh();
// Zero the error before summation
- error_vals = std::vector<Number>(3, 0.);
+ error_vals = std::vector<Number>(5, 0.);
// get the EquationSystems parameters for use with _exact_value
const Parameters& parameters = this->_equation_systems.parameters;
@@ -463,8 +467,10 @@
// Add the squares of the error to each contribution
error_vals[0] += JxW[qp]*libmesh_norm(val_error);
+ Real norm = sqrt(libmesh_norm(val_error));
+ error_vals[3] += JxW[qp]*norm;
+ if(error_vals[4]<norm) { error_vals[4] = norm; }
-
// Compute the value of the error in the gradient at this
// quadrature point
Gradient exact_grad;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users