exact_solution.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 #ifndef LIBMESH_EXACT_SOLUTION_H
19 #define LIBMESH_EXACT_SOLUTION_H
20 
21 
22 // Local Includes
23 #include "libmesh/libmesh_common.h" // for Number
24 #include "libmesh/enum_norm_type.h"
25 
26 // C++ includes
27 #include <map>
28 #include <vector>
29 
30 namespace libMesh
31 {
32 
33 
34 // Forward Declarations
35 class Point;
36 class EquationSystems;
37 class Parameters;
38 class Mesh;
39 template <typename Output> class FunctionBase;
40 
41 // Is there any way to simplify this?
42 // All we need are Tensor and Gradient. - RHS
43 template <typename T> class TensorValue;
44 template <typename T> class VectorValue;
49 
65 {
66 
67 public:
73  explicit
74  ExactSolution (const EquationSystems& es);
75 
80 
81 
87  void attach_reference_solution (const EquationSystems* es_fine);
88 
93  void attach_exact_values (std::vector<FunctionBase<Number> *> f);
94 
99  void attach_exact_value (unsigned int sys_num,
101 
106  void attach_exact_value (Number fptr(const Point& p,
107  const Parameters& Parameters,
108  const std::string& sys_name,
109  const std::string& unknown_name));
110 
115  void attach_exact_derivs (std::vector<FunctionBase<Gradient> *> g);
116 
121  void attach_exact_deriv (unsigned int sys_num,
123 
128  void attach_exact_deriv (Gradient gptr(const Point& p,
129  const Parameters& parameters,
130  const std::string& sys_name,
131  const std::string& unknown_name));
132 
137  void attach_exact_hessians (std::vector<FunctionBase<Tensor> *> h);
138 
143  void attach_exact_hessian (unsigned int sys_num,
145 
150  void attach_exact_hessian (Tensor hptr(const Point& p,
151  const Parameters& parameters,
152  const std::string& sys_name,
153  const std::string& unknown_name));
154 
159  void extra_quadrature_order (const int extraorder)
160  { _extra_order = extraorder; }
161 
169  void compute_error(const std::string& sys_name,
170  const std::string& unknown_name);
171 
177  Real l2_error(const std::string& sys_name,
178  const std::string& unknown_name);
179 
185  Real l1_error(const std::string& sys_name,
186  const std::string& unknown_name);
187 
197  Real l_inf_error(const std::string& sys_name,
198  const std::string& unknown_name);
199 
205  Real h1_error(const std::string& sys_name,
206  const std::string& unknown_name);
207 
215  Real hcurl_error(const std::string& sys_name,
216  const std::string& unknown_name);
217 
225  Real hdiv_error(const std::string& sys_name,
226  const std::string& unknown_name);
227 
233  Real h2_error(const std::string& sys_name,
234  const std::string& unknown_name);
235 
243  Real error_norm(const std::string& sys_name,
244  const std::string& unknown_name,
245  const FEMNormType& norm);
246 private:
247 
254  template<typename OutputShape>
255  void _compute_error(const std::string& sys_name,
256  const std::string& unknown_name,
257  std::vector<Real>& error_vals);
258 
264  std::vector<Real>& _check_inputs(const std::string& sys_name,
265  const std::string& unknown_name);
266 
271  std::vector<FunctionBase<Number> *> _exact_values;
272 
277  std::vector<FunctionBase<Gradient> *> _exact_derivs;
278 
283  std::vector<FunctionBase<Tensor> *> _exact_hessians;
284 
293  typedef std::map<std::string, std::vector<Real> > SystemErrorMap;
294 
301  std::map<std::string, SystemErrorMap> _errors;
302 
308 
314 
319 };
320 
321 
322 
323 } // namespace libMesh
324 
325 
326 #endif // LIBMESH_EXACT_SOLUTION_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:04 UTC

Hosted By:
SourceForge.net Logo