Rheolef  7.1
an efficient C++ finite element environment
transport_hdg.cc
Go to the documentation of this file.
1 #include "rheolef.h"
22 using namespace rheolef;
23 using namespace std;
25  return (x < -1e5*numeric_limits<Float>::epsilon()) ? 1 : 0; }
26 int 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);
35  integrate_option iopt;
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:115
see the integrate_option page for the full documentation
odiststream: see the diststream page for the full documentation
Definition: diststream.h:126
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
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
This file is part of Rheolef.
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition: csr.h:455
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
dot(x,y): see the expression page for the full documentation
Definition: vec_expr_v2.h:415
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_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
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
details::field_expr_v2_nonlinear_node_nary< typename details::function_traits< Function >::functor_type,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits< Exprs >::type... > ::type compose(const Function &f, const Exprs &... exprs)
see the compose page for the full documentation
Definition: compose.h:246
details::field_expr_v2_nonlinear_terminal_function< details::normal_pseudo_function< Float > > normal()
normal: see the expression page for the full documentation
rheolef - reference manual
Definition: phi.h:25
Definition: leveque.h:25
Float u(const point &x)
Float epsilon
int main(int argc, char **argv)
Float negative(Float x)