Rheolef  7.2
an efficient C++ finite element environment
transmission_dg.cc

The transmission problem with discontinuous Galerkin method

#include "rheolef.h"
using namespace rheolef;
using namespace std;
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
string approx = (argc > 2) ? argv[2] : "P1d";
Float epsilon = (argc > 3) ? atof(argv[3]) : 1e-2;
space Xh (omega, approx);
size_t d = omega.dimension();
size_t k = Xh.degree();
check_macro (k >= 1, "polynomial degree k="<<k<<" shoud be >= 1");
Float beta = (k+1)*(k+d)/d;
field eta_h(Xh);
eta_h["west"] = epsilon;
eta_h["east"] = 1;
geo gamma_d = omega["left"] + omega["right"];
geo Shd = omega["internal_sides"] + gamma_d;
trial u (Xh); test v (Xh);
auto eta_s = 2/(1/inner(eta_h) + 1/outer(eta_h));
auto eta_w_o = inner(eta_h)/(inner(eta_h) + outer(eta_h));
auto eta_w_i = outer(eta_h)/(inner(eta_h) + outer(eta_h));
auto average_w_u = eta_w_i*inner(eta_h*dot(grad_h(u),normal()))
+ eta_w_o*outer(eta_h*dot(grad_h(u),normal()));
auto average_w_v = eta_w_i*inner(eta_h*dot(grad_h(v),normal()))
+ eta_w_o*outer(eta_h*dot(grad_h(v),normal()));
form a = integrate (eta_h*dot(grad_h(u),grad_h(v)))
+ integrate (Shd, beta*penalty()*eta_s*jump(u)*jump(v)
- jump(u)*average_w_v
- jump(v)*average_w_u);
solver_option sopt;
sopt.iterative = false;
problem p (a, sopt);
field uh (Xh);
p.solve (lh, uh);
dout << catchmark("epsilon") << epsilon << endl
<< catchmark("u") << uh;
}
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
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:467
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)
This file is part of Rheolef.
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_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::has_field_rdof_interface< 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
details::field_expr_v2_nonlinear_terminal_function< details::penalty_pseudo_function< Float > > penalty()
penalty(): 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
Float beta[][pmax+1]
rheolef - reference manual
Definition: sphere.icc:25
Definition: leveque.h:25
int main(int argc, char **argv)
Float epsilon