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

The tensor transport-diffusion benchmark with the discontinuous Galerkin method.

The tensor transport-diffusion benchmark with the 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]);
space Xh (omega, argv[2], "tensor");
Float alpha = (argc > 3) ? atof(argv[3]) : 1;
Float nu = (argc > 4) ? atof(argv[4]) : 3;
Float t0 = (argc > 5) ? atof(argv[5]) : acos(-1.)/8;
Float eps = (argc > 6) ? atof(argv[6]) : 1e-2;
Float a = 0;
size_t d = omega.dimension();
size_t k = Xh.degree();
Float eta = (k+1)*(k+d)/Float(d);
trial sigma (Xh); test tau (Xh);
tensor ma = 0.5*((1-a)*grad_u - (1+a)*trans(grad_u));
auto beta_a = sigma*ma + trans(ma)*sigma;
form ah = integrate (ddot(grad_h(sigma)*u + beta_a + nu*sigma,tau)
+ eps*dddot(grad_h(sigma), grad_h(tau)))
+ integrate ("boundary",
max(0, -dot(u,normal()))*ddot(sigma,tau))
+ integrate ("internal_sides",
- dot(u,normal())*ddot(jump(sigma),average(tau))
+ 0.5*alpha*abs(dot(u,normal()))
*ddot(jump(sigma),jump(tau)))
+ integrate("sides",
eps*eta*penalty()*ddot(jump(sigma),jump(tau))
- eps*ddot(jump(sigma), average(grad_h(tau )*normal()))
- eps*ddot(jump(tau) , average(grad_h(sigma)*normal())));
field lh = integrate (ddot(chi(eps,nu,t0),tau))
+ integrate ("boundary",
max(0, -dot(u,normal()))*ddot(sigma_g(nu,t0),tau)
+ eps*eta*penalty()*ddot(sigma_g(nu,t0),tau)
- eps*ddot(sigma_g(nu,t0),grad_h(tau)*normal())
+ eps*ddot(grad_sigma_g(nu,t0)*normal(),tau));
field sigma_h(Xh);
problem p (ah);
p.solve (lh, sigma_h);
dout << catchmark("nu") << nu << endl
<< catchmark("t0") << t0 << endl
<< catchmark("sigma") << sigma_h;
}
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 space page for the full documentation
see the tensor page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
sigma_exact sigma_g
int main(int argc, char **argv)
The tensor transport-diffusion benchmark – right-hand-side and exact solution.
Float alpha[pmax+1][pmax+1]
Definition: bdf.icc:28
rheolef::details::is_vec dot
This file is part of Rheolef.
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
Definition: tensor.cc:278
T dddot(const tensor3_basic< T > &a, const tensor3_basic< T > &b)
Definition: tensor3.cc:94
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
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition: csr.h:455
details::field_expr_v2_nonlinear_terminal_function< details::penalty_pseudo_function< Float > > penalty()
penalty(): see the expression page for the full documentation
STL namespace.
rheolef - reference manual
Definition: eta.h:25
Definition: nu.h:26
Definition: sphere.icc:25
Definition: leveque.h:25