Rheolef  7.1
an efficient C++ finite element environment
convect_hdg_error.cc
Go to the documentation of this file.
1 #include "rheolef.h"
26 using namespace rheolef;
27 using namespace std;
28 #include "rotating-hill-statio.h"
29 int main (int argc, char **argv) {
30  environment rheolef (argc,argv);
31  Float tol = (argc > 1) ? atof(argv[1]) : 1e+38;
32  bool dump = (argc > 2);
33  Float nu;
34  field phi_h;
35  din >> catchmark("nu") >> nu
36  >> catchmark("phi") >> phi_h;
37  space Xh = phi_h.get_space();
38  geo omega = phi_h.get_geo();
39  size_t d = Xh.get_geo().dimension();
40  size_t k = Xh.degree();
41  integrate_option iopt;
43  iopt.set_order(2*k+1);
44  Float err_l2 = sqrt(integrate (omega, sqr(phi_h-phi(d,nu)), iopt));
45  basis b1 = Xh.get_basis();
46  b1.reset_family_index (k+1);
47  space Xh1 (omega, b1);
48  field eh = interpolate (Xh1, phi_h-phi(d,nu));
49  Float err_linf = eh.max_abs();
50  Float err_h1 = sqrt(integrate (omega, norm2(grad_h(eh)), iopt)
51  + integrate (omega.sides(), (1/h_local())*sqr(jump(eh)), iopt));
52  derr << "err_l2 = " << err_l2 << endl
53  << "err_linf = " << err_linf << endl
54  << "err_h1 = " << err_h1 << endl;
55  if (dump) {
56  field pi_h_phi = interpolate (Xh, phi(d,nu));
57  dout << catchmark("phi") << phi_h
58  << catchmark("phi_e") << pi_h_phi;
59  }
60  return (err_linf <= tol) ? 0 : 1;
61 }
Float phi(const point &nu, Float a, Float b)
see the Float page for the full documentation
see the basis page for the full documentation
see the field page for the full documentation
see the geo page for the full documentation
see the catchmark page for the full documentation
Definition: catchmark.h:67
see the environment page for the full documentation
Definition: environment.h:104
T max_abs() const
Definition: field.h:731
see the integrate_option page for the full documentation
void set_family(family_type type)
idiststream din
see the diststream page for the full documentation
Definition: diststream.h:427
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
odiststream derr(cerr)
see the diststream page for the full documentation
Definition: diststream.h:436
see the space page for the full documentation
int main(int argc, char **argv)
space_basic< T, M > Xh1
Definition: field_expr.h:263
field_basic< T, M > eh
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format dump
This file is part of Rheolef.
details::field_expr_v2_nonlinear_terminal_function< details::h_local_pseudo_function< Float > > h_local()
h_local: see the expression page for the full documentation
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type grad_h(const Expr &expr)
grad_h(uh): see the expression page for the full documentation
std::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr >::value &&! is_undeterminated< Result >::value, Result >::type integrate(const geo_basic< T, M > &omega, const Expr &expr, const integrate_option &iopt, Result dummy=Result())
see the integrate page for the full documentation
Definition: integrate.h:202
field_basic< T, M > interpolate(const space_basic< T, M > &V2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition: interpolate.cc:233
T norm2(const vec< T, M > &x)
norm2(x): see the expression page for the full documentation
Definition: vec.h:379
rheolef - reference manual
Definition: nu.h:26