/usr/share/doc/rheolef-doc/examples/streamf_cavity.cc is in rheolef-doc 6.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include "rheolef.h"
using namespace rheolef;
using namespace std;
int main (int argc, char** argv) {
environment rheolef (argc, argv);
field uh;
din >> uh;
const space& Xh = uh.get_space();
size_t d = uh.get_geo().dimension();
string valued = (d == 3) ? "vector" : "scalar";
space Ph (uh.get_geo(), "P2", valued);
Ph.block("top"); Ph.block("bottom");
if (d == 3) {
Ph.block("back"); Ph.block("front");
} else {
Ph.block("left"); Ph.block("right");
}
trial u (Xh), psi (Ph); test phi (Ph);
form a = (d == 3) ? integrate (ddot(grad(psi),grad(phi)))
: integrate ( dot(grad(psi),grad(phi)));
form b = (d==3) ? integrate (dot(curl(u),phi))
: integrate (curl(u)*phi);
field psi_h (Ph, 0.);
field lh = b*uh;
solver sa (a.uu());
psi_h.set_u() = sa.solve (lh.u() - a.ub()*psi_h.b());
dout << catchmark("psi") << psi_h;
}
|