Rheolef  7.2
an efficient C++ finite element environment
transmission_dg.cc
Go to the documentation of this file.
1
25#include "rheolef.h"
26using namespace rheolef;
27using namespace std;
28int main(int argc, char**argv) {
29 environment rheolef (argc, argv);
30 geo omega (argv[1]);
31 string approx = (argc > 2) ? argv[2] : "P1d";
32 Float epsilon = (argc > 3) ? atof(argv[3]) : 1e-2;
33 space Xh (omega, approx);
34 size_t d = omega.dimension();
35 size_t k = Xh.degree();
36 check_macro (k >= 1, "polynomial degree k="<<k<<" shoud be >= 1");
37 Float beta = (k+1)*(k+d)/d;
38 field eta_h(Xh);
39 eta_h["west"] = epsilon;
40 eta_h["east"] = 1;
41 geo gamma_d = omega["left"] + omega["right"];
42 geo Shd = omega["internal_sides"] + gamma_d;
43 trial u (Xh); test v (Xh);
44 auto eta_s = 2/(1/inner(eta_h) + 1/outer(eta_h));
45 auto eta_w_o = inner(eta_h)/(inner(eta_h) + outer(eta_h));
46 auto eta_w_i = outer(eta_h)/(inner(eta_h) + outer(eta_h));
47 auto average_w_u = eta_w_i*inner(eta_h*dot(grad_h(u),normal()))
48 + eta_w_o*outer(eta_h*dot(grad_h(u),normal()));
49 auto average_w_v = eta_w_i*inner(eta_h*dot(grad_h(v),normal()))
50 + eta_w_o*outer(eta_h*dot(grad_h(v),normal()));
51 form a = integrate (eta_h*dot(grad_h(u),grad_h(v)))
52 + integrate (Shd, beta*penalty()*eta_s*jump(u)*jump(v)
53 - jump(u)*average_w_v
54 - jump(v)*average_w_u);
55 field lh = integrate (v);
56 solver_option sopt;
57 sopt.iterative = false;
58 problem p (a, sopt);
59 field uh (Xh);
60 p.solve (lh, uh);
61 dout << catchmark("epsilon") << epsilon << endl
62 << catchmark("u") << uh;
63}
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
Definition: environment.h:121
see the solver_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
point u(const point &x)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
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
details::field_expr_v2_nonlinear_terminal_function< details::penalty_pseudo_function< Float > > penalty()
penalty(): see the expression page for the full documentation
Float beta[][pmax+1]
STL namespace.
rheolef - reference manual
Definition: sphere.icc:25
Definition: leveque.h:25
int main(int argc, char **argv)
Float epsilon