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 }
negative
Float negative(Float x)
Definition: transport_hdg.cc:24
rheolef::io::out
Definition: rheostream.h:167
rheolef::compose
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
form
see the form page for the full documentation
rheolef::catchmark
see the catchmark page for the full documentation
Definition: catchmark.h:67
rheolef::dot
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
field
see the field page for the full documentation
rheolef::normal
details::field_expr_v2_nonlinear_terminal_function< details::normal_pseudo_function< Float > > normal()
normal: see the expression page for the full documentation
Definition: field_expr_terminal.h:439
phi
Definition: phi.h:25
rheolef::integrate
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
phi
Float phi(const point &nu, Float a, Float b)
Definition: burgers_flux_godunov.icc:25
space
see the space page for the full documentation
mkgeo_ball.c
c
Definition: mkgeo_ball.sh:153
rheolef::io::nogz
Definition: rheostream.h:170
rheolef.h
rheolef - reference manual
matlab
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
Definition: iorheo-members.h:109
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition: integrate_option.h:125
rheolef::on_local_sides
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
Definition: field_expr_quadrature.h:321
main
int main(int argc, char **argv)
Definition: transport_hdg.cc:26
a
Definition: diffusion_isotropic.h:25
psi
Definition: interpolate_RTk_polynom.icc:34
rheolef::environment
see the environment page for the full documentation
Definition: environment.h:115
lh
field lh(Float epsilon, Float t, const test &v)
Definition: burgers_diffusion_operators.icc:25
sigma
Definition: mosolov_exact_circle.h:40
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::integrate_option::invert
bool invert
Definition: integrate_option.h:168
test
see the test page for the full documentation
problem
see the problem page for the full documentation
u
Definition: leveque.h:25
rheolef::odiststream
odiststream: see the diststream page for the full documentation
Definition: diststream.h:126
Float
see the Float page for the full documentation
point
see the point page for the full documentation
u
Float u(const point &x)
Definition: transmission_error.cc:26
mkgeo_contraction.mu
mu
Definition: mkgeo_contraction.sh:193
rheolef::grad_h
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
Definition: field_expr_terminal.h:949
trial
see the test page for the full documentation
rheolef::dout
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
epsilon
Float epsilon
Definition: transmission_error.cc:25
rheolef::trans
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
Definition: vec_expr_v2.h:391
geo
see the geo page for the full documentation
lambda
Definition: yield_slip_circle.h:34