Loading...
Searching...
No Matches
transport_hdg.cc
Go to the documentation of this file.
#include "rheolef.h"
using namespace rheolef;
using namespace std;
Float negative (Float x) {
return (x < -1e5*numeric_limits<Float>::epsilon()) ? 1 : 0; }
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
space Xh (omega, argv[2]),
Mh (omega["sides"], argv[2]);
Float sigma = (argc > 4) ? atof(argv[4]) : 3;
point u (1,0,0);
trial phi(Xh), lambda(Mh);
test psi(Xh), mu(Mh);
integrate_option iopt;
iopt.invert = true;
form inv_a = integrate (phi*(sigma*psi - dot(u,grad_h(psi)))
+ on_local_sides(abs(dot(u,normal()))*phi*psi), iopt);
form b1 = integrate ("internal_sides", (dot(u,normal())*jump(phi)
- 2*abs(dot(u,normal()))*average(phi))*mu)
- integrate ("boundary", 2*max(0, -dot(u,normal()))*phi*mu);
form b2 = integrate ("internal_sides", average(phi)*mu)
+ integrate ("boundary",
(1-compose(negative,dot(u,normal())))*phi*mu);
form c = integrate ("sides", lambda*mu);
field lh(Xh, 0);
field kh = integrate("boundary", -compose(negative,dot(u,normal()))*mu);
form s = c + b2*inv_a*trans(b1);
field rh = b2*(inv_a*lh) - kh;
field lambda_h(Mh);
problem ps (s);
ps.solve (rh, lambda_h);
field phi_h = inv_a*(lh - b1.trans_mult(lambda_h));
dout << catchmark("sigma") << sigma << endl
<< catchmark("phi") << phi_h
<< catchmark("lambda") << lambda_h;
#ifdef TO_CLEAN
form a = integrate (phi*(sigma*psi - dot(u,grad_h(psi)))
+ on_local_sides(abs(dot(u,normal()))*phi*psi));
odiststream out ("aa","m",io::nogz);
out << matlab
<< setbasename("a") << a.uu()
<< setbasename("inv_a") << inv_a.uu()
<< setbasename("b1") << b1.uu()
<< setbasename("b2") << b2.uu()
<< setbasename("c") << c.uu()
<< setbasename("s") << s.uu()
<< "lh=" << lh.u() << endl
<< "kh=" << kh.u() << endl
<< "rh=" << rh.u() << endl
<< "eig_a=eig(a)" << endl
<< "eig_c=eig(c)" << endl
<< "eig_s=eig(s)" << endl
;
#endif // TO_CLEAN
}
lh
field lh(Float epsilon, Float t, const test &v)
Definition burgers_diffusion_operators.icc:25
Float
see the Float page for the full documentation
field
see the field page for the full documentation
form
see the form page for the full documentation
geo
see the geo page for the full documentation
point
see the point page for the full documentation
problem
see the problem page for the full documentation
rheolef::catchmark
see the catchmark page for the full documentation
Definition catchmark.h:67
rheolef::environment
see the environment page for the full documentation
Definition environment.h:121
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition integrate_option.h:125
rheolef::integrate_option::invert
bool invert
Definition integrate_option.h:168
rheolef::odiststream
odiststream: see the diststream page for the full documentation
Definition diststream.h:137
space
see the space page for the full documentation
test
see the test page for the full documentation
trial
see the test page for the full documentation
main
int main()
Definition field2bb.cc:58
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::io::nogz
@ nogz
Definition rheostream.h:175
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::grad_h
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
Definition field_expr_terminal.h:968
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:432
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:211
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:323
rheolef::dot
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
Definition vec_expr_v2.h:415
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::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:247
std
STL namespace.
rheolef.h
rheolef - reference manual
lambda
Definition yield_slip_circle.h:34
phi
Definition phi.h:25
psi
Definition interpolate_RTk_polynom.icc:34
sigma
Definition mosolov_exact_circle.h:40
u
Definition leveque.h:25
negative
Float negative(Float x)
Definition transport_hdg.cc:24