Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
reconstruction_hho_check.cc
Go to the documentation of this file.
1
25#include "rheolef.h"
26using namespace rheolef;
27using namespace std;
28#include "sinusprod.h"
29#include "diffusion_isotropic.h"
30int main(int argc, char**argv) {
31 Float tol = (argc > 1) ? atof(argv[1]) : 1e-15;
32 environment rheolef (argc, argv);
33 field us_h, zeta_h;
34 din >> catchmark("us") >> us_h
35 >> catchmark("zeta") >> zeta_h;
36 const space& Xhs = us_h.get_space();
37 const space& Zh = zeta_h.get_space();
38 const geo& omega = Xhs.get_geo();
39 check_macro (Xhs.degree() > 0, "invalid Xhs degree");
40 size_t k = Xhs.degree() - 1, d = omega.dimension();
41 string Pkd = "P"+to_string(k)+"d",
42 Pld = (argc > 2) ? argv[2] : Pkd;
43 space Xh (omega, Pld),
44 Mh (omega["sides"], Pkd);
45 trial u(Xh), lambda(Mh), us(Xhs), zeta (Zh);
46 test v(Xh), mu (Mh), vs(Xhs), xi (Zh);
48 iopt.invert = true;
49 form as = integrate (dot(grad_h(us),A(d)*grad_h(vs)));
50 form bs = integrate (us*xi);
51 form inv_m = integrate (u*v, iopt);
52 form ms = integrate (lambda*mu);
53 field llh = integrate(u_exact(d)*v);
54 field rhs = integrate(u_exact(d)*mu);
55 field pi_Xh_u = inv_m*llh;
56 field pi_Mh_lambda(Mh);
57 problem pms (ms);
58 pms.solve (rhs, pi_Mh_lambda);
59 field lh = integrate (dot(grad_h(pi_Xh_u),A(d)*grad_h(vs))
60 + on_local_sides((pi_Mh_lambda-pi_Xh_u)
61 *dot(normal(),A(d)*grad_h(vs))));
62 field kh = integrate (pi_Xh_u*xi);
63 field rus = as*us_h - lh;
64 field rz = bs*us_h - kh;
65 Float err_us = rus.max_abs();
66 Float err_z = rz.max_abs();
67 derr << "err_us = " << err_us << endl;
68 derr << "err_z = " << err_z << endl;
69 derr << "|zeta_h| = " << zeta_h.max_abs() << endl;
70 return (max(max(err_us,err_z), zeta_h.max_abs()) < tol) ? 0 : 1;
71}
field lh(Float epsilon, Float t, const test &v)
see the Float page for the full documentation
see the field page for the full documentation
see the form page for the full documentation
see the geo page for the full documentation
see the problem 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
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
Tensor diffusion – isotropic case.
int main()
Definition field2bb.cc:58
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
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
details::field_expr_v2_nonlinear_terminal_function< details::normal_pseudo_function< Float > > normal()
normal: 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
std::enable_if< details::is_field_expr_v2_variational_arg< Expr >::value, details::field_expr_quadrature_on_sides< Expr > >::type on_local_sides(const Expr &expr)
on_local_sides(expr): see the expression page for the full documentation
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
STL namespace.
rheolef - reference manual
The sinus product function.
Definition leveque.h:25