rheolef  6.5
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 }
29