~ubuntu-branches/ubuntu/raring/rheolef/raring-proposed

« back to all changes in this revision

Viewing changes to doc/pexamples/robin.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "rheolef.h"
2
2
using namespace rheolef;
3
3
using namespace std;
4
 
size_t N; 
5
 
Float u_ex (const point& x) { return 0.5*(x[0]*(1-x[0]) + x[1]*(1-x[1]) + x[2]*(1-x[2]))/Float(N); }
6
 
Float g    (const point& x) { return u_ex(x) - 0.5/N; }
 
4
#include "cosinusprod_laplace.icc"
7
5
int main(int argc, char**argv) {
8
 
  environment distributed(argc, argv);
 
6
  environment rheolef(argc, argv);
9
7
  geo omega (argv[1]);
10
 
  Float prec = (argc > 2) ? atof(argv[2]) : 1e-10;
11
 
  N = omega.dimension();
12
 
  space Xh (omega, "P1");
13
 
  space Wh (omega["boundary"], "P1");
 
8
  size_t d = omega.dimension();
 
9
  space Xh (omega, argv[2]);
14
10
  form a  (Xh, Xh, "grad_grad");
15
11
  form ab (Xh, Xh, "mass", omega["boundary"]);
16
12
  a = a + ab;
17
 
  form m  (Xh, Xh, "mass");
18
 
  form mb (Wh, Xh, "mass") ;
19
 
  field fh (Xh, 1);
20
 
  field gh = interpolate(Wh, g);
 
13
  field lh = riesz(Xh, f(d)) + riesz(Xh, "boundary", g(d));
21
14
  field uh (Xh);
22
 
  solver sa (a.uu);
23
 
  uh.u = sa.solve (m.uu*fh.u + m.ub*fh.b + mb.uu*gh.u + mb.ub*gh.b - a.ub*uh.b);
24
 
  dcout << uh;
 
15
  solver sa (a.uu());
 
16
  uh.set_u() = sa.solve (lh.u() - a.ub()*uh.b());
 
17
  dout << uh;
25
18
}