rheolef  7.0
stokes_contraction_bubble.cc
Go to the documentation of this file.
1 #include "rheolef.h"
2 using namespace rheolef;
3 using namespace std;
4 #include "contraction.icc"
5 int main(int argc, char**argv) {
6  environment rheolef (argc, argv);
7  geo omega (argv[1]);
8  space X1h = contraction::velocity_space (omega, "P1");
9  space Bh (omega, "bubble", "vector");
10  space Qh (omega, "P1");
11  trial u1 (X1h), ub (Bh), p (Qh);
12  test v1 (X1h), vb (Bh), q (Qh);
13  form mp = integrate (p*q);
14  form b1 = integrate (-div(u1)*q);
15  form bb = integrate (-div(ub)*q);
16  form a1 = integrate (2*ddot(D(u1),D(v1)));
17  integrate_option fopt;
18  fopt.invert = true;
19  form inv_ab = integrate (2*ddot(D(ub),D(vb)), fopt);
20  form c = bb*inv_ab*trans(bb);
21  field u1h = contraction::velocity_field (X1h);
22  field ph (Qh, 0);
23  solver_abtb stokes (a1.uu(), b1.uu(), c.uu(), mp.uu());
24  stokes.solve (-(a1.ub()*u1h.b()), -(b1.ub()*u1h.b()),
25  u1h.set_u(), ph.set_u());
26  dout << catchmark("inv_lambda") << 0 << endl
27  << catchmark("u") << u1h
28  << catchmark("p") << ph;
29 }
void solve(const vec< T, M > &f, const vec< T, M > &g, vec< T, M > &u, vec< T, M > &p) const
Definition: solver_abtb.cc:110
field - piecewise polynomial finite element field
solver_abtb – direct or iterative solver interface for mixed linear systems
Definition: solver_abtb.h:58
STL namespace.
vec< T, M > & set_u()
Definition: field.h:293
irheostream, orheostream - large data streams
Definition: compiler.h:7
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 quadrature_option &qopt, Result dummy=Result())
integrate - integrate a function or an expression
Definition: integrate.h:107
space – piecewise polynomial finite element space
Definition: space.h:229
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
Definition: tensor.cc:211
int main(int argc, char **argv)
std::enable_if< details::is_field_expr_v2_linear_arg< Expr >::value,details::field_expr_v2_nonlinear_terminal_field_grad< typename Expr::scalar_type,typename Expr::memory_type >>::type D(const Expr &expr)
const vec< T, M > & b() const
Definition: field.h:292
const csr< T, M > & ub() const
Definition: form.h:141
std::enable_if< details::is_field_expr_v2_linear_arg< Expr >::value,details::field_expr_v2_nonlinear_terminal_field_div< typename Expr::scalar_type,typename Expr::memory_type >>::type div(const Expr &expr)
catchmark - iostream manipulator
Definition: catchmark.h:30
const csr< T, M > & uu() const
Definition: form.h:140
form - representation of a finite element bilinear form
Definition: form.h:98
csr< T, sequential > trans(const csr< T, sequential > &a)
Definition: csr.h:381
odiststream dout(cout)
Definition: diststream.h:313
integrate_option - send options to the integrate function