Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
convect_hdg_error.cc
Go to the documentation of this file.
1
25#include "rheolef.h"
26using namespace rheolef;
27using namespace std;
29int 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();
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 = lazy_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 = lazy_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}
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
see the integrate_option page for the full documentation
void set_family(family_type type)
see the space page for the full documentation
int main()
Definition field2bb.cc:58
space_basic< T, M > Xh1
Definition field_expr.h:232
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.
field_basic< T, M > lazy_interpolate(const space_basic< T, M > &X2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition field.h:871
T norm2(const vec< T, M > &x)
norm2(x): see the expression page for the full documentation
Definition vec.h:379
std::enable_if< details::has_field_rdof_interface< Expr >::value, details::field_expr_v2_nonlinear_terminal_field< typenameExpr::scalar_type, typenameExpr::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:211
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
STL namespace.
rheolef - reference manual
Definition nu.h:26
Definition phi.h:25