Rheolef  7.2
an efficient C++ finite element environment
transport_hdg.cc
Go to the documentation of this file.
1
21#include "rheolef.h"
22using namespace rheolef;
23using namespace std;
25 return (x < -1e5*numeric_limits<Float>::epsilon()) ? 1 : 0; }
26int main(int argc, char**argv) {
27 environment rheolef (argc, argv);
28 geo omega (argv[1]);
29 space Xh (omega, argv[2]),
30 Mh (omega["sides"], argv[2]);
31 Float sigma = (argc > 4) ? atof(argv[4]) : 3;
32 point u (1,0,0);
33 trial phi(Xh), lambda(Mh);
34 test psi(Xh), mu(Mh);
36 iopt.invert = true;
37 form inv_a = integrate (phi*(sigma*psi - dot(u,grad_h(psi)))
38 + on_local_sides(abs(dot(u,normal()))*phi*psi), iopt);
39 form b1 = integrate ("internal_sides", (dot(u,normal())*jump(phi)
40 - 2*abs(dot(u,normal()))*average(phi))*mu)
41 - integrate ("boundary", 2*max(0, -dot(u,normal()))*phi*mu);
42 form b2 = integrate ("internal_sides", average(phi)*mu)
43 + integrate ("boundary",
44 (1-compose(negative,dot(u,normal())))*phi*mu);
45 form c = integrate ("sides", lambda*mu);
46 field lh(Xh, 0);
47 field kh = integrate("boundary", -compose(negative,dot(u,normal()))*mu);
48 form s = c + b2*inv_a*trans(b1);
49 field rh = b2*(inv_a*lh) - kh;
50 field lambda_h(Mh);
51 problem ps (s);
52 ps.solve (rh, lambda_h);
53 field phi_h = inv_a*(lh - b1.trans_mult(lambda_h));
54 dout << catchmark("sigma") << sigma << endl
55 << catchmark("phi") << phi_h
56 << catchmark("lambda") << lambda_h;
57#ifdef TO_CLEAN
59 + on_local_sides(abs(dot(u,normal()))*phi*psi));
60 odiststream out ("aa","m",io::nogz);
61 out << matlab
62 << setbasename("a") << a.uu()
63 << setbasename("inv_a") << inv_a.uu()
64 << setbasename("b1") << b1.uu()
65 << setbasename("b2") << b2.uu()
66 << setbasename("c") << c.uu()
67 << setbasename("s") << s.uu()
68 << "lh=" << lh.u() << endl
69 << "kh=" << kh.u() << endl
70 << "rh=" << rh.u() << endl
71 << "eig_a=eig(a)" << endl
72 << "eig_c=eig(c)" << endl
73 << "eig_s=eig(s)" << endl
74 ;
75#endif // TO_CLEAN
76}
field lh(Float epsilon, Float t, const test &v)
Float phi(const point &nu, Float a, Float b)
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 point 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
Definition: environment.h:121
see the integrate_option page for the full documentation
odiststream: see the diststream page for the full documentation
Definition: diststream.h:137
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
point u(const point &x)
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 matlab
class rheolef::details::field_expr_v2_nonlinear_node_unary compose
rheolef::details::is_vec dot
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
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition: csr.h:455
STL namespace.
rheolef - reference manual
Definition: phi.h:25
Definition: leveque.h:25
Float epsilon
int main(int argc, char **argv)
Float negative(Float x)