rheolef  6.6
streamf_cavity.cc
Go to the documentation of this file.
1 #include "rheolef.h"
2 using namespace rheolef;
3 using namespace std;
4 int main (int argc, char** argv) {
5  environment rheolef (argc, argv);
6  field uh;
7  din >> uh;
8  const space& Xh = uh.get_space();
9  size_t d = uh.get_geo().dimension();
10  string valued = (d == 3) ? "vector" : "scalar";
11  space Ph (uh.get_geo(), "P2", valued);
12  Ph.block("top"); Ph.block("bottom");
13  if (d == 3) {
14  Ph.block("back"); Ph.block("front");
15  } else {
16  Ph.block("left"); Ph.block("right");
17  }
18  trial u (Xh), psi (Ph); test phi (Ph);
19  form a = (d == 3) ? integrate (ddot(grad(psi),grad(phi)))
20  : integrate ( dot(grad(psi),grad(phi)));
21  form b = (d==3) ? integrate (dot(curl(u),phi))
22  : integrate (curl(u)*phi);
23  field psi_h (Ph, 0.);
24  field lh = b*uh;
25  solver sa (a.uu());
26  psi_h.set_u() = sa.solve (lh.u() - a.ub()*psi_h.b());
27  dout << catchmark("psi") << psi_h;
28 }
field_vf_expr< field_vf_expr_curl< test_basic< T, M, VfTag > >> curl(const test_basic< T, M, VfTag > &x)
Definition: operators2.h:147
field - piecewise polynomial finite element field
Definition: field.h:225
const vec< T, M > & u() const
Definition: field.h:279
int main(int argc, char **argv)
field_vf_expr< field_vf_expr_grad< test_basic< T, M, VfTag > >> grad(const test_basic< T, M, VfTag > &x)
Definition: operators2.h:74
STL namespace.
vec< T, M > & set_u()
Definition: field.h:281
irheostream, orheostream - large data streams
Definition: compiler.h:7
const csr< T, M > & uu() const
Definition: form.h:140
const csr< T, M > & ub() const
Definition: form.h:141
space – piecewise polynomial finite element space
Definition: space.h:229
size_t d
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
Definition: tensor.cc:200
idiststream din(cin)
Definition: rotating-hill.h:1
const vec< T, M > & b() const
Definition: field.h:280
catchmark - iostream manipulator
Definition: catchmark.h:30
T dot(const vec< T, M > &x, const int &y)
form - representation of a finite element bilinear form
Definition: form.h:98
solver - direct or interative solver interface
Definition: solver.h:8
Float u(const point &x)
odiststream dout(cout)
Definition: diststream.h:317
field_basic< T, M > integrate(const geo_basic< T, M > &domain, const test_basic< T, M, details::vf_tag_01 > &expr, const quadrature_option_type &qopt=quadrature_option_type())
integrate - integrate a function or an expression
Definition: integrate.h:90